Bug #76993
closedGetting a single extbase query result in a workspace for a relation that has been deleted and re-added returns no relation
100%
Description
This issue is a problem specifically when a domain model entity contains a relation to a single foreign object, and that relation is removed and a new one is added, all while in the workspace.
To reproduce (example):- I have a domain model entity "Blog Entry" that contains a single "Author" object.
- I switch to a workspace
- I delete the existing author, create a new one and assign that author to the "Blog Entry" that had the deleted author
- After using "findAll" to get all blog entries, the blog entry above does have NULL as it's author (when previewing in the frontend)
The problem:
Author is a relation that is being mapped to an object by TYPO3 inside the DataMapper. As author is a single relation, the query is set to "LIMIT 1". However, the "first" author in this scenario is the deleted author. It is being found by the query and then later discarded via the Backend->doLanguageAndWorkspaceOverlay. Which is why I get NULL as the result. The query should get ALL results, do the overlay and then return the first only, without using the LIMIT in the query - at least as long as the workspace overlay is being done after the initial query.