From 04aebc3352f871b9b618098ad6fc0bfbc2a8e747 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:25:16 +0100 Subject: [PATCH 01/22] ViewContentMetaDataCommand.php: Fix arg type Fix "Argument #1 ($contentId) must be of type int, string given" --- .../public_php_api/src/Command/ViewContentMetaDataCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 2d3cdf92d5..769a973779 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); - $contentId = $input->getArgument('contentId'); + $contentId = (int) $input->getArgument('contentId'); // Metadata $contentInfo = $this->contentService->loadContentInfo($contentId); From 5bb1f2d0f0f5f5af882264b182f720fbc81475cb Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:06:23 +0100 Subject: [PATCH 02/22] browsing_content.md: Use loadRelationList instead of loadRelations loadRelations is deprecated in 4.5, and removed in 5.0 Fix "Call to an undefined method Ibexa\Contracts\Core\Repository\ContentService::loadRelations()." on PHPStan + 5.0 --- .../src/Command/ViewContentMetaDataCommand.php | 9 +++++---- .../content_api/browsing_content.md | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 769a973779..c9c5ed1490 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -99,10 +99,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Relations $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relations = $this->contentService->loadRelations($versionInfo); - foreach ($relations as $relation) { - $name = $relation->destinationContentInfo->name; - $output->writeln('Relation to content ' . $name); + $relationCount = $this->contentService->countRelations($versionInfo); + $relationList = $this->contentService->loadRelationList($versionInfo, 0, $relationCount); + foreach ($relationList as $relationListItem) { + $name = $relationListItem->getRelation()->destinationContentInfo->name; + $output->writeln("Relation to content '$name'"); } // Owner diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 5fa8eecf96..a8b34725a6 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -103,11 +103,11 @@ to get only versions of a specific status, e.g.: Content Relations are versioned. To list Relations to and from your content, -you need to pass a `VersionInfo` object to the [`ContentService::loadRelations`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelations) method. +you need to pass a `VersionInfo` object to the [`ContentService::loadRelationList`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) method. You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 106) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 107) =]] ``` You can also specify the version number as the second argument to get Relations for a specific version: @@ -116,7 +116,8 @@ You can also specify the version number as the second argument to get Relations $versionInfo = $this->contentService->loadVersionInfo($contentInfo, 2); ``` -`loadRelations` provides an array of [`Relation`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Relation.html) objects. +`loadRelationList` provides an iterable [`RelationList`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-RelationList.html) object +listing [`Relation`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Relation.html) objects. `Relation` has two main properties: `destinationContentInfo`, and `sourceContentInfo`. It also holds the [relation type](content_relations.md), and the optional Field this relation is made with. @@ -126,7 +127,7 @@ and the optional Field this relation is made with. You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 108, 109) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 109, 110) =]] ``` To get the creator of the current version and not the content item's owner, @@ -139,7 +140,7 @@ the [`getSection`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-C of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 111, 112) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 112, 113) =]] ``` !!! note @@ -155,7 +156,7 @@ You need to provide it with the Object state group. All Object state groups can be retrieved through [`loadObjectStateGroups`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 119) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 120) =]] ``` ## Viewing content with Fields From da094da4c3aec4c9fe85cbf9e7dc2a56d679bd47 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:25:33 +0100 Subject: [PATCH 03/22] RelationController.php: Use loadRelationList instead of loadRelations loadRelations is deprecated in 4.5, and removed in 5.0 Fix "Call to an undefined method Ibexa\Contracts\Core\Repository\ContentService::loadRelations()." on PHPStan + 5.0 --- .../embed_content/src/Controller/RelationController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code_samples/front/embed_content/src/Controller/RelationController.php b/code_samples/front/embed_content/src/Controller/RelationController.php index 129a0369a3..2578231531 100644 --- a/code_samples/front/embed_content/src/Controller/RelationController.php +++ b/code_samples/front/embed_content/src/Controller/RelationController.php @@ -25,13 +25,13 @@ public function showContentAction(View $view, $locationId): View $location = $this->locationService->loadLocation($locationId); $contentInfo = $location->getContentInfo(); $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relations = $this->contentService->loadRelations($versionInfo); + $relationList = $this->contentService->loadRelationList($versionInfo); $items = []; - foreach ($relations as $relation) { - if (in_array($relation->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) { - $items[] = $this->contentService->loadContentByContentInfo($relation->getDestinationContentInfo()); + foreach ($relationList as $relationListItem) { + if (in_array($relationListItem->getRelation()->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) { + $items[] = $this->contentService->loadContentByContentInfo($relationListItem->getRelation()->getDestinationContentInfo()); } } From cfa1c89aace3c1a635bc5baa42b50da3abf0747e Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:57:41 +0100 Subject: [PATCH 04/22] code_samples_usage_diff2html.php: escape < and > --- tools/code_samples/code_samples_usage_diff2html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/code_samples/code_samples_usage_diff2html.php b/tools/code_samples/code_samples_usage_diff2html.php index 965cd3f6ae..f15f6fe28c 100644 --- a/tools/code_samples/code_samples_usage_diff2html.php +++ b/tools/code_samples/code_samples_usage_diff2html.php @@ -33,7 +33,7 @@ continue; } $statusChar = strlen($diffLine) ? $diffLine[0] : ''; - $realLine = $str = substr($diffLine, 1); + $realLine = str_replace(['<', '>'], ['<', '>'], substr($diffLine, 1)); if ($previousStatusChar !== $statusChar) { switch ("$previousStatusChar$statusChar") { case ' +': From aba03c3aa4bd0f57ed1bda896d3cac4126e2bf26 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:50:54 +0100 Subject: [PATCH 05/22] Update code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php --- .../public_php_api/src/Command/ViewContentMetaDataCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index c9c5ed1490..6037ae2515 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $relationCount = $this->contentService->countRelations($versionInfo); $relationList = $this->contentService->loadRelationList($versionInfo, 0, $relationCount); foreach ($relationList as $relationListItem) { - $name = $relationListItem->getRelation()->destinationContentInfo->name; + $name = $relationListItem->hasRelation() ? $relationListItem->getRelation()->destinationContentInfo->name : '(Unauthorized)'; $output->writeln("Relation to content '$name'"); } From 540f4fed681bd47ece82faae8a64832abb11f628 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:22:46 +0100 Subject: [PATCH 06/22] ViewContentMetaDataCommand.php: Use RelationListIteratorAdapter --- .../src/Command/ViewContentMetaDataCommand.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 6037ae2515..de0404822f 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -3,6 +3,8 @@ namespace App\Command; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIterator; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter\RelationListIteratorAdapter; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -99,9 +101,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Relations $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relationCount = $this->contentService->countRelations($versionInfo); - $relationList = $this->contentService->loadRelationList($versionInfo, 0, $relationCount); - foreach ($relationList as $relationListItem) { + $relationListIterator = new BatchIterator( + new RelationListIteratorAdapter( + $this->contentService, + $versionInfo + ) + ); + foreach ($relationListIterator as $relationListItem) { $name = $relationListItem->hasRelation() ? $relationListItem->getRelation()->destinationContentInfo->name : '(Unauthorized)'; $output->writeln("Relation to content '$name'"); } From 1660c18c0689c6909a2ef4ca505c4ebf56e79fe9 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:50:07 +0100 Subject: [PATCH 07/22] browsing_content.md: Use RelationListIteratorAdapter --- .../content_api/browsing_content.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index a8b34725a6..d45efa9193 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -29,10 +29,10 @@ You can also use it to request other Content-related value objects from various ``` php hl_lines="9" // ... [[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 4, 5) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 16, 17) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 18, 19) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 50, 52) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 58, 59) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 60, 66) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 52, 54) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 60, 61) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 62, 68) =]] ``` `ContentInfo` is loaded from the [`ContentService`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 9). @@ -49,7 +49,7 @@ It provides you with basic content metadata such as modification and publication To get the Locations of a content item you need to make use of the [`LocationService`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 68, 72) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 70, 74) =]] ``` [`LocationService::loadLocations`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_loadLocations) @@ -66,7 +66,7 @@ additionally enables you to retrieve the human-readable [URL alias](url_manageme gets the Location's main [URL alias](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-URLAlias.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 68, 71) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 72, 75) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 70, 73) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 74, 77) =]] ``` ### Content type @@ -75,7 +75,7 @@ You can retrieve the content type of a content item through the [`getContentType`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 77, 79) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 79, 81) =]] ``` ### Versions @@ -84,14 +84,14 @@ To iterate over the versions of a content item, use the [`ContentService::loadVersions`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersions) method, which returns an array of `VersionInfo` value objects. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 81, 87) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 83, 90) =]] ``` You can additionally provide the `loadVersions` method with the version status to get only versions of a specific status, e.g.: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 88, 89) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 90, 91) =]] ``` !!! note @@ -103,11 +103,12 @@ to get only versions of a specific status, e.g.: Content Relations are versioned. To list Relations to and from your content, -you need to pass a `VersionInfo` object to the [`ContentService::loadRelationList`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) method. +you can to pass a `VersionInfo` object to the [`ContentService::loadRelationList`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) method which is paginated. +Or you can use the [`RelationListIteratorAdapter`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) within a [`BatchIterator`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html). You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 107) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 102, 113) =]] ``` You can also specify the version number as the second argument to get Relations for a specific version: @@ -127,7 +128,7 @@ and the optional Field this relation is made with. You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 109, 110) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 116) =]] ``` To get the creator of the current version and not the content item's owner, @@ -140,7 +141,7 @@ the [`getSection`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-C of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 112, 113) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 118, 119) =]] ``` !!! note @@ -156,7 +157,7 @@ You need to provide it with the Object state group. All Object state groups can be retrieved through [`loadObjectStateGroups`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 120) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 121, 126) =]] ``` ## Viewing content with Fields From 3ad69f933d5a87d8f4f05881f53fecbdd360899f Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:13:24 +0100 Subject: [PATCH 08/22] PHP API Ref: RelationListIteratorAdapter --- ...orAdapter-RelationListIteratorAdapter.html | 36729 ++++++++++++++++ 1 file changed, 36729 insertions(+) create mode 100644 docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html diff --git a/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html b/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html new file mode 100644 index 0000000000..c6412afc74 --- /dev/null +++ b/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html @@ -0,0 +1,36729 @@ + + + + + PHP API Reference + + + + + + + + + + + + + + +
Copied!
+ + + +
+ +
+ +
+
+
+ + +
+
+
+ + + +
+
+ + +
+

+ RelationListIteratorAdapter

+ +
+ RelationListIteratorAdapter.php + : + 18 + +
+ +
+ Implements + BatchIteratorAdapter
+ +
+ + + + + + + + + + + + + + + + +

+ Methods +

+ +
+

+ public__construct() + +

+
+ RelationListIteratorAdapter.php + : + 20 + +
+
+ +
+ + + + + + + +
+
+
+
+
+
+
public __construct(ContentService $contentService, VersionInfo $versionInfo[, RelationType|null $relationType = null ])
+
+
+
+
+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefault valueDescription
+ $contentService + + ContentService + + - + + - +
+ $versionInfo + + VersionInfo + + - + + - +
+ $relationType + + RelationType|null + + null + + - +
+ +
+

+ publicfetch() + +

+
+ RelationListIteratorAdapter.php + : + 27 + +
+
+ +
+ + + + + + + +
+
+
+
+
+
+
public fetch(int $offset, int $limit) : Iterator
+
+
+
+
+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefault valueDescription
+ $offset + + int + + - + + - +
+ $limit + + int + + - + + - +
+

Return values

+

Iterator

+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + From 82f3b6e3b028aa901201afbf34ae5efae54a141e Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 6 Jun 2025 15:44:39 +0200 Subject: [PATCH 09/22] browsing_content.md: Fix include_file indexes after merge --- .../content_api/browsing_content.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 54ea5d1256..9d2ae74b4b 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -28,10 +28,9 @@ You can also use it to request other Content-related value objects from various ``` php hl_lines="10" // ... [[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 4, 5) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 18, 19) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 22, 24) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 52, 54) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 60, 61) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 62, 68) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 57, 59) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 65, 73) =]] ``` @@ -47,7 +46,7 @@ It provides you with basic content metadata such as modification and publication To get the locations of a content item you need to make use of the [`LocationService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 70, 74) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 75, 79) =]] } ``` [`LocationService::loadLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_loadLocations) uses `ContentInfo` to get all the locations of a content item. @@ -61,7 +60,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C [`URLAliasService::reverseLookup`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-URLAliasService.html#method_reverseLookup) gets the location's main [URL alias](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-URLAlias.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 70, 73) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 74, 77) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 75, 78) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 79, 82) =]] ``` ### Content type @@ -69,7 +68,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C You can retrieve the content type of a content item through the [`getContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 79, 81) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 84, 86) =]] ``` ### Versions @@ -77,13 +76,13 @@ You can retrieve the content type of a content item through the [`getContentType To iterate over the versions of a content item, use the [`ContentService::loadVersions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersions) method, which returns an array of `VersionInfo` value objects. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 83, 90) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 88, 94) =]] ``` You can additionally provide the `loadVersions` method with the version status to get only versions of a specific status, for example: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 90, 91) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 95, 96) =]] ``` !!! note @@ -100,7 +99,7 @@ This method loads only the specified subset of relations to improve performance You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 102, 113) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 107, 118) =]] ``` You can also specify the version number as the second argument to get Relations for a specific version: @@ -119,7 +118,7 @@ It also holds the [relation type](content_relations.md), and the optional field You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 116) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 120, 121) =]] ``` To get the creator of the current version and not the content item's owner, you need to use the `creatorId` property from the current version's `VersionInfo` object. @@ -129,7 +128,7 @@ To get the creator of the current version and not the content item's owner, you You can find the section to which a content item belongs through the [`getSection`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getSection) method of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 118, 119) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 123, 124) =]] ``` !!! note @@ -144,7 +143,7 @@ You need to provide it with the object state group. All object state groups can be retrieved through [`loadObjectStateGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 121, 126) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 126, 131) =]] ``` ## Viewing content with fields From d4b36373ed059b6617d8121fb41f16b78f623ee0 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:09:28 +0200 Subject: [PATCH 10/22] RelationController: use RelationListIteratorAdapter --- .../src/Controller/RelationController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code_samples/front/embed_content/src/Controller/RelationController.php b/code_samples/front/embed_content/src/Controller/RelationController.php index b0cd9aa5be..ce99dbbd25 100644 --- a/code_samples/front/embed_content/src/Controller/RelationController.php +++ b/code_samples/front/embed_content/src/Controller/RelationController.php @@ -3,6 +3,8 @@ namespace App\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIterator; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter\RelationListIteratorAdapter; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Core\MVC\Symfony\View\View; @@ -25,11 +27,16 @@ public function showContentAction(View $view, $locationId): View $location = $this->locationService->loadLocation($locationId); $contentInfo = $location->getContentInfo(); $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relationList = $this->contentService->loadRelationList($versionInfo); + $relationListIterator = new BatchIterator( + new RelationListIteratorAdapter( + $this->contentService, + $versionInfo + ) + ); $items = []; - foreach ($relationList as $relationListItem) { + foreach ($relationListIterator as $relationListItem) { if ($relationListItem->hasRelation() && in_array($relationListItem->getRelation()->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) { $items[] = $this->contentService->loadContentByContentInfo($relationListItem->getRelation()->getDestinationContentInfo()); } From 4a7cf16eca8a3705152a888f099f1d9a06f9e79e Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:35:38 +0200 Subject: [PATCH 11/22] embed_content.md: Match RelationController --- docs/templating/embed_and_list_content/embed_content.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/templating/embed_and_list_content/embed_content.md b/docs/templating/embed_and_list_content/embed_content.md index f2fd959e5b..bb013a1d7d 100644 --- a/docs/templating/embed_and_list_content/embed_content.md +++ b/docs/templating/embed_and_list_content/embed_content.md @@ -36,13 +36,13 @@ You can use a custom controller for any situation where Query types aren't suffi This configuration points to a custom `RelationController` that should render all Articles with the `showContentAction()` method. -``` php hl_lines="23 27 28" +``` php hl_lines="25 29-35" [[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php') =]] ``` -This controller uses the Public PHP API to get [the Relations of a content item](browsing_content.md#relations) (lines 27-28). +This controller uses the Public PHP API to get [the Relations of a content item](browsing_content.md#relations) (lines 29-35). -The controller takes the custom parameter called `accepted_content_types` (line 23), which is an array of content type identifiers that are rendered. +The controller takes the custom parameter called `accepted_content_types` (line 25), which is an array of content type identifiers that are rendered. This way you can control which content types you want to show or exclude. From d025c0cb4e69a013c9adb66cec2314b62866dd34 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:44:49 +0200 Subject: [PATCH 12/22] browsing_content.md: Reword method VS object --- docs/content_management/content_api/browsing_content.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 57f158fc86..6e6f3597e3 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -93,9 +93,12 @@ You can additionally provide the `loadVersions` method with the version status t ### Relations Content Relations are versioned. -To list Relations to and from your content, you can to pass a `VersionInfo` object to the [`ContentService::loadRelationList`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) method which is paginated. -Or you can use the [`RelationListIteratorAdapter`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) within a [`BatchIterator`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html). -This method loads only the specified subset of relations to improve performance and was created with pagination in mind. +To list Relations to and from your content, you can: + +- pass a `VersionInfo` object to the [`ContentService::loadRelationList` method](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) which returns a slice of the relation list thanks to pagination arguments +- use the [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) + within a [`BatchIterator`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html) which allow traversing the relation list using one same object + You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php From 5d898983e73f9e5aa87786acc9ae8bc8788ad349 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 12:33:46 +0200 Subject: [PATCH 13/22] search_api.md + RelationListIteratorAdapter --- .../content_api/browsing_content.md | 4 +++- docs/search/search_api.md | 21 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 077f69b2cc..2ef38e1931 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -101,7 +101,9 @@ To list Relations to and from your content, you can: - pass a `VersionInfo` object to the [`ContentService::loadRelationList` method](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) which returns a slice of the relation list thanks to pagination arguments - use the [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) - within a [`BatchIterator`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html) which allow traversing the relation list using one same object + within a [`BatchIterator`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html) which allow traversing the whole relation list + +See [Processing large result sets](search_api.md#process-large-result-sets) for more information about the `BatchIterator`. You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). diff --git a/docs/search/search_api.md b/docs/search/search_api.md index f7fb147280..ca627745b2 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -127,17 +127,18 @@ You can also define the batch size by setting `$iterator->setBatchSize()`. The following BatchIterator adapters are available, for both `query` and `filter` searches: -| Adapter | Method | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | -| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | -| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | -| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\LocationService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | -| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | +| Adapter | Method | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | +| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | +| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | +| [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::loadRelationList`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) | +| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\LocationService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | +| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | | [`AttributeDefinitionFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeDefinitionFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeDefinitionServiceInterface::findAttributesDefinitions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html#method_findAttributesDefinitions) | -| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeGroupServiceInterface::findAttributeGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | -| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface::findCurrencies`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | -| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface::findProductTypes`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | +| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeGroupServiceInterface::findAttributeGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | +| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface::findCurrencies`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | +| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface::findProductTypes`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | ## Repository filtering From 304c554232bbba12ae6b1acf3442f94eee0a635c Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 12:49:26 +0200 Subject: [PATCH 14/22] search_api.md: Enh. Adapter|Method table --- docs/search/search_api.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/search/search_api.md b/docs/search/search_api.md index ca627745b2..13fe7d5ba2 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -125,20 +125,20 @@ foreach ($iterator as $result) { You can also define the batch size by setting `$iterator->setBatchSize()`. -The following BatchIterator adapters are available, for both `query` and `filter` searches: - -| Adapter | Method | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | -| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | -| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | -| [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::loadRelationList`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) | -| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\LocationService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | -| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | -| [`AttributeDefinitionFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeDefinitionFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeDefinitionServiceInterface::findAttributesDefinitions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html#method_findAttributesDefinitions) | -| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeGroupServiceInterface::findAttributeGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | -| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface::findCurrencies`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | -| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface::findProductTypes`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | +The following BatchIterator adapters are available, for both `query` and `filter` searches, here with the method they replace: + +| Adapter | Equivalent method | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`ContentService::find()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | +| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`SearchService::findContentInfo()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | +| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`SearchService::findContent()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | +| [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) | [`ContentService::loadRelationList()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) | +| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`LocationService::find()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | +| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`SearchService::findLocations()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | +| [`AttributeDefinitionFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeDefinitionFetchAdapter.html) | [`AttributeDefinitionServiceInterface::findAttributesDefinitions()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html#method_findAttributesDefinitions) | +| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`AttributeGroupServiceInterface::findAttributeGroups()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | +| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`CurrencyServiceInterface::findCurrencies()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | +| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`ProductTypeServiceInterface::findProductTypes()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | ## Repository filtering From 63f5702918a93ae6655fd8615817e3024690cc74 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:37:04 +0200 Subject: [PATCH 15/22] search_api.md: Enh. Adapter|Method table --- docs/search/search_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/search/search_api.md b/docs/search/search_api.md index 13fe7d5ba2..5ac34caf98 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -127,7 +127,7 @@ You can also define the batch size by setting `$iterator->setBatchSize()`. The following BatchIterator adapters are available, for both `query` and `filter` searches, here with the method they replace: -| Adapter | Equivalent method | +| Adapter | Regular method | |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`ContentService::find()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | | [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`SearchService::findContentInfo()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | From 19daab97b0d7cdb3ee47835073d00605d747a16e Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 15:00:05 +0200 Subject: [PATCH 16/22] browsing_content.md: Fix an code sample include --- docs/content_management/content_api/browsing_content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 2ef38e1931..984e64323a 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -156,7 +156,7 @@ You need to provide it with the object state group. All object state groups can be retrieved through [`loadObjectStateGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 118, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 118, remove_indent=True) =]] ``` ## Viewing content with fields From 5edf362dfa26008ce186570a05f96ec57d47502c Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 15:23:59 +0200 Subject: [PATCH 17/22] controllers.md: Fix RelationController include --- docs/templating/queries_and_controllers/controllers.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/templating/queries_and_controllers/controllers.md b/docs/templating/queries_and_controllers/controllers.md index da8c2ebe23..22d063de9f 100644 --- a/docs/templating/queries_and_controllers/controllers.md +++ b/docs/templating/queries_and_controllers/controllers.md @@ -13,7 +13,11 @@ You indicate which controller to use in the [content view configuration](templat ``` ``` php -[[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 0, 10) =]][[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 16, 18) =]][[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 37, 40) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 1, 5) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 8, 9) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 10, 12) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 19, 20) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 45) =]] ``` For a full example of using a custom controller, see [Embed content](embed_content.md#embed-relations-with-a-custom-controller). From 2e7142d83addc49c6d9f94025ed2d76c843c78bb Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:03:10 +0200 Subject: [PATCH 18/22] embed_content.md: HL less lines --- docs/templating/embed_and_list_content/embed_content.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/templating/embed_and_list_content/embed_content.md b/docs/templating/embed_and_list_content/embed_content.md index 3d584b5a4d..0398a1bf6d 100644 --- a/docs/templating/embed_and_list_content/embed_content.md +++ b/docs/templating/embed_and_list_content/embed_content.md @@ -36,11 +36,11 @@ You can use a custom controller for any situation where Query types aren't suffi This configuration points to a custom `RelationController` that should render all Articles with the `showContentAction()` method. -``` php hl_lines="21 25-31" +``` php hl_lines="21 26-31" [[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php') =]] ``` -This controller uses the Public PHP API to get [the Relations of a content item](browsing_content.md#relations) (lines 25-31). +This controller uses the Public PHP API to get [the relations of a content item](browsing_content.md#relations) (lines 26-31). The controller takes the custom parameter called `accepted_content_types` (line 21), which is an array of content type identifiers that are rendered. From 90f76c1b755a9e9d49df97028cde085c0f88756d Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:15:56 +0200 Subject: [PATCH 19/22] Update docs/content_management/content_api/browsing_content.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marek Nocoń --- docs/content_management/content_api/browsing_content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 984e64323a..3146970f53 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -69,7 +69,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C ### Content type -You can retrieve the content type of content item through the [`getContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: +You can retrieve the content type of a content item through the [`getContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: ``` php [[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 72, 73, remove_indent=True) =]] From b324feb63d4081504ef8551602a5704ea9cfb76a Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:18:06 +0200 Subject: [PATCH 20/22] browsing_content.md: Fix ContentInfo line nums --- docs/content_management/content_api/browsing_content.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 3146970f53..41aba5fa71 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -25,7 +25,7 @@ This value object provides primitive fields, such as `contentTypeId`, `published You can also use it to request other content-related value objects from various services: -``` php hl_lines="11" +``` php hl_lines="13" [[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 1, 5) =]] // … @@ -36,7 +36,7 @@ You can also use it to request other content-related value objects from various [[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 119) =]] ``` -`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 8). +`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 13). It provides you with basic content metadata such as modification and publication dates or main language code. !!! note "Retrieving content information in a controller" From ca53505bf4d0a2771016878631fbed1fe543257b Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:22:16 +0200 Subject: [PATCH 21/22] Update docs/content_management/content_api/browsing_content.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marek Nocoń --- docs/content_management/content_api/browsing_content.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 41aba5fa71..6665425e93 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -159,9 +159,9 @@ All object state groups can be retrieved through [`loadObjectStateGroups`](/api/ [[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 118, remove_indent=True) =]] ``` -## Viewing content with fields +## Viewing field definitions of content types -To retrieve the fields of the selected content item, you can use the following command: +To retrieve the content type's field definitions of a selected content item, you can use the following command: ``` php hl_lines="17-18 20-27" [[= include_code('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 1, 7) =]] From 65665f476a38fd188a04e0b016358f224af2450e Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:22:39 +0200 Subject: [PATCH 22/22] Update docs/content_management/content_api/browsing_content.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marek Nocoń --- docs/content_management/content_api/browsing_content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 6665425e93..5f726dd949 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -176,7 +176,7 @@ Line 17 shows how [`ContentService::loadContent`](/api/php_api/php_api_reference Line 18 makes use of the [`ContentTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentTypeService.html) to retrieve the content type of the requested item. Lines 20-27 iterate over fields defined by the content type. -For each field they print out its identifier, and then using [`FieldTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-FieldTypeService.html) retrieve the field's value and print it out to the console. +For each field definition they print out its identifier, and then using [`FieldTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-FieldTypeService.html) retrieve the field definition's value and print it out to the console. ## Viewing content in different languages