Review main Abandoned

83725[WIP][FEATURE] General purpose Relation Resolver

Nikita Hovratov CR 0 V 0 Nightmare +2737 −0 updated 08/16/24, 15:09

Commit message

New class TYPO3\CMS\Core\DataHandling\RelationResolving\RelationResolver
is introduced, which helps with resolving all types of relations based
on TCA definitions. This could remind one of the Extbase DataMapper.
And yes, it is very similar, however it does not require to define a
PHP Model. It is meant for "simple" use cases like statically displaying
content from the database.

Features:
- Recursive resolving of relations (inline, select, group, category).
- Resolving of "simple" types (flex, select without foreign_table, json)
- File (Reference) resolving (file, folder).
- Session handling for already resolved relations. This also takes care
  of infinite relation resolving loops.
- Result object "ResolvedRelation". @todo Can be replaced with smarter
  "Record" object.
- Works in every context. FE and BE. Used e.g. for Backend previews of
  Content Elements.

Note:
The reference index is used where possible to resolve relation uids.
This has a huge performance boost in opposite to RelationHandler.
However, in some edge-cases it is still used as fallback. Using refindex
for relation resolving in frontend is still experimental in v13 and
might improve in the future.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 34

Show 14 more files

Review log 2750

Show 1425 earlier messages
  1. Nikita Hovratov uploaded patch set 1 04/09/24, 23:13

  2. core-ci voted on patch set 1 V -1 04/09/24, 23:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55645

  3. Nikita Hovratov uploaded patch set 2 V -1 04/09/24, 23:21

  4. core-ci voted on patch set 2 V -1 04/09/24, 23:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55646

  5. Nikita Hovratov uploaded patch set 3 V -1 04/11/24, 20:34

  6. core-ci voted on patch set 3 V -1 04/11/24, 20:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55791

  7. Nikita Hovratov uploaded patch set 4 V -1 04/11/24, 21:08

  8. core-ci voted on patch set 4 V -1 04/11/24, 21:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55795

  9. Nikita Hovratov uploaded patch set 5 V -1 04/11/24, 21:57

  10. core-ci voted on patch set 5 V -1 04/11/24, 22:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55800

  11. Christian Kuhn commented on patch set 5 04/12/24, 06:57

    is this a new version of the query part of RelationHandler?
  12. Nikita Hovratov commented on patch set 5 04/12/24, 16:05

    Reply

    As discussed with lolli, I will try to migrate this to Refindex queries, as much as possible. If there are cases left (e.g. where a field index is necessary), then this will get patched beforehand.
  13. Nikita Hovratov rebased onto patch set 6 V -1 04/13/24, 11:52

  14. core-ci voted on patch set 6 V -1 04/13/24, 11:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55909

  15. Nikita Hovratov uploaded patch set 7 V -1 04/13/24, 12:20

  16. core-ci voted on patch set 7 V -1 04/13/24, 12:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55911

  17. Nikita Hovratov uploaded patch set 8 V -1 04/13/24, 16:43

  18. core-ci voted on patch set 8 V -1 04/13/24, 16:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55913

  19. Nikita Hovratov uploaded patch set 9 V -1 04/13/24, 21:03

  20. core-ci voted on patch set 9 V -1 04/13/24, 21:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55917

  21. Nikita Hovratov uploaded patch set 10 V -1 04/13/24, 22:46

  22. core-ci voted on patch set 10 V -1 04/13/24, 22:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55918

  23. Nikita Hovratov uploaded patch set 11 V -1 04/26/24, 19:57

  24. core-ci voted on patch set 11 V -1 04/26/24, 20:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56804

  25. Nikita Hovratov uploaded patch set 12 V -1 05/14/24, 16:13

  1. core-ci voted on patch set 12 V -1 05/14/24, 16:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57723

  2. Nikita Hovratov uploaded patch set 13 V -1 05/14/24, 18:00

  3. core-ci voted on patch set 13 V +1 05/14/24, 18:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57724

  4. Benni Mack uploaded patch set 14 V +1 05/14/24, 18:41

  5. core-ci voted on patch set 14 V +1 05/14/24, 18:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57725

  6. Nikita Hovratov uploaded patch set 15 V +1 05/14/24, 20:50

  7. core-ci voted on patch set 15 V -1 05/14/24, 20:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57731

  8. Nikita Hovratov uploaded patch set 16 V -1 05/14/24, 21:09

  9. core-ci voted on patch set 16 V -1 05/14/24, 21:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57732

  10. Nikita Hovratov uploaded patch set 17 V -1 05/15/24, 18:46

  11. core-ci voted on patch set 17 V -1 05/15/24, 18:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57782

  12. Nikita Hovratov uploaded patch set 18 V -1 05/15/24, 19:00

  13. core-ci voted on patch set 18 V +1 05/15/24, 19:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57783

  14. Nikita Hovratov uploaded patch set 19 V +1 05/15/24, 19:36

  15. Nikita Hovratov uploaded patch set 20 05/15/24, 19:38

  16. core-ci voted on patch set 19 V +1 05/15/24, 19:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57784

  17. core-ci voted on patch set 20 V +1 05/15/24, 19:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57785

  18. Nikita Hovratov uploaded patch set 21 V +1 05/15/24, 19:47

  19. core-ci voted on patch set 21 V +1 05/15/24, 19:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57786

  20. Christian Kuhn commented on patch set 21 CR -2 05/24/24, 12:01

    Unresolved

    had a chat with nikita. in general, this solution still has too many things that stem from content-blocks needs, and is neither performant, nor general enough. this patch will be hold-back for a while, and will for now not find its way into core as such.

    RelationResolver.php:45 Unresolved

    the main api should at least handle multiple rows for one table at once to be able to resolve relations in a performant way. a later solution could even do that for multiple rows of multiple tables at once.

    RelationResolver.php:46 Unresolved

    we should probably free a general relationResolver from record-type specific handling.

    RelationResolver.php:47 Unresolved

    resolve() does 3 things: find out which fields to resolve resolve fields to uid's resolve uids to records we should probably split this into distinct methods for a general api.

    RelationResolver.php:49 Unresolved

    odd. only recordFactory->createFromDatabaseRow() should be public, everything else should be protected, and this resolver probably does not need to use recordFactory at all, when type-dependent handling is removed.

    RelationResolver.php:97 Unresolved

    both 'flex' and 'json' are odd: this 'convert' has nothing to do with relations. both should probably vanish from the class.

    RelationResolver.php:181 Unresolved

    this feels odd in general. the best reference as overview on what refindex can do and can not do on the reading side do are the tests for RootlineUtility at the moment.

    RelationResolver.php:251 Unresolved

    this is similar to resolve() but does it for multiple records, which resolve() should do in the first place (in a performant way). we also need to decide if we *really* need to resolve relation recursive, or if consumers should do that manually if needed.

    RelationResolver.php:418 Unresolved

    these two queries could be combined in a union as demonstrated in RootlineUtility.
  21. Nikita Hovratov rebased onto patch set 22 V +1 05/24/24, 12:02

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  22. Christian Kuhn updated the commit message in patch set 23 05/24/24, 12:02

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  23. core-ci voted on patch set 22 V +1 05/24/24, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58155

  24. core-ci voted on patch set 23 V +1 05/24/24, 12:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58156

  25. Nikita Hovratov abandoned the change 08/16/24, 15:09