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.
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48853
Updated by Erik Frister over 8 years ago
The proposed solution is to remove setting the limit in the QueryResult.
Why:
As long as rows can be unset later on (after they have been selected from SQL), we cannot be sure that we'll always actually get the first when we set a limit. Unsetting rows happens when working with workspaces (as described in the bug ticket when records are deleted), but it also happens for language overlays when using extensions like languagevisibility. Hence, this is not just a workspace issue. This is an issue as long as we post-process the rows coming from the database for workspace and language overlays.
I'm not 100% happy with removing the LIMIT, as it's a performance issue as well. But I didn't see another option that would work around this concern.
Updated by Gerrit Code Review over 3 years ago
- Status changed from New to Under Review
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913
Updated by Gerrit Code Review over 3 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913
Updated by Gerrit Code Review over 3 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913
Updated by Gerrit Code Review over 3 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913
Updated by Gerrit Code Review over 3 years ago
Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913
Updated by Gerrit Code Review over 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70215
Updated by Benni Mack over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a1f22a427f3bc49ab3fc3424859a7e2d7beaa1c9.
Updated by Benni Mack about 2 years ago
- Related to Bug #89456: Translations of IRRE Extbase Records in Workspaces not saved added
Updated by Benni Mack 6 days ago
- Related to Bug #99244: DataMapper uses a lot of memory when retrieving MM-relations in workspaces added