Review main Merged

89704[TASK] Use TCA Schema in Restriction Container

Oli Bartsch CR +2 V +2 Expert +816 −354 updated 07/02/25, 10:56

Commit message

This also migrates related tests to functionals.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 32

Show 12 more files

Review log 2434

Show 69 earlier messages
  1. Oli Bartsch uploaded patch set 1 06/11/25, 10:59

  2. core-ci voted on patch set 1 V -1 06/11/25, 11:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80193

  3. Mathias Brodala commented on patch set 1 06/11/25, 11:13

    DeletedRestriction.php:51

    Wouldn't it be cheaper to directly get() instead and catch the exception? So optimize for the more likely case that the schema is defined instead of the more unlikely case that it is not. Given that queries are used a lot, performance is critical here.
  4. Oli Bartsch uploaded patch set 2 V -1 06/11/25, 14:56

  5. Oli Bartsch commented on patch set 2 06/11/25, 14:59

    DeletedRestriction.php:51 Reply

    As best practice, has() should always be called instead of catching possible exceptions. Additionally, first operation in get() is to check with has() and throw the exception otherwise. So we are calling has() in any case.
  6. core-ci voted on patch set 2 V -1 06/11/25, 15:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80207

  7. Mathias Brodala commented on patch set 2 06/11/25, 15:16

    DeletedRestriction.php:51 Reply

    Geh, you are totally right. So calling has() explicitly is actually cheaper. 😄
  8. Oli Bartsch uploaded patch set 3 V -1 06/26/25, 09:42

  9. core-ci voted on patch set 3 V -1 06/26/25, 09:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80971

  1. Oli Bartsch uploaded patch set 4 V -1 06/26/25, 10:54

  2. core-ci voted on patch set 4 V -1 06/26/25, 11:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80973

  3. Oli Bartsch uploaded patch set 5 V -1 06/26/25, 14:02

  4. core-ci voted on patch set 5 V -1 06/26/25, 14:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80990

  5. Benjamin Franzke uploaded patch set 6 V -1 06/26/25, 19:32

  6. core-ci voted on patch set 6 V -1 06/26/25, 19:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81027

  7. Oli Bartsch uploaded patch set 7 V -1 06/26/25, 20:20

  8. core-ci voted on patch set 7 V +1 06/26/25, 20:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81034

  9. Oli Bartsch uploaded patch set 8 V +1 06/26/25, 20:47

  10. core-ci voted on patch set 8 V +1 06/26/25, 20:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81037

  11. Benni Mack voted on patch set 8 CR +1 V +1 06/27/25, 09:23

  12. Benjamin Franzke commented on patch set 8 CR -1 06/30/25, 07:51

    DeletedRestriction.php:36

    I pushed this construct last week to make tests "green", I'm still -1ing for now, since I want to explore better alternatives. Hope that's ok.
  13. Benjamin Franzke commented on patch set 8 06/30/25, 09:59

    DeletedRestriction.php:36 Reply

    To make clear what I'm thinking about: We basically need to workaround our own legacy in here, which is the EXT:install SetupService that is using ConnectionPool without symfony dependency injection. We actually forbid this for extensions in v12 (deprecated in v11) with: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72558 But since we allowed ConnectionPool in installtool with the failsafe container we didn't notice that we break our own rules, in order to efficently introduce DI in our database layer. So what we'd probably need to achieve is: Use LateBootService wherever ConnectionPool is used in EXT:install. Otherwise we'll be stacking workarounds over workarounds.

    DeletedRecords.php:307

    As for FormEngine data providers we'd actually need mutable Schema (of course via immutability pattern, using object clones) here, that would allow a modified schema instance to be build, which then needs to be passable to Connection restrictions. Having to `rebuild()` the entire schema for temporary modifications does not scale in the long run… Given that in mind we more often need to think about passing `Schema` objects instead of tablename references around.
  14. Oli Bartsch commented on patch set 8 06/30/25, 11:02

    DeletedRecords.php:307 Reply

    Yes sure, this is already in the making for the "TCA Schema API in FormEngine" migration.
  15. Benjamin Franzke uploaded patch set 9 CR +1 V +1 07/01/25, 12:00

  16. Benjamin Franzke commented on patch set 9 07/01/25, 12:00

    DeletedRestriction.php:36 Reply

    Ok, so I tried to make this injectable, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/89956/1/typo3/sysext/core/Classes/Database/Query/Restriction/DeletedRestriction.php …which involved introduction DI in the database layer, requires dozen of rewrites in the install tool by using late booted container in various services and controllers.. > 89956: [WIP][TASK] Require and use symfony DI in database related services | https://review.typo3.org/c/Packages/TYPO3.CMS/+/89956 I noticed that task is too large, but I don't want to block this change any longer, while I really want to avoid `GeneralUtility::getContainer()->has(`… Therefore I've now added a bridge that adds an empty restriction container (which is what we added implicitly to all restrictions with the nullable tca schema factory) in case the connection pool is "used" by the install tool setup tools and therefore the restrictions can now rely on a container being available. Still not super happy with it, but it should be better than before.

    DeletedRecords.php:307 Reply

    I understand, but that is quite far away and we haven't discussed the concrete details. I still think this code is kinda fishy – has been introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/45292 – and I wonder if this can be replaced by better code. I do not understand why the db-querying methods that are tried to be "fixed" here, do not just remove the "DeletedRestriction" from the query.
  17. core-ci voted on patch set 9 V +1 07/01/25, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81184

  18. Benjamin Franzke commented on patch set 9 07/01/25, 12:26

    DeletedRecords.php:307 Reply

    Possible solution: > 89960: [WIP][TASK] Avoid rebuild TCA schema in recycler DeletedRecords model | https://review.typo3.org/c/Packages/TYPO3.CMS/+/89960
  19. Benjamin Franzke uploaded patch set 10 V +1 07/02/25, 06:18

  20. Benjamin Franzke commented on patch set 10 CR +1 V +1 07/02/25, 06:19

    DeletedRecords.php:307 Reply

    This is actually a bug: https://forge.typo3.org/issues/93714 So let's fix this first, this patch is now in a relation chain to that bugfix: > https://review.typo3.org/c/Packages/TYPO3.CMS/+/89960/5?usp=related-change
  21. core-ci voted on patch set 10 V +1 07/02/25, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81231

  22. Benni Mack commented on patch set 10 CR +1 V +1 07/02/25, 09:41

    Thanks for the rework!
  23. Stefan Bürk voted on patch set 10 CR +1 V +1 07/02/25, 09:49

  24. Oli Bartsch voted on patch set 10 CR +2 V +2 07/02/25, 10:56

  25. Oli Bartsch merged patch set 11 07/02/25, 10:56