/** * Returns all group bookmarks for a given user and a given list of group uids for which bookmarks should be collected for a given list identifier. * * Example: * User is in Groups (1,2,3,4) * Groups to be shown (3,4) * ==> all bookmarks for groups 3,4 are returned * * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser * @param string $groupIds Comma-separated list of group uids * @param string $listIdentifier * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tx_PtExtlist_Domain_Model_Bookmarks_Bookmark> */ public function findBookmarksByFeUserGroupIdsAndListIdentifier(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser, $groupIds, $listIdentifier) { Tx_PtExtbase_Assertions_Assert::isNotEmptyString($listIdentifier, array('message' => 'List identifier must not be empty! 1283117069')); if (!is_array($groupIds)) { $groupIds = explode(',', $groupIds); } $groupBookmarks = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $feUserGroups = $feUser->getUsergroups(); foreach ($feUserGroups as $feUserGroup) { /* @var $feUserGroup \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup */ if (in_array($feUserGroup->getUid(), $groupIds)) { $bookmarks = $this->findGroupBookmarksByFeGroupAndListIdentifier($feUserGroup, $listIdentifier); foreach ($bookmarks as $bookmark) { $groupBookmarks->attach($bookmark); } } } return $groupBookmarks; }