-
Notifications
You must be signed in to change notification settings - Fork 82
5.0: Use RelationListIterator #2548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.0
Are you sure you want to change the base?
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
...exa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html
Show resolved
Hide resolved
# Conflicts: # docs/content_management/content_api/browsing_content.md
code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php
Show resolved
Hide resolved
Preview of modified filesPreview of modified Markdown: |
# Conflicts: # docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
+BatchIterator
instead ofContentService::countRelations()
+ContentService::loadRelationList()
Follows #2544 and in particular this comment.
Previews:
Checklist