Make inline TCA fields workspace-transparent for Extbase (foreign_field and foreign_sortby)
In TYPO3 9.5 workspaces still don't work transparently in Frontend (Extbase) for the standard-usecase of inline records.
I feel this is very annoying, and I can't understand why it works in the backend (foreign_field and foreign_sortby), but can't be implemented properly for Extbase!
In my humble opinion the correct method to get the records for an inline-field would be this (only if we are not in live-workspace):
- fetch all live records without workspace-overlay by foreign_field (or mm-relation)
- fetch all workspace-overlay-records by foreign field (or mm-relation)
- fetch the original live records of the workspace-overlay-records and do the overlay
- sort the records with usort by foreign_sortby
Of course this only works if the getter for the foreign_sortby - field is there in the model. Ok, it's maybe expensive to sort the records in PHP context, but 1. this only happens in draft Workspace and 2. this behaviour could be switched on or off with a annotation in the model! And it's something that SHOULD work out of the box!
Any opinions or thoughts to this?
#1 Updated by This Mächler 9 months ago
To clarify, what does not work properly in draft workspace for inline records:
- re-sorting inline records that have already been pulished to live workspace before
- re-assign inline record to another parent that has already been pulished to live workspace before
The only method to make this work right now would be to fetch ALL potential child records "manually" (in the getter of the model, for ex.), filter them by relation partner and sort them with usort. This only has to be done in draft workspace, so there's no performance loss for live.
It's possible to do this (i think i will write a generic workaround class that handles this), but it SHOULD work out of the box without a hack! And that's not impossible