Review main Merged Breaking

73622[!!!][FEATURE] Separate internal_type=folder into an own type

Nikita Hovratov CR +2 V +2 Expert +961 −405 updated 11/22/23, 21:44

Commit message

The TCA type group became more and more a pure
database relation type throughout the years. The
only annoyance that was still there is internal_type
with "folder" set. Although they are very similar
in the user interface, internally they are handled
completely separate. They share only a fraction of
common TCA properties, too.

This leads to checks for internal_type !== 'folder'
everywhere across the codebase. To avoid this,
folder must become an own type.

With folder as an own type, the code becomes much
more readable and there is a lot less if-branching.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Oli Bartsch +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 40

Show 20 more files

Review log 5471

Show 3646 earlier messages
  1. Nikita Hovratov uploaded patch set 1 02/20/22, 17:09

  2. Nikita Hovratov uploaded patch set 2 02/20/22, 17:16

  3. core-ci voted on patch set 1 V -1 02/20/22, 17:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23954

  4. core-ci voted on patch set 2 V -1 02/20/22, 18:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23956

  5. Nikita Hovratov uploaded patch set 3 02/21/22, 13:30

  6. core-ci voted on patch set 3 V -1 02/21/22, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23988

  7. Nikita Hovratov uploaded patch set 4 02/21/22, 14:08

  8. core-ci voted on patch set 4 V +1 02/21/22, 14:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23990

  9. Nikita Hovratov commented on patch set 4 02/21/22, 14:17

    ready for review
  10. Benni Mack commented on patch set 4 V +1 CR +1 02/21/22, 18:06

    Should this
  11. Benni Mack commented on patch set 4 V 0 CR -1 02/21/22, 18:07

    Should be marked as feature, and we should have TcaMigration to move old code to the new structure. Should be fairly doable.
  12. Benni Mack commented on patch set 4 02/21/22, 18:07

    A... TCA migration is in place. Still, this needs to be a Feature so this can be added to the documentation properly.
  13. Benni Mack commented on patch set 4 02/21/22, 18:08

    TcaMigration.php:562

    I think we can now unset all other "internal_type" (and internal_type=db)
  14. Nikita Hovratov uploaded patch set 5 02/21/22, 20:55

  15. Nikita Hovratov commented on patch set 5 02/21/22, 20:55

    Reply

    Added (short) Feature rst.

    TcaMigration.php:562 Reply

    Done
  16. core-ci voted on patch set 5 V +1 02/21/22, 21:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24012

  17. Nikita Hovratov uploaded patch set 6 02/21/22, 21:03

  18. core-ci voted on patch set 6 V +1 02/21/22, 21:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24013

  19. Benjamin Franzke uploaded patch set 7 02/22/22, 07:53

  20. Benjamin Franzke commented on patch set 7 02/22/22, 07:53

    FolderElement.php:177

    This should be t3js-folder-hidden-field, to decouple from type=group but it seems t3js-group-hidden-field is actually unused? So I've just removed it here (and in GroupElement).

    DataMapProcessor.php:1462

    Hm.. despite the previous description, this also returned true for type=group and internal_type=folder. It will now no longer return true for type=folder. Have you double checked whether this was used for internal_type=folder Was the previous behaviour incorrect or never triggered? (I didn't check yet, just juding from the code in here)

    DataMapFactoryTest.php:443

    Drop "AndInternalType" (also below).
  21. Benjamin Franzke commented on patch set 7 02/22/22, 07:59

    DataMapProcessor.php:1462 Reply

    So what I mean: The change itself is fine, the question is: Do we have a bug here (e.g. in v10 and v11) because internal_type=folder was not checked.
  22. core-ci voted on patch set 7 V +1 02/22/22, 08:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24029

  23. Nikita Hovratov commented on patch set 7 02/22/22, 08:10

    DataMapProcessor.php:1462 Reply

    The check !empty($configuration['allowed']) would prevent that for type folder.
  24. Nikita Hovratov commented on patch set 7 02/22/22, 08:20

    FolderElement.php:177 Reply

    Seems it was never used since introduction.

    DataMapFactoryTest.php:443 Reply

    Thanks!
  25. Benjamin Franzke commented on patch set 7 V -1 02/22/22, 08:25

    If I use EXT:styleguide (which should work through TcaMigration) and try to add a new folder and press "Save", the change is not persisted. Can you reproduce?
  26. Nikita Hovratov uploaded patch set 8 02/22/22, 09:19

  27. Nikita Hovratov commented on patch set 8 02/22/22, 09:20

    Reply

    DataHandler checkValue was missing for the new type.
  28. core-ci voted on patch set 8 V +1 02/22/22, 09:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24037

  29. Benjamin Franzke commented on patch set 8 V +1 CR +1 02/22/22, 09:34

    DataMapProcessor.php:1462 Reply

    Ack
  30. Christian Kuhn commented on patch set 8 02/22/22, 10:42

    DefaultConfiguration.php:645

    remove TcaGroup here and add TcaFolder.
  31. Nikita Hovratov commented on patch set 8 02/22/22, 10:53

    DefaultConfiguration.php:645 Reply

    is it not relevant for TcaGroup?
  32. Nikita Hovratov uploaded patch set 9 02/22/22, 10:57

  33. Nikita Hovratov commented on patch set 9 02/22/22, 11:03

    DefaultConfiguration.php:645 Reply

    Hm, there was a fix for that here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/53526/ Also, TcaSelectItems with the dependency to TcaGroup is listed twice there. Is this wrong?
  34. core-ci voted on patch set 9 V +1 02/22/22, 11:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24042

  35. Benjamin Franzke voted on patch set 9 V +1 CR +1 02/22/22, 20:11

  36. Benni Mack commented on patch set 9 02/22/22, 20:40

    ElementBrowser.php:70

    this is really nasty and we should build this in a better fashion soon (but not in this patch)
  37. Nikita Hovratov commented on patch set 9 02/22/22, 21:06

    ElementBrowser.php:70 Reply

    Yep, before the ElementBrowser implementations were synced with the internal_type, but as it is gone now I had to built this for now.
  38. Oli Bartsch commented on patch set 9 CR -1 02/22/22, 21:10

    This is a great patch! I did a quick code review, not yet testes the code.

    folder-element.ts:17

    Latest TCA types usually got a custom element (web component), see e.g. type "category". Could we do this for the folder element, too?

    TcaFolder.php:74

    Could we use a specific exception here?

    DataHandler.php:2019

    Actually this would now be `checkValueForGroupFolderSelect`, right?

    TcaMigration.php:554

    Usually, each migration describes the migration process in PHPDoc. Could we please add one for this method, too?

    TcaMigration.php:566

    The below code is actually really hard to read. For example the "!=== folder" check is duplicated, the isset($fieldConfig['config']['internal_type']) check could be done in the "early return" above. My suggestion would be: if (($fieldConfig['config']['type'] ?? '') !== 'group' || !isset($fieldConfig['config']['internal_type'])) { continue; } unset($tca[$table]['columns'][$fieldName]['config']['internal_type']); if ($fieldConfig['config']['internal_type'] === 'folder') { $tca[$table]['columns'][$fieldName]['config']['type'] = 'folder'; $this->messages[] = 'The TCA field \'' . $fieldName . '\' of table ...'; } else { $this->messages[] = 'The property \'internal_type\' of the TCA ...'; }

    TreeDataProviderFactory.php:68

    I don't get this line. Why do we not just use `$tcaConfiguration['type']` directly?

    Breaking-96983-TableColumnSubType.rst:13

    ... since TCA option `internal_type` ...

    Deprecation-96983-TCAInternal_type.rst:20

    \`internal_type\` (Without escaping obviously. That's just required for gerrit)

    Deprecation-96983-TCAInternal_type.rst:29

    option

    TcaMigrationTest.php:1499

    What's the difference to "aTable"?
  39. Oli Bartsch commented on patch set 9 02/22/22, 21:18

    DataMapFactory.php:317

    Do we need this for "folder" again?
  40. Oli Bartsch commented on patch set 9 02/22/22, 21:21

    TcaGroupTest.php:69

    This does no longer belong here. We should add a dedicated TcaFolderTest.
  41. Nikita Hovratov commented on patch set 9 02/22/22, 21:30

    folder-element.ts:17 Reply

    I have no experience in creating web components. Could we add this later on?

    DataHandler.php:2019 Reply

    I was hesitent to rename functions in DataHandler, eventhough it is a protected method. I can do it, if you say it is ok.

    TreeDataProviderFactory.php:68 Reply

    Before the ElementBrowser implementations were mapped with internal_type. See: typo3/sysext/recordlist/ext_localconf.php Benni commented on the same. We should streamline this later on.

    TcaMigrationTest.php:1499 Reply

    nothing, just to make sure it is fixed in different tables.
  42. Nikita Hovratov uploaded patch set 10 02/23/22, 07:41

  43. Nikita Hovratov commented on patch set 10 02/23/22, 07:45

    TcaFolder.php:74 Reply

    Done

    DataHandler.php:2019 Reply

    Done

    TcaMigration.php:554 Reply

    Done

    TcaMigration.php:566 Reply

    Done

    TreeDataProviderFactory.php:68 Reply

    Sorry, I confused this with ElementBrowser. This is obviously funny.

    Breaking-96983-TableColumnSubType.rst:13 Reply

    Done

    Deprecation-96983-TCAInternal_type.rst:20 Reply

    Done

    Deprecation-96983-TCAInternal_type.rst:29 Reply

    Done
  44. core-ci voted on patch set 10 V -1 02/23/22, 07:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24075

  45. Nikita Hovratov uploaded patch set 11 02/23/22, 08:19

  46. Nikita Hovratov commented on patch set 11 02/23/22, 08:20

    TcaGroupTest.php:69 Reply

    Done

    DataMapFactory.php:317 Reply

    Done
  1. Nikita Hovratov uploaded patch set 12 02/23/22, 08:23

  2. Nikita Hovratov commented on patch set 11 02/23/22, 08:27

    TreeDataProviderFactory.php:68 Reply

    Ok, it has to stay like that, because it is basically the same as it was before but with type instead of internal_type.
  3. core-ci voted on patch set 11 V -1 02/23/22, 08:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24080

  4. core-ci voted on patch set 12 V +1 02/23/22, 08:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24081

  5. Christian Kuhn commented on patch set 12 02/23/22, 10:05

    DefaultConfiguration.php:645 Reply

    i basically want to have an entry for the direct predecessor in this list. this way, the dependencyOrderingService can not resort entries, which basically makes reading & debugging this much easier, especially as soon as other extensions hook into this list with 'before' / 'after'.
  6. Oli Bartsch commented on patch set 12 02/23/22, 11:02

    folder-element.ts:17 Reply

    Ok, I tried this but it seems to be a bit complicated because of the AbstractSortableSelectItems. We could postpone this if no easy solution can be found.

    TreeDataProviderFactory.php:68 Reply

    So but the condition will always be TRUE, as long as type is not "folder", right? Therefore we could simply check this: if (($tcaConfiguration['type'] ?? '') !== 'folder') { And the exception would then just be: > 'TCA Tree configuration is invalid: tree for "type=folder" not implemented yet

    TcaMigrationTest.php:1499 Reply

    Why should the table name matter? This test case seems superfluous to me. Better extend the test case to ensure further config is kept in the migration.
  7. Oli Bartsch uploaded patch set 13 02/23/22, 11:24

  8. Oli Bartsch commented on patch set 13 02/23/22, 11:26

    folder-element.ts:17 Reply

    Done
  9. Nikita Hovratov uploaded patch set 14 02/23/22, 11:28

  10. Nikita Hovratov commented on patch set 13 02/23/22, 11:28

    ElementBrowser.php:70 Reply

    Done

    TreeDataProviderFactory.php:68 Reply

    Done

    TcaMigrationTest.php:1499 Reply

    Done
  11. core-ci voted on patch set 13 V +1 02/23/22, 11:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24095

  12. core-ci voted on patch set 14 V +1 02/23/22, 11:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24097

  13. Oli Bartsch commented on patch set 14 CR -1 02/23/22, 11:41

    a

    DefaultConfiguration.php:621

    TcaFolder missing in "flexFormSegment" and "tcaInputPlaceholderRecord"
  14. Nikita Hovratov uploaded patch set 15 02/24/22, 08:59

  15. Nikita Hovratov commented on patch set 15 02/24/22, 09:00

    DefaultConfiguration.php:621 Reply

    Also added it to siteConfiguration for safety.
  16. core-ci voted on patch set 15 V +1 02/24/22, 09:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24164

  17. Oli Bartsch uploaded patch set 16 02/24/22, 10:36

  18. Oli Bartsch uploaded patch set 17 02/24/22, 10:41

  19. core-ci voted on patch set 16 V +1 02/24/22, 10:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24175

  20. core-ci voted on patch set 17 V +1 02/24/22, 10:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24176

  21. Oli Bartsch voted on patch set 17 V +1 CR +1 02/25/22, 13:55

  22. Benjamin Franzke voted on patch set 17 V +2 CR +2 02/25/22, 15:35

  23. Benjamin Franzke merged patch set 18 02/25/22, 15:35

  24. Simon Schaufelberger commented on patch set 18 02/27/22, 04:16

    GroupElement.php:250

    the outer bracket could have been removed as well
  25. Nikita Hovratov commented on patch set 18 11/22/23, 21:44