Review main Merged

82071[TASK] Implement PDO DriverResult as `doctrine/dbal driver middleware`

Stefan Bürk CR +2 V +2 Hard +369 −595 updated 01/09/24, 10:56

Commit message

TYPO3 v12 upgraded to Doctrine DBAL 3.2 with #96287 and cloned a
couple of doctrine PDO related classes to provide the mandatory
`resource to string` mapping for PDO drivers. At that point this
was the only way to mitigate the fact, that `final` has been added
to these classes with Doctrine DBAL 3.1 [1].

The doctrine team introduced the new driver middleware concept
with Doctrine DBAL 3.0.0 [2] and allows the decorator pattern
to be used for Driver, Driver/Connection, Driver/Statement and
Driver/Result.

General support for connection driver middlewares (#100089) and
global driver middlewares (#102496) has been added meanwhile to
TYPO3. Additionally, sortable configuration for middlewares has
been improved with #102586.

This change migrates towards the driver middleware pattern and
reduces the code required to be maintained and check on doctrine
upgrades because cloned and changed classes can be removed and
replaced by minimal decorator implementations.

`\TYPO3\CMS\Core\Database\Middleware\UsableForConnectionInterface`
has been added with #102587 which helps to limit the driver mapping
to supported `pdo_*` driver only.

The superfluous internal classes are removed as non-breaking
following the TYPO3 core policies.

[1] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#bc-break-changes-in-driver-classes
[2] https://github.com/doctrine/dbal/pull/4157

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 6

Files 21

Show 1 more file

Review log 4363

Show 2438 earlier messages
  1. Stefan Bürk uploaded patch set 1 12/03/23, 02:04

  2. Stefan Bürk wrote 12/03/23, 02:05

    Topic set to doctrine-dbal
  3. core-ci voted on patch set 1 V -1 12/03/23, 02:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50259

  4. Stefan Bürk uploaded patch set 2 V -1 12/03/23, 02:54

  5. core-ci voted on patch set 2 V +1 12/03/23, 03:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50263

  6. core-ci voted on patch set 2 V -1 12/03/23, 04:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50268

  7. core-ci voted on patch set 2 V +1 12/03/23, 04:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50268

  8. Stefan Bürk rebased onto patch set 3 V +1 12/03/23, 12:21

  9. core-ci voted on patch set 3 V +1 12/03/23, 12:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50278

  10. Stefan Bürk rebased onto patch set 4 V +1 12/08/23, 12:35

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

  12. Stefan Bürk rebased onto patch set 5 V +1 12/14/23, 07:52

  13. core-ci voted on patch set 5 V +1 12/14/23, 08:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50636

  14. Stefan Bürk rebased onto patch set 6 V +1 01/06/24, 13:24

  15. Stefan Bürk rebased onto patch set 7 01/06/24, 13:35

  16. core-ci voted on patch set 7 V +1 01/06/24, 13:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51165

  17. Stefan Bürk uploaded patch set 8 V +1 01/06/24, 14:15

  18. core-ci voted on patch set 8 V -1 01/06/24, 14:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51166

  19. Chris Müller commented on patch set 8 01/06/24, 16:53

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56

    Hmm, this can become quite problematic when adding further Core middlewares in the future, as extension authors have to adapt their configuration accordingly. Just a thought: Maybe we can introduce some kind of a "meta" driver middleware which does nothing but is added after the Core one's and extension authors can rely on that one. So only one "after" is needed. What do you think?
  20. Stefan Bürk rebased onto patch set 9 V -1 01/08/24, 09:43

  21. Stefan Bürk commented on patch set 9 01/08/24, 09:45

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    not a fan of a dummy fake middleware here which does nothing. but will think about it, however requires to have the ancestor patch merged first.
  22. core-ci voted on patch set 9 V -1 01/08/24, 09:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51208

  23. Stefan Bürk commented on patch set 9 01/08/24, 09:50

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    The point is that these two are mostly relevent. I guess core middlewares comming on top are most likely "optional". For example the adminpanel middleware is a) connection based one and b) optional no one have to relay on. These two middleware provides basic things, one for everything the second for some pdo drivers - which should be there first.
  24. Stefan Bürk commented on patch set 9 01/08/24, 09:55

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Will add a Noop middleware and use it as marker.
  25. Stefan Bürk uploaded patch set 10 V -1 01/08/24, 10:32

  26. Stefan Bürk commented on patch set 10 01/08/24, 10:33

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Introduced a marker middleware now. Fine for you that way ?
  27. Stefan Bürk rebased onto patch set 11 01/08/24, 10:36

  28. core-ci voted on patch set 10 V -1 01/08/24, 10:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51210

  29. core-ci voted on patch set 11 V -1 01/08/24, 10:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51214

  30. Stefan Bürk uploaded patch set 12 V -1 01/08/24, 10:58

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

  32. Benni Mack commented on patch set 12 01/08/24, 12:37

    DriverStatement.php:30

    do we need this still? The comment? Or can we drop this with Doctrine DBAL 4 requirement?
  33. Stefan Bürk commented on patch set 12 CR -1 01/08/24, 13:39

    going to add some comments ...

    DriverStatement.php:30 Reply

    Yes, otherwise we could not return the custom `DriverResult->mapResourceToString()` - which provides the "fix" the whole thing is about.
  34. Stefan Bürk commented on patch set 12 01/08/24, 13:39

    DriverStatement.php:30 Reply

    Argx, misread - you meant the comment. Nope, will remove it.
  35. Stefan Bürk uploaded patch set 13 CR -1 V +1 01/08/24, 14:34

  36. Stefan Bürk commented on patch set 13 01/08/24, 14:34

    DriverStatement.php:30 Reply

    Done
  37. Stefan Bürk commented on patch set 13 01/08/24, 14:36

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Done
  38. core-ci voted on patch set 13 V +1 01/08/24, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51247

  1. Benni Mack commented on patch set 13 01/08/24, 14:43

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    I do not see the benefit of having the Noop middleware. Why? Driver middlewares are not as populated as e.g. HTTP middlewares for Frontend or Backend. I only have one middleware to deal with a multi-node cluster without a round-robin LB in a galera setup. In this case, I know carefully what I would need to do and happy to adapt during TYPO3 updates. I also would like to deep-dive (once we use Doctrine DBAL v4) to get rid of one of the middlewares we ship in core, making this feature a cool but very special case.
  2. Stefan Bürk uploaded patch set 14 V +1 01/08/24, 15:18

  3. Stefan Bürk uploaded patch set 15 01/08/24, 15:21

  4. core-ci voted on patch set 14 V +1 01/08/24, 15:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51254

  5. Stefan Bürk commented on patch set 15 01/08/24, 15:27

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Reverted the `Noop`/Marker driver middleware.
  6. core-ci voted on patch set 15 V +1 01/08/24, 15:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51256

  7. Benni Mack commented on patch set 15 01/08/24, 15:59

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Chris, fine for you?
  8. Chris Müller commented on patch set 15 01/08/24, 17:50

    Feature-102496-IntroduceGlobalDoctrineDBALDriverMiddlewares.rst:56 Reply

    Acknowledged
  9. Oliver Klee voted on patch set 15 V +1 01/08/24, 18:08

  10. Benni Mack updated the commit message in patch set 16 V +1 01/08/24, 20:08

  11. Benni Mack commented on patch set 17 01/08/24, 20:09

    Published edit on patch set 16.
  12. Benni Mack voted on patch set 17 CR +1 V +1 01/08/24, 20:09

  13. core-ci voted on patch set 16 V +1 01/08/24, 20:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51283

  14. core-ci voted on patch set 17 V +1 01/08/24, 20:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51284

  15. Stefan Bürk commented on patch set 18 CR +1 V +1 01/09/24, 03:25

    Published edit on patch set 17.
  16. core-ci voted on patch set 18 V +1 01/09/24, 03:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51296

  17. Benni Mack voted on patch set 18 CR +1 V +1 01/09/24, 06:34

  18. Christian Kuhn commented on patch set 18 01/09/24, 09:15

    ConnectionPool.php:208

    where is this used?

    CustomPdoDriverResultMiddleware.php:26

    this could have a comment on why we need it and why the pdo_ drivers are so special / why mysql is unspecial or the other way round.

    UsableForConnectionInterface.php:33

    thx!
  19. Stefan Bürk uploaded patch set 19 CR +1 V +1 01/09/24, 10:16

  20. Stefan Bürk commented on patch set 19 01/09/24, 10:17

    ConnectionPool.php:208 Reply

    Moved to the corresponding provider like discussed.

    CustomPdoDriverResultMiddleware.php:26 Reply

    Done
  21. core-ci voted on patch set 19 V +1 01/09/24, 10:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51318

  22. Christian Kuhn voted on patch set 19 CR +1 V +1 01/09/24, 10:54

  23. Benni Mack voted on patch set 19 CR +1 V +1 01/09/24, 10:55

  24. Stefan Bürk voted on patch set 19 CR +2 V +2 01/09/24, 10:56

  25. Stefan Bürk merged patch set 20 01/09/24, 10:56