From 8e13ff2c8621efc2640ff1fcd2c2b58391b09f6c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 24 May 2016 15:23:50 +0200 Subject: [PATCH 1/5] Fix TODO and bring in abstraction (similar to comments) --- apps/dav/lib/RootCollection.php | 3 +-- .../SystemTagsObjectTypeCollection.php | 23 ++++++++----------- .../SystemTagsRelationsCollection.php | 10 ++++---- .../SystemTagsObjectTypeCollectionTest.php | 13 +++++------ 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index fd05ec2626f87..356aad4e03a04 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -71,8 +71,7 @@ public function __construct() { \OC::$server->getSystemTagManager(), \OC::$server->getSystemTagObjectMapper(), \OC::$server->getUserSession(), - \OC::$server->getGroupManager(), - \OC::$server->getRootFolder() + \OC::$server->getGroupManager() ); $commentsCollection = new Comments\RootCollection( \OC::$server->getCommentsManager(), diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php index ae4b9d51a1bae..ba5b3e1185b66 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php @@ -31,7 +31,6 @@ use OCP\SystemTag\ISystemTagObjectMapper; use OCP\IUserSession; use OCP\IGroupManager; -use OCP\Files\IRootFolder; /** * Collection containing object ids by object type @@ -64,9 +63,9 @@ class SystemTagsObjectTypeCollection implements ICollection { private $userSession; /** - * @var IRootFolder + * @var \Closure **/ - protected $fileRoot; + protected $childExistsFunction; /** * Constructor @@ -76,7 +75,7 @@ class SystemTagsObjectTypeCollection implements ICollection { * @param ISystemTagObjectMapper $tagMapper * @param IUserSession $userSession * @param IGroupManager $groupManager - * @param IRootFolder $fileRoot + * @param \Closure $childExistsFunction */ public function __construct( $objectType, @@ -84,14 +83,14 @@ public function __construct( ISystemTagObjectMapper $tagMapper, IUserSession $userSession, IGroupManager $groupManager, - IRootFolder $fileRoot + \Closure $childExistsFunction ) { $this->tagManager = $tagManager; $this->tagMapper = $tagMapper; $this->objectType = $objectType; $this->userSession = $userSession; $this->groupManager = $groupManager; - $this->fileRoot = $fileRoot; + $this->childExistsFunction = $childExistsFunction; } /** @@ -133,17 +132,13 @@ function getChildren() { } /** + * Checks if a child-node with the specified name exists + * * @param string $name + * @return bool */ function childExists($name) { - // TODO: make this more abstract - if ($this->objectType === 'files') { - // make sure the object is reachable for the current user - $userId = $this->userSession->getUser()->getUID(); - $nodes = $this->fileRoot->getUserFolder($userId)->getById(intval($name)); - return !empty($nodes); - } - return true; + return call_user_func($this->childExistsFunction, $name); } function delete() { diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index 19db39d3f3aac..b09f95ccd65f4 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -29,7 +29,6 @@ use Sabre\DAV\SimpleCollection; use OCP\IUserSession; use OCP\IGroupManager; -use OCP\Files\IRootFolder; class SystemTagsRelationsCollection extends SimpleCollection { @@ -40,14 +39,12 @@ class SystemTagsRelationsCollection extends SimpleCollection { * @param ISystemTagObjectMapper $tagMapper * @param IUserSession $userSession * @param IGroupManager $groupManager - * @param IRootFolder $fileRoot */ public function __construct( ISystemTagManager $tagManager, ISystemTagObjectMapper $tagMapper, IUserSession $userSession, - IGroupManager $groupManager, - IRootFolder $fileRoot + IGroupManager $groupManager ) { $children = [ new SystemTagsObjectTypeCollection( @@ -56,7 +53,10 @@ public function __construct( $tagMapper, $userSession, $groupManager, - $fileRoot + function($name) { + $nodes = \OC::$server->getUserFolder()->getById(intval($name)); + return !empty($nodes); + } ), ]; diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index 628abe6689a67..5b864802251e9 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -71,13 +71,12 @@ protected function setUp() { $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder') ->getMock(); + $userFolder = $this->userFolder; - $fileRoot = $this->getMockBuilder('\OCP\Files\IRootFolder') - ->getMock(); - $fileRoot->expects($this->any()) - ->method('getUserfolder') - ->with('testuser') - ->will($this->returnValue($this->userFolder)); + $closure = function($name) use ($userFolder) { + $nodes = $userFolder->getById(intval($name)); + return !empty($nodes); + }; $this->node = new \OCA\DAV\SystemTag\SystemTagsObjectTypeCollection( 'files', @@ -85,7 +84,7 @@ protected function setUp() { $this->tagMapper, $userSession, $groupManager, - $fileRoot + $closure ); } From c2b077e185495cf3ac42861fece2ed332ddbeb2e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 24 May 2016 15:26:02 +0200 Subject: [PATCH 2/5] Fix doc blocks --- apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php index ba5b3e1185b66..f9ec3183f8221 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php @@ -96,6 +96,7 @@ public function __construct( /** * @param string $name * @param resource|string $data Initial payload + * @return null|string * @throws Forbidden */ function createFile($name, $data = null) { @@ -104,6 +105,7 @@ function createFile($name, $data = null) { /** * @param string $name + * @throws Forbidden */ function createDirectory($name) { throw new Forbidden('Permission denied to create collections'); @@ -111,6 +113,8 @@ function createDirectory($name) { /** * @param string $objectId + * @return SystemTagsObjectMappingCollection + * @throws NotFound */ function getChild($objectId) { // make sure the object exists and is reachable @@ -151,6 +155,7 @@ function getName() { /** * @param string $name + * @throws Forbidden */ function setName($name) { throw new Forbidden('Permission denied to rename this collection'); From 7c039bcbf67128fa72b66f6553af5f5802ae5ea1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 24 May 2016 15:44:19 +0200 Subject: [PATCH 3/5] Allow apps to register SystemTags plugins --- apps/dav/lib/RootCollection.php | 3 +- .../SystemTagsRelationsCollection.php | 20 ++++- .../SystemTag/SystemTagsEntityEvent.php | 76 +++++++++++++++++++ 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 lib/public/SystemTag/SystemTagsEntityEvent.php diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index 356aad4e03a04..f83b0495e1c03 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -71,7 +71,8 @@ public function __construct() { \OC::$server->getSystemTagManager(), \OC::$server->getSystemTagObjectMapper(), \OC::$server->getUserSession(), - \OC::$server->getGroupManager() + \OC::$server->getGroupManager(), + \OC::$server->getEventDispatcher() ); $commentsCollection = new Comments\RootCollection( \OC::$server->getCommentsManager(), diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index b09f95ccd65f4..7c4c613dc47fe 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -25,10 +25,12 @@ use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; +use OCP\SystemTag\SystemTagsEntityEvent; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\SimpleCollection; use OCP\IUserSession; use OCP\IGroupManager; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class SystemTagsRelationsCollection extends SimpleCollection { @@ -39,12 +41,14 @@ class SystemTagsRelationsCollection extends SimpleCollection { * @param ISystemTagObjectMapper $tagMapper * @param IUserSession $userSession * @param IGroupManager $groupManager + * @param EventDispatcherInterface $dispatcher */ public function __construct( ISystemTagManager $tagManager, ISystemTagObjectMapper $tagMapper, IUserSession $userSession, - IGroupManager $groupManager + IGroupManager $groupManager, + EventDispatcherInterface $dispatcher ) { $children = [ new SystemTagsObjectTypeCollection( @@ -60,6 +64,20 @@ function($name) { ), ]; + $event = new SystemTagsEntityEvent(SystemTagsEntityEvent::EVENT_ENTITY); + $dispatcher->dispatch(SystemTagsEntityEvent::EVENT_ENTITY, $event); + + foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) { + $children[] = new SystemTagsObjectTypeCollection( + $entity, + $tagManager, + $tagMapper, + $userSession, + $groupManager, + $entityExistsFunction + ); + } + parent::__construct('root', $children); } diff --git a/lib/public/SystemTag/SystemTagsEntityEvent.php b/lib/public/SystemTag/SystemTagsEntityEvent.php new file mode 100644 index 0000000000000..d57b26709d12c --- /dev/null +++ b/lib/public/SystemTag/SystemTagsEntityEvent.php @@ -0,0 +1,76 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OCP\SystemTag; + +use Symfony\Component\EventDispatcher\Event; + +/** + * Class SystemTagsEntityEvent + * + * @package OCP\SystemTag + * @since 9.2.0 + */ +class SystemTagsEntityEvent extends Event { + + const EVENT_ENTITY = 'OCP\SystemTag\ISystemTagManager::registerEntity'; + + /** @var string */ + protected $event; + /** @var \Closure[] */ + protected $collections; + + /** + * SystemTagsEntityEvent constructor. + * + * @param string $event + * @since 9.2.0 + */ + public function __construct($event) { + $this->event = $event; + $this->collections = []; + } + + /** + * @param string $name + * @param \Closure $entityExistsFunction The closure should take one + * argument, which is the id of the entity, that tags + * should be handled for. The return should then be bool, + * depending on whether tags are allowed (true) or not. + * @throws \OutOfBoundsException when the entity name is already taken + * @since 9.2.0 + */ + public function addEntityCollection($name, \Closure $entityExistsFunction) { + if (isset($this->collections[$name])) { + throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); + } + + $this->collections[$name] = $entityExistsFunction; + } + + /** + * @return \Closure[] + * @since 9.2.0 + */ + public function getEntityCollections() { + return $this->collections; + } +} From 54708f97a1f791f56df0025886184afc20f40344 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 24 May 2016 16:07:38 +0200 Subject: [PATCH 4/5] Fix non-existing exception class --- .../unit/SystemTag/SystemTagMappingNodeTest.php | 2 +- .../tests/unit/SystemTag/SystemTagNodeTest.php | 8 ++++---- .../SystemTag/SystemTagsByIdCollectionTest.php | 12 ++++++------ .../SystemTagsObjectMappingCollectionTest.php | 16 ++++++++-------- .../SystemTagsObjectTypeCollectionTest.php | 12 ++++++------ 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php index 7e0e98eb78d04..c54de152785e8 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php @@ -140,7 +140,7 @@ public function testDeleteTagExpectedException(ISystemTag $tag, $expectedExcepti } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { // assuming the tag existed at the time the node was created, diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php index 0a6c6b9356069..252e592f73f72 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php @@ -79,7 +79,7 @@ public function testGetters($isAdmin) { } /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ public function testSetName() { $this->getTagNode()->setName('2'); @@ -196,7 +196,7 @@ public function testUpdateTagPermissionException($originalTag, $changedArgs, $ex } /** - * @expectedException Sabre\DAV\Exception\Conflict + * @expectedException \Sabre\DAV\Exception\Conflict */ public function testUpdateTagAlreadyExists() { $tag = new SystemTag(1, 'tag1', true, true); @@ -216,7 +216,7 @@ public function testUpdateTagAlreadyExists() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testUpdateTagNotFound() { $tag = new SystemTag(1, 'tag1', true, true); @@ -294,7 +294,7 @@ public function testDeleteTagPermissionException(ISystemTag $tag, $expectedExcep } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { $tag = new SystemTag(1, 'tag1', true, true); diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php index 05a8473133894..ee7a1f658a460 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php @@ -74,14 +74,14 @@ public function adminFlagProvider() { } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testForbiddenCreateFile() { $this->getNode()->createFile('555'); } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testForbiddenCreateDirectory() { $this->getNode()->createDirectory('789'); @@ -107,7 +107,7 @@ public function testGetChild() { } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ public function testGetChildInvalidName() { $this->tagManager->expects($this->once()) @@ -119,7 +119,7 @@ public function testGetChildInvalidName() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildNotFound() { $this->tagManager->expects($this->once()) @@ -131,7 +131,7 @@ public function testGetChildNotFound() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildUserNotVisible() { $tag = new SystemTag(123, 'Test', false, false); @@ -225,7 +225,7 @@ public function testChildExistsNotFound() { } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ public function testChildExistsBadRequest() { $this->tagManager->expects($this->once()) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php index cca781dc28e7d..e4f7e1bbd40ad 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php @@ -128,7 +128,7 @@ public function testAssignTagNoPermission($userVisible, $userAssignable, $expect } /** - * @expectedException Sabre\DAV\Exception\PreconditionFailed + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ public function testAssignTagNotFound() { $this->tagManager->expects($this->once()) @@ -140,7 +140,7 @@ public function testAssignTagNotFound() { } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testForbiddenCreateDirectory() { $this->getNode()->createDirectory('789'); @@ -193,7 +193,7 @@ public function testGetChildNonVisible() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildRelationNotFound() { $this->tagMapper->expects($this->once()) @@ -205,7 +205,7 @@ public function testGetChildRelationNotFound() { } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ public function testGetChildInvalidId() { $this->tagMapper->expects($this->once()) @@ -217,7 +217,7 @@ public function testGetChildInvalidId() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildTagDoesNotExist() { $this->tagMapper->expects($this->once()) @@ -321,7 +321,7 @@ public function testChildExistsTagNotFound() { } /** - * @expectedException Sabre\DAV\Exception\BadRequest + * @expectedException \Sabre\DAV\Exception\BadRequest */ public function testChildExistsInvalidId() { $this->tagMapper->expects($this->once()) @@ -333,14 +333,14 @@ public function testChildExistsInvalidId() { } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testDelete() { $this->getNode()->delete(); } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testSetName() { $this->getNode()->setName('somethingelse'); diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index 5b864802251e9..3c4d4dfc71622 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -89,14 +89,14 @@ protected function setUp() { } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testForbiddenCreateFile() { $this->node->createFile('555'); } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testForbiddenCreateDirectory() { $this->node->createDirectory('789'); @@ -114,7 +114,7 @@ public function testGetChild() { } /** - * @expectedException Sabre\DAV\Exception\NotFound + * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildWithoutAccess() { $this->userFolder->expects($this->once()) @@ -125,7 +125,7 @@ public function testGetChildWithoutAccess() { } /** - * @expectedException Sabre\DAV\Exception\MethodNotAllowed + * @expectedException \Sabre\DAV\Exception\MethodNotAllowed */ public function testGetChildren() { $this->node->getChildren(); @@ -148,14 +148,14 @@ public function testChildExistsWithoutAccess() { } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testDelete() { $this->node->delete(); } /** - * @expectedException Sabre\DAV\Exception\Forbidden + * @expectedException \Sabre\DAV\Exception\Forbidden */ public function testSetName() { $this->node->setName('somethingelse'); From 9795a732ff755b87f2e314d0cb5d3ac193515d83 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 13 Jul 2016 18:33:47 +0200 Subject: [PATCH 5/5] Update since version --- lib/public/SystemTag/SystemTagsEntityEvent.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/public/SystemTag/SystemTagsEntityEvent.php b/lib/public/SystemTag/SystemTagsEntityEvent.php index d57b26709d12c..7ad161027adb6 100644 --- a/lib/public/SystemTag/SystemTagsEntityEvent.php +++ b/lib/public/SystemTag/SystemTagsEntityEvent.php @@ -1,6 +1,6 @@ + * @author Joas Schilling * * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 @@ -27,7 +27,7 @@ * Class SystemTagsEntityEvent * * @package OCP\SystemTag - * @since 9.2.0 + * @since 9.1.0 */ class SystemTagsEntityEvent extends Event { @@ -42,7 +42,7 @@ class SystemTagsEntityEvent extends Event { * SystemTagsEntityEvent constructor. * * @param string $event - * @since 9.2.0 + * @since 9.1.0 */ public function __construct($event) { $this->event = $event; @@ -56,7 +56,7 @@ public function __construct($event) { * should be handled for. The return should then be bool, * depending on whether tags are allowed (true) or not. * @throws \OutOfBoundsException when the entity name is already taken - * @since 9.2.0 + * @since 9.1.0 */ public function addEntityCollection($name, \Closure $entityExistsFunction) { if (isset($this->collections[$name])) { @@ -68,7 +68,7 @@ public function addEntityCollection($name, \Closure $entityExistsFunction) { /** * @return \Closure[] - * @since 9.2.0 + * @since 9.1.0 */ public function getEntityCollections() { return $this->collections;