diff --git a/eZ/Publish/API/Repository/ContentService.php b/eZ/Publish/API/Repository/ContentService.php index 04e38c2492..70dd574cb8 100644 --- a/eZ/Publish/API/Repository/ContentService.php +++ b/eZ/Publish/API/Repository/ContentService.php @@ -21,6 +21,8 @@ use eZ\Publish\API\Repository\Values\Content\Relation; use eZ\Publish\API\Repository\Values\User\User; use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; +use Ibexa\Platform\API\Repository\Value\Content\ContentList; +use Ibexa\Platform\SPI\Repository\Value\Filter; /** * This class provides service methods for managing content. @@ -514,6 +516,11 @@ public function hideContent(ContentInfo $contentInfo): void; */ public function revealContent(ContentInfo $contentInfo): void; + /** + * Fetches Content items from the Repository filtered by the given conditions. + */ + public function find(Filter $filter): ContentList; + /** * Instantiates a new content create struct object. * diff --git a/eZ/Publish/Core/Event/ContentService.php b/eZ/Publish/Core/Event/ContentService.php index 6a0188587b..f14418d051 100644 --- a/eZ/Publish/Core/Event/ContentService.php +++ b/eZ/Publish/Core/Event/ContentService.php @@ -46,6 +46,8 @@ use eZ\Publish\API\Repository\Events\Content\UpdateContentEvent; use eZ\Publish\API\Repository\Events\Content\UpdateContentMetadataEvent; use eZ\Publish\SPI\Repository\Decorator\ContentServiceDecorator; +use Ibexa\Platform\API\Repository\Value\Content\ContentList; +use Ibexa\Platform\SPI\Repository\Value\Filter; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class ContentService extends ContentServiceDecorator @@ -376,4 +378,9 @@ public function revealContent(ContentInfo $contentInfo): void new RevealContentEvent(...$eventData) ); } + + public function find(Filter $filter): ContentList + { + return $this->innerService->find($filter); + } } diff --git a/eZ/Publish/Core/Repository/ContentService.php b/eZ/Publish/Core/Repository/ContentService.php index df2f7dd6de..52db18e40f 100644 --- a/eZ/Publish/Core/Repository/ContentService.php +++ b/eZ/Publish/Core/Repository/ContentService.php @@ -54,6 +54,9 @@ use eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct as SPIRelationCreateStruct; use eZ\Publish\SPI\Persistence\Content\ContentInfo as SPIContentInfo; use Exception; +use Ibexa\Platform\API\Repository\Value\Content\ContentList as APIContentList; +use Ibexa\Platform\Repository\Value as CoreValue; +use Ibexa\Platform\SPI\Repository\Value\Filter; /** * This class provides service methods for managing content. @@ -2509,6 +2512,13 @@ public function revealContent(ContentInfo $contentInfo): void } } + public function find(Filter $filter): APIContentList + { + $contentList = new CoreValue\Content\ContentList(); + + return $contentList; + } + /** * Instantiates a new content create struct object. * diff --git a/eZ/Publish/Core/Repository/SiteAccessAware/ContentService.php b/eZ/Publish/Core/Repository/SiteAccessAware/ContentService.php index 24558b487f..bf3f190083 100644 --- a/eZ/Publish/Core/Repository/SiteAccessAware/ContentService.php +++ b/eZ/Publish/Core/Repository/SiteAccessAware/ContentService.php @@ -23,6 +23,8 @@ use eZ\Publish\API\Repository\Values\Content\VersionInfo; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\LanguageResolver; +use Ibexa\Platform\API\Repository\Value\Content\ContentList; +use Ibexa\Platform\SPI\Repository\Value\Filter; /** * SiteAccess aware implementation of ContentService injecting languages where needed. @@ -242,6 +244,11 @@ public function revealContent(ContentInfo $contentInfo): void $this->service->revealContent($contentInfo); } + public function find(Filter $filter): ContentList + { + return $this->service->find($filter); + } + public function newContentCreateStruct(ContentType $contentType, string $mainLanguageCode): ContentCreateStruct { return $this->service->newContentCreateStruct($contentType, $mainLanguageCode); diff --git a/eZ/Publish/SPI/Repository/Decorator/ContentServiceDecorator.php b/eZ/Publish/SPI/Repository/Decorator/ContentServiceDecorator.php index e448c0a35a..8ad9b724a1 100644 --- a/eZ/Publish/SPI/Repository/Decorator/ContentServiceDecorator.php +++ b/eZ/Publish/SPI/Repository/Decorator/ContentServiceDecorator.php @@ -26,6 +26,8 @@ use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; use eZ\Publish\API\Repository\Values\Content\VersionInfo; use eZ\Publish\API\Repository\Values\User\User; +use Ibexa\Platform\API\Repository\Value\Content\ContentList; +use Ibexa\Platform\SPI\Repository\Value\Filter; abstract class ContentServiceDecorator implements ContentService { @@ -240,6 +242,11 @@ public function revealContent(ContentInfo $contentInfo): void $this->innerService->revealContent($contentInfo); } + public function find(Filter $filter): ContentList + { + return $this->innerService->find($filter); + } + public function newContentCreateStruct( ContentType $contentType, string $mainLanguageCode diff --git a/src/lib/Core/Repository/Value/Content/ContentList.php b/src/lib/Core/Repository/Value/Content/ContentList.php new file mode 100644 index 0000000000..feb5c337cb --- /dev/null +++ b/src/lib/Core/Repository/Value/Content/ContentList.php @@ -0,0 +1,38 @@ +totalCount; + } + + public function getIterator(): Traversable + { + return new ArrayIterator($this->items); + } +}