Review main Merged

68913[BUGFIX] Extbase Relations are resolved properly in workspaces

Benni Mack CR +2 V +2 Normal +95 −6 updated 08/05/21, 08:13

Commit message

Referencing other records in workspaces usually works in a way
that it is always pointing to the live pendant of a versioned record,
never to the versioned record (t3ver_oid>0). However, for MM this is
the exception - because MM does not have the workspace context.

So when Extbase is resolving a separate query to resolve e.g. a category
from a news record, the MM handling kicks in, but always showed the live
version, because there was no chance to overlay.

Extbase internally first fetches the aggregate root (e.g. news), then does
the overlay and building of the object of the main object, and then fires
another query to fetch e.g. all attached categories / relations. In case
of MM relations for workspaces, they need to be using the versionedUid
of the news record, and not the live version.

However, since this also affects other relations (IRRE without MM,
Select + Group), the RelationHandler is used for workspace'd
relations, and adds one additional query to that.

This change adapts the place where the query for the properties
is built, and takes the UID of the versioned record to resolve the
properties attached to it.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Danilo Caccialanza +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • cbugada +1
    • Danilo Caccialanza +1
    • Martin Tepper +1
    • core-ci +1 CI

Issues 4

Files 2

Review log 4357

Show 2132 earlier messages
  1. Benni Mack uploaded patch set 1 04/29/21, 13:33

  2. core-ci voted on patch set 1 V -1 04/29/21, 13:50 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10903

  3. Benni Mack uploaded patch set 2 04/29/21, 14:07

  4. Benni Mack uploaded patch set 3 04/29/21, 14:08

  5. core-ci voted on patch set 2 V -1 04/29/21, 14:26 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10905

  6. core-ci voted on patch set 3 V -1 04/29/21, 14:27 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10906

  7. Benni Mack uploaded patch set 4 04/29/21, 17:16

  8. core-ci voted on patch set 4 V -1 04/29/21, 17:35 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10925

  9. Benni Mack updated the commit message in patch set 5 04/29/21, 17:36

  10. core-ci voted on patch set 5 V -1 04/29/21, 17:53 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10927

  11. Ralf Merz commented on patch set 5 04/30/21, 05:48

    Hi Benni, please check my comment about the $value.

    DataMapper.php:490

    The $value can be an object OR an integer here. So better on line 482 define "$value = 0;" or so and use $parentObject in the "if"-conditions. Right?
  12. Oli Bartsch commented on patch set 5 04/30/21, 09:59

    DataMapper.php:490 Reply

    I'm fine with the approach of overwriting the value to an int. However, I would like to suggest improving the introduced if clauses a bit: 1. Merge second if into parent one 2. Only call ->_getProperty() once So, could look like this: if ($columnMap->getTypeOfRelation() === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY && $value->_hasProperty('_versionedUid') && ($versionedUid = (int)$value->_getProperty('_versionedUid')) > 0 ) { $value = $versionedUid; }
  13. Benni Mack commented on patch set 5 04/30/21, 10:24

    DataMapper.php:490 Reply

    don't fully get this, Ralf. One thing that needs to be considered here is that we're having a Extbase Query Object, not a Doctrine DBAL Query Object. This means, that the Extbase Typo3DbQueryParser will kick in to resolve the operand value (see createTypedNamedParameter() in this class) which does everything we need already (same as before). This area is also used to resolve IRRE relations, so we need this here unfortunately.
  14. Benni Mack rebased onto patch set 6 04/30/21, 10:35

  15. core-ci voted on patch set 6 V -1 04/30/21, 10:51 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10965

  16. Benni Mack uploaded patch set 7 04/30/21, 11:00

  17. core-ci voted on patch set 7 V -1 04/30/21, 11:14 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10966

  18. Benni Mack uploaded patch set 8 04/30/21, 11:36

  19. core-ci voted on patch set 8 V +1 04/30/21, 11:47 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10968

  20. Oli Bartsch voted on patch set 8 V +1 CR +1 04/30/21, 12:38

  21. Ralf Merz commented on patch set 8 CR +1 04/30/21, 12:58

    Ah, I see this with the $value... the QueryParser takes care of it. So should be fine now 👍

    DataMapper.php:490 Reply

    Done
  22. Benni Mack uploaded patch set 9 04/30/21, 16:49

  23. core-ci voted on patch set 9 V -1 04/30/21, 17:00 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10976

  24. Benni Mack uploaded patch set 10 04/30/21, 17:27

  25. core-ci voted on patch set 10 V +1 04/30/21, 17:40 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10979

  26. Benni Mack updated the commit message in patch set 11 04/30/21, 19:11

  27. core-ci voted on patch set 11 V +1 04/30/21, 19:22 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10984

  28. Danilo Caccialanza commented on patch set 11 V +1 05/02/21, 11:19

    Tested on TYPO3 10.4.15 with tag “<f:uri.image”, I confirm that this patch solve https://forge.typo3.org/issues/88021.
  29. cbugada voted on patch set 11 V +1 05/06/21, 06:37

  30. Oliver Hader commented on patch set 11 05/06/21, 14:34

    DataMapper.php:502

    I feel(!) it should be something like the following (order: versioned, localized, uid) ``` if ($value->_getProperty('_versionedUid') !== $value->getUid()) { $value = (int)$value->_getProperty('_versionedUid'); } elseif ($value->_getProperty('_localizedUid') !== $value->getUid()) { $value = (int)$value->_getProperty('_localizedUid'); } else { $value = (int)$value->getUid(); } ```
  31. Benni Mack uploaded patch set 12 05/06/21, 14:37

  32. Benni Mack commented on patch set 12 05/06/21, 14:37

    DataMapper.php:502 Reply

    You are of course right. This is fixed now.
  1. Oliver Hader voted on patch set 12 CR +1 05/06/21, 14:41

  2. Oliver Hader commented on patch set 12 05/06/21, 14:41

    DataMapper.php:502 Reply

    Awesome! Thx!
  3. core-ci voted on patch set 12 V -1 05/06/21, 14:56 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11264

  4. Benni Mack uploaded patch set 13 05/06/21, 15:02

  5. Oliver Hader voted on patch set 13 CR +1 05/06/21, 15:05

  6. core-ci voted on patch set 13 V +1 05/06/21, 15:14 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11265

  7. Danilo Caccialanza voted on patch set 13 V +1 05/07/21, 06:58

  8. cbugada voted on patch set 13 V +1 05/07/21, 07:10

  9. Tina Westner voted on patch set 13 V +1 05/07/21, 21:21

  10. Oli Bartsch commented on patch set 13 V -1 05/10/21, 10:30

    Testcase in v10 with EXT:news. 1. Created two news records in live workspace 2. Added second record as "related" to first record 3. Changed to Workspace and changed the title of the second (referenced) record 4 Result in workspace preview: 4.1 Without this patch: Changed title (versioned record) is shown 4.2 With this patch: Related news is not shown anymore --- Similar behaviour for categories, although it looks like there is also a bug in the SelectTree since the versioned record is never shown als "selected" after saving the record.
  11. Danilo Caccialanza commented on patch set 13 V 0 05/20/21, 10:17

    Reply Unresolved

    In my experience I can confirm that in general there are bugs in SelectTree, but this was already before this patch. In my opinion this patch will solve a very large number of problems, any small collateral problems should be solved separately at a later time.
  12. Danilo Caccialanza voted on patch set 13 V +1 05/20/21, 10:18

  13. Benni Mack uploaded patch set 14 08/02/21, 16:56

  14. core-ci voted on patch set 14 V +1 08/02/21, 17:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14013

  15. Oli Bartsch voted on patch set 14 V +1 CR +1 08/02/21, 20:32

  16. Benni Mack commented on patch set 14 08/02/21, 21:01

    @all: Please re-test and re-vote, we've fixed the last outstanding issues.
  17. Danilo Caccialanza commented on patch set 14 V -1 08/03/21, 07:39

    Patch applied manually into 10.4.18, in general ok. I found a problem working into a workspace when there are some "hidden images", but I'm not sure if it's a problem to fix in this patch. @benni can you plese help my trying with a case with some "hidden image"? (I send you an email with more details).
  18. Benni Mack commented on patch set 14 08/03/21, 09:35

    Reply

    Hey Danilo, did this occur with the previous revision (PatchSet 13) as well?
  19. Danilo Caccialanza commented on patch set 14 08/03/21, 13:57

    Reply Unresolved

    Yes same problem with the previous revision (PatchSet 13). Try 1) hide actually LIVE element image 2) add new image The resulti is a preview error (if you unhide live elements no errors) I send you an screen shoot via email :)
  20. Danilo Caccialanza commented on patch set 14 V +1 08/05/21, 06:17

    After a thorough analysis we found that the my sengalated problem is not related to the current patch. The problem already existed before apply the patch. For this reason I confirm that everything else is fine and change my vote to +1 .
  21. Danilo Caccialanza voted on patch set 14 CR +1 08/05/21, 07:47

  22. Martin Tepper voted on patch set 14 V +1 08/05/21, 08:06

  23. cbugada voted on patch set 14 V +1 08/05/21, 08:06

  24. Benni Mack commented on patch set 14 V +2 CR +2 08/05/21, 08:13

    Thanks for all the tests!
  25. Benni Mack merged patch set 15 08/05/21, 08:13