5.0: Use RelationListIterator#2548
Conversation
Fix "Argument #1 ($contentId) must be of type int, string given"
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
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
# Conflicts: # code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php # code_samples/front/embed_content/src/Controller/RelationController.php # docs/content_management/content_api/browsing_content.md
# Conflicts: # docs/content_management/content_api/browsing_content.md
Preview of modified filesPreview of modified Markdown: |
# Conflicts: # docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html
mnocon
left a comment
There was a problem hiding this comment.
No comments about the code, looks solid 💪
Only one suggestion about the wording, as it's not clear to me right now.
| 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. |
There was a problem hiding this comment.
| 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 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. | |
| This method loads only the specified subset of relations to improve performance and was created with pagination in mind. | |
| Alternatively, 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) to iterate over all relations. |
I suggest to rewrite this part somehow.
First we mention the loadRelationList,then we mention RelationListIteratorAdapter object, only to start the next sentence with "This method` - so we're back to discussing loadRelationList?
There was a problem hiding this comment.
@mnocon Thank you for this highlight. That effectively doesn't make much sense. With the "you can to pass" grammar issue and this sentence about "pagination in mind" that doesn't sound like something I would write, there is clearly an issue here.
I rewrite this in d025c0c
https://ez-systems-developer-documentation--2548.com.readthedocs.build/en/2548/content_management/content_api/browsing_content/#relations
mnocon
left a comment
There was a problem hiding this comment.
I'd mention https://doc.ibexa.co/en/latest/search/search_api/#processing-large-result-sets for people not familiar with it (I've found this page only recently, when adjusting the code samples for v5)
|
|
||
| - 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 |
There was a problem hiding this comment.
| 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 allows traversing the whole relation list | |
| See [Processing large result sets](search_api.md#processing-large-result-sets) for more information about the BatchIterator. |
Could you please add the RelationListAdapter to the list of Adapters on https://doc.ibexa.co/en/latest/search/search_api/#processing-large-result-sets ?
To get all relations, use
RelationListIteratorAdapter+BatchIteratorinstead ofContentService::countRelations()+ContentService::loadRelationList()Follows #2544 and in particular this comment.
Previews:
Checklist