Review main Merged

82070[FEATURE] Introduce driver middleware `UsableForConnectionInterface`

Stefan Bürk CR +2 V +2 Hard +269 −16 updated 01/08/24, 12:42

Commit message

TYPO3 integrated the Doctrine DBAL Driver Middleware concept for
connection (#100089) and all connections (#102496) along with a
enhanced configuration ability (#102586).

This change adds a specific driver middleware interface to TYPO3,
which can be used to determine if a registered driver middleware
can be used for a specific connection.

`\TYPO3\CMS\Core\Database\Middleware\UsableForConnectionInterface`
requires the implementation of following method to a custom driver
middleware implementation if used:

  public function canBeUsedForConnection(
    string $identifier,
    array $connectionParams
  ): bool { ... }

This allows extension authors to provide driver middlewares in a
generic way, but ensure it is only taken into account if further
requirements are met.

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 4

Files 5

Review log 3856

Show 2231 earlier messages
  1. Stefan Bürk uploaded patch set 1 12/03/23, 01:18

  2. Stefan Bürk wrote 12/03/23, 01:20

    Topic set to doctrine-dbal
  3. Stefan Bürk updated the commit message in patch set 2 12/03/23, 01:24

  4. core-ci voted on patch set 1 V +1 12/03/23, 01:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50256

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

  6. Stefan Bürk uploaded patch set 3 V +1 12/03/23, 02:46

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

  8. core-ci commented on patch set 3 12/03/23, 04:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50267

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

  10. core-ci voted on patch set 4 V +1 12/03/23, 12:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50277

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

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

  13. Oliver Klee voted on patch set 5 V +1 12/09/23, 10:20

  14. Benni Mack voted on patch set 5 CR +1 V +1 12/11/23, 07:02

  15. Benni Mack commented on patch set 5 12/11/23, 07:03

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:26

    "id a middleware"

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:29

    remove "provides now" => "now provides"
  16. Stefan Bürk commented on patch set 5 12/14/23, 07:51

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:29 Reply

    remove or replace ? Assumed "replace" now ...
  17. Stefan Bürk uploaded patch set 6 CR +1 V +1 12/14/23, 07:51

  18. Stefan Bürk commented on patch set 6 12/14/23, 07:51

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:26 Reply

    Done

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:29 Reply

    Done
  19. core-ci voted on patch set 6 V +1 12/14/23, 07:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50635

  20. Benni Mack voted on patch set 6 CR +1 V +1 12/14/23, 08:03

  21. Nikita Hovratov commented on patch set 6 CR -1 12/14/23, 09:47

    ConnectionPool.php:271

    This huge array_filter block is so hard to read. I would suggest to keep it simple and use a foreach loop instead and collect all "usable" $driverMiddlewares in a separate array.
  22. Stefan Bürk commented on patch set 6 12/14/23, 10:05

    ConnectionPool.php:271 Reply

    Using foreach would not make it more readable - it would increase the "complexity". Using `array_filter` to filter a array is a good aproach. Using `match` is a easy way, but as a compromis - we could switch to a simple if - construct and a default return instead of the match - maybe that makes it more readable for you.
  23. Oliver Klee commented on patch set 6 V +1 12/14/23, 10:11

    ConnectionPool.php:271 Reply

    Chiming on with my "readability hat" on. ;-) Yes, an `if` instead of the `match` would make the code easier to read for me as well.
  24. Stefan Bürk uploaded patch set 7 CR +1 V +1 12/14/23, 10:12

  25. core-ci voted on patch set 7 V +1 12/14/23, 10:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50646

  26. Nikita Hovratov commented on patch set 7 12/14/23, 10:22

    ConnectionPool.php:271 Reply

    Done
  27. Nikita Hovratov commented on patch set 7 CR -1 12/14/23, 10:23

    ConnectionPool.php:271

    The result of array_filter must be assigned to $driverMiddlewares. Btw is it possible to have a test for the filtering?
  28. Stefan Bürk uploaded patch set 8 CR -1 V +1 12/14/23, 10:46

  29. Stefan Bürk commented on patch set 8 CR -1 12/14/23, 10:47

    will try to come up with test on the weekend - do not have time before
  30. core-ci voted on patch set 8 V +1 12/14/23, 10:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50648

  31. Stefan Bürk uploaded patch set 9 CR -1 V +1 01/06/24, 13:21

  1. Stefan Bürk commented on patch set 9 01/06/24, 13:21

    ConnectionPool.php:271 Reply

    Done
  2. Stefan Bürk uploaded patch set 10 01/06/24, 13:23

  3. core-ci voted on patch set 9 V -1 01/06/24, 13:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51160

  4. Stefan Bürk uploaded patch set 11 01/06/24, 13:26

  5. core-ci voted on patch set 11 V +1 01/06/24, 13:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51163

  6. core-ci voted on patch set 11 V -1 01/06/24, 13:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51164

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

  8. Oliver Klee commented on patch set 11 V +1 01/06/24, 15:28

    ConnectionPool.php:271

    Let's have native type declarations here: ```php $driverMiddlewares = array_filter($driverMiddlewares, static function (array $middleware) use ($connectionName, $connectionParams): bool { ```
  9. Chris Müller commented on patch set 11 01/06/24, 17:02

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:20

    Please remove the starting `_` from the reference. The `_` is part of the anchor definition, not of the reference itself. Also the first one misses a closing bracket `>`.

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:23

    registerd -> registered
  10. Stefan Bürk uploaded patch set 12 V +1 01/08/24, 09:07

  11. Stefan Bürk commented on patch set 12 01/08/24, 09:07

    ConnectionPool.php:271 Reply

    Done

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:20 Reply

    Done

    Feature-102587-IntroduceDriverMiddlewareInterfaceUsableForConnectionInterface.rst:23 Reply

    Done
  12. core-ci voted on patch set 12 V +1 01/08/24, 09:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51201

  13. Stefan Bürk rebased onto patch set 13 V +1 01/08/24, 10:32

  14. Stefan Bürk uploaded patch set 14 01/08/24, 10:36

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

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

  17. Stefan Bürk uploaded patch set 15 01/08/24, 10:58

    Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**")
  18. core-ci voted on patch set 15 V +1 01/08/24, 11:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51215

  19. Christian Kuhn voted on patch set 15 CR +1 V +1 01/08/24, 12:24

  20. Benni Mack commented on patch set 16 CR +1 V +1 01/08/24, 12:35

    Published edit on patch set 15.
  21. Benni Mack voted on patch set 16 CR +1 V +1 01/08/24, 12:35

  22. core-ci voted on patch set 16 V +1 01/08/24, 12:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51231

  23. Christian Kuhn voted on patch set 16 CR +1 V +1 01/08/24, 12:41

  24. Stefan Bürk voted on patch set 16 CR +2 V +2 01/08/24, 12:42

  25. Stefan Bürk merged patch set 17 01/08/24, 12:42