Review main Merged

68915[BUGFIX] Resolve WS overlays in Extbase JOIN queries properly

Benni Mack CR +2 V +2 Hard +220 −89 updated 04/30/21, 10:30

Commit message

When having JOINs in SQL selects, which typically happens
when a MM property is resolved via Extbase's ORM, versionOL()
threw an SQL error because versionOL() also queried "uid_local"
which did not exist in e.g. sys_category.

This change splits up the massive "overlayLanguageAndWorkspace()"
method into smaller chunks and takes a different route when
doing workspace overlays for JOINs. By re-fetching the main tables'
record, all known fields can be identified via array_key_intersect()
and then chunked together again with the JOINed information
via array_replace().

The added tests show that the assertion for MM relations now work
(if the fix is not applied, the included tests fail due to a SQL error in tests),
but deliver a wrong result, which will be fixed with
https://review.typo3.org/c/Packages/TYPO3.CMS/+/68913

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Ralf Merz +1
    • Oli Bartsch +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 2

Files 4

Review log 1519

  1. Benni Mack uploaded patch set 1 04/29/21, 15:55

  2. core-ci voted on patch set 1 V +1 04/29/21, 16:08 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10916

  3. Benni Mack uploaded patch set 2 04/29/21, 16:59

  4. core-ci voted on patch set 2 V +1 04/29/21, 17:09 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10922

  5. Ralf Merz commented on patch set 2 CR +1 04/30/21, 05:37

    Hey Benni, looks fine by reading. I've just added a few CGL related comments. And a I wanna ask about the lines around 570: In one statement you're using the cool "??" operator, but a few lines later we go with the "isset() and "> 0". Could the "??" also work there or is it intended to be like this? Otherwise: 👍 😊

    Typo3DbBackend.php:573

    The closing round and opening curly bracket after the last condition should be on a new line

    Typo3DbBackend.php:579

    The closing round and opening curly bracket after the last condition should be on a new line

    Typo3DbBackend.php:600

    I'd write "So we must set the language used for overlay to the language of the current record."

    Typo3DbBackend.php:605

    The closing round and opening curly bracket after the last condition should be on a new line

    Typo3DbBackend.php:620

    missing "are": ...limits are not met...
  6. Benni Mack uploaded patch set 3 04/30/21, 08:20

  7. core-ci voted on patch set 3 V +1 04/30/21, 08:32 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10959

  8. Ralf Merz commented on patch set 3 CR +1 04/30/21, 08:39

    Thanks for the changes 👍

    Typo3DbBackend.php:573 Reply

    Done

    Typo3DbBackend.php:579 Reply

    Done

    Typo3DbBackend.php:600 Reply

    Done

    Typo3DbBackend.php:605 Reply

    Done

    Typo3DbBackend.php:620 Reply

    Done
  9. Oli Bartsch commented on patch set 3 04/30/21, 09:31

    Typo3DbBackend.php:523

    Just is_array($row) should be fine as it implies that row !== null. Alternatively we could also check for an empty array with `$row !== []`.

    Typo3DbBackend.php:551

    Same es above.

    Typo3DbBackend.php:624

    This does not happen here anymore, right?
  10. Benni Mack commented on patch set 3 04/30/21, 09:35

    Typo3DbBackend.php:624 Reply

    sure, this happens still in versionOL() which is called later-on
  11. Benni Mack uploaded patch set 4 04/30/21, 09:36

  12. Oli Bartsch commented on patch set 4 V +1 CR +1 04/30/21, 09:46

    Typo3DbBackend.php:624 Reply

    Ok, I was referring to this function which does not call versionOL(). But I'm fine with keeping this information here.
  13. core-ci voted on patch set 4 V +1 04/30/21, 09:46 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10964

  14. Benni Mack commented on patch set 4 04/30/21, 10:04

    Typo3DbBackend.php:624 Reply

    Ack
  15. Nikita Hovratov voted on patch set 4 V +1 04/30/21, 10:12

  16. Christian Kuhn voted on patch set 4 CR +1 04/30/21, 10:15

  17. Ralf Merz commented on patch set 4 CR +1 04/30/21, 10:29

    👍 I've seen the comments of Oliver have been addressed.

    Typo3DbBackend.php:523 Reply

    Done

    Typo3DbBackend.php:551 Reply

    Done
  18. Benni Mack voted on patch set 4 V +2 CR +2 04/30/21, 10:30

  19. Benni Mack merged patch set 5 04/30/21, 10:30