Review main Merged

50103[BUGFIX] Remove relations from MM table

Nicole Hummel CR +2 V +2 Easy +7 −0 updated 12/31/16, 14:40

Commit message

If extbase deletes an object it doesn't delete its relations in an
MM table. This patch adds the check for a possible MM relation table and
ensures all relations get deleted as well. If the parent table supports
a deleted flag, no relations will be deleted to be able to restore the
parent record again.

Review

  • Code review CR +2
    • Anja Leichsenring +2
    • Alexander Stehlik +1
  • Verified V +2
    • Anja Leichsenring +2
    • Robert Jelinek +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1316

  1. Nicole Hummel uploaded patch set 1 10/07/16, 12:03

  2. TYPO3com voted on patch set 1 V +1 10/07/16, 12:07 Completed build in 03m 34s on Fri, 7 Oct, 02:07 PM Test Summary: 18545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3368

  3. Robert Jelinek commented on patch set 1 V +1 10/07/16, 12:57

    * verified Note: if a programmer uses cascade remove with MM (which in my opinion is strange design), this patch does not work correctly.
  4. Nicole Hummel commented on patch set 1 10/07/16, 13:06

    @Robert: Your case would not work in any way as cascade always looks for entities (with uid in database)
  5. Tymoteusz Motylewski commented on patch set 1 11/04/16, 15:52

    will it remove relations for a record which is just "marked" as deleted? So when undeleting it, relations will be lost?
  6. Robert Jelinek commented on patch set 1 V 0 11/05/16, 14:24

    Analyzing T.M.s questions leads to the insight, that his comment is correct: Patch Set 1 will delete the relations also for parent records using a deleted column, so undeleting the parent record leads to lost relations to the child records. In my opinion this is better than leaving the relations behind and corrupt other records (as sketched in my original bug report). Further investigations convinced me, that there is a more global problem when mixing tables related to each other and having different policies using a deleted column or not. But this is not part of this review and should be reported ... Currently MM intermediate tables do not have a deleted column, so there must be a mechanism to use the deleted column of the parent entity. As a proposal, the argument $markAsDeleted of the method removeEntity should be passed to the removeRelatedObjects method and further subroutines ...
  7. Nicole Hummel uploaded patch set 2 12/09/16, 11:52

  8. TYPO3com voted on patch set 2 V +1 12/09/16, 11:57 Completed build in 04m 08s on Fri, 9 Dec, 12:57 PM Test Summary: 54373 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5649

  9. Nicole Hummel commented on patch set 2 12/09/16, 12:01

    Added a check for the deleted flag and only remove relations if not available. Thanks Tymec
  10. Oliver Klee updated the commit message in patch set 3 12/09/16, 12:23

  11. TYPO3com voted on patch set 3 V +1 12/09/16, 12:27 Completed build in 04m 18s on Fri, 9 Dec, 01:27 PM Test Summary: 54373 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5651

  12. Robert Jelinek voted on patch set 3 V +1 12/10/16, 10:25

  13. Alexander Stehlik voted on patch set 3 CR +1 12/10/16, 11:51

  14. Anja Leichsenring voted on patch set 3 CR +2 V +2 12/31/16, 14:40

  15. Gerrit merged patch set 3 12/31/16, 14:40

  16. Anja Leichsenring commented on patch set 4 12/31/16, 14:40

    Cherry Picked This patchset was cherry picked to branch TYPO3_7-6 as commit c89b21aade331a8c6af87e668d2a00506889f2bf