-
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?
Changes from 15 commits
04aebc3
5bb1f2d
da094da
cfa1c89
aba03c3
540f4fe
1660c18
3ad69f9
967d0a1
ee23889
82f3b6e
d4b3637
4a7cf16
fe4b07c
6bfd8f2
5ff4dee
d025c0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,9 +28,9 @@ | |||||||||||||||
``` 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', 20, 22) =]] | ||||||||||||||||
[[= 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', 55, 57) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 63, 72) =]] | ||||||||||||||||
[[= 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) =]] | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
@@ -46,7 +46,7 @@ | |||||||||||||||
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', 73, 77) =]] } | ||||||||||||||||
[[= 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. | ||||||||||||||||
|
@@ -60,29 +60,29 @@ | |||||||||||||||
[`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', 73, 76) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 77, 80) =]] | ||||||||||||||||
[[= 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 | ||||||||||||||||
|
||||||||||||||||
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', 82, 84) =]] | ||||||||||||||||
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 84, 86) =]] | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
### Versions | ||||||||||||||||
|
||||||||||||||||
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', 86, 92) =]] | ||||||||||||||||
[[= 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', 93, 94) =]] | ||||||||||||||||
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 95, 96) =]] | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
!!! note | ||||||||||||||||
|
@@ -93,12 +93,13 @@ | |||||||||||||||
### Relations | ||||||||||||||||
|
||||||||||||||||
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. | ||||||||||||||||
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. | ||||||||||||||||
Check failure on line 96 in docs/content_management/content_api/browsing_content.md
|
||||||||||||||||
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). | ||||||||||||||||
Check failure on line 97 in docs/content_management/content_api/browsing_content.md
|
||||||||||||||||
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 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
Uh oh!
There was an error while loading. Please reload this page.