IBX-10602: Refactored NodeFactory to fetch translations for n first items with a new endpoint fetching translated names#1777
IBX-10602: Refactored NodeFactory to fetch translations for n first items with a new endpoint fetching translated names#1777
NodeFactory to fetch translations for n first items with a new endpoint fetching translated names#1777Conversation
|
NodeFactory to fetch translations for n first itemsNodeFactory to fetch translations for n first items
99a8ce1 to
e3dc3e3
Compare
NodeFactory to fetch translations for n first itemsNodeFactory to fetch translations for n first items
NodeFactory to fetch translations for n first itemsNodeFactory to fetch translations for n first items with a new endpoint fetching translated names
b2671cb to
ceaad12
Compare
ceaad12 to
13432a4
Compare
src/lib/REST/Output/ValueObjectVisitor/ContentTree/TranslatedNamesListVisitor.php
Outdated
Show resolved
Hide resolved
| <entry> | ||
| <contentId>57</contentId> | ||
| <languages> | ||
| <eng-GB>Home</eng-GB> |
There was a problem hiding this comment.
Technically, this is not a valid XML - code should not be the type of an element.
You could "fix" this both in JSON and XML if you instead provided a list of objects with language code + name properties.
If it changes the shape of the response, frontend might need to map this into the shape they want later.
Note
Given how we treat XML, consider this suggestion optional
There was a problem hiding this comment.
It's changed to a better structure
| # | ||
|
|
||
| ibexa.rest.location.tree.load_translated_names_by_content_ids: | ||
| path: /content/objects/translated-names-list |
There was a problem hiding this comment.
naming: we expose on API level "content items", "content object" is a legacy name
There was a problem hiding this comment.
what would be example name in this case? I don't think we have anything with content items yet.
| $contentInfos = $contentService->loadContentInfoList($contentIds); | ||
|
|
||
| $versionInfoList = $contentService->loadVersionInfoListByContentInfo($contentInfos); |
There was a problem hiding this comment.
Optional: Given we're touching here performance, you might consider creating dedicated ContentService::load* method for this, instead of performing 2 operations.
We might want to tackle it, if further performance issues arise, this is not a "must" for me.
|



Description:
NodeFactoryto accept an optionaltranslationsLimitparameter, allowing the content tree to fetch translated names only for the first N items (passed viatranslationsLimitquery param on theload-subtreeendpoint) instead of all children, improving performance for large trees.GET /api/ibexa/v2/content/objects/translated-names-listthat returns translated names for a given set of content IDs. This allows the frontend to lazily load translations for remaining items on demand.TranslatedNamesListREST Value +TranslatedNamesListVisitoroutput visitorNew endpoint
Route:
GET /api/ibexa/v2/content/objects/translated-names-listExample request
Example response
{ "ContentTreeTranslatedNamesList": { "_media-type": "application/vnd.ibexa.api.ContentTreeTranslatedNamesList+json", "entries": [ { "contentId": 57, "languages": { "eng-GB": "Home" } }, { "contentId": 41, "languages": { "eng-US": "Media" } } ] } }For QA:
Documentation: