Review main Merged

81588[TASK] Remove usage of deprecated `doctrine/event-manager`

Stefan Bürk CR +2 V +2 Nightmare +2326 −468 updated 11/20/23, 14:24

Commit message

The doctrine team used `doctrine/dbal:3.x` as a transition version
to prepare for a full overhaul with `4.0` and added the removed
or breaking changes as deprecation to the `3.x` versions.

`doctrine/dbal:3.7` deprecated the event based system to enhance
the integration using the `doctrine/event-manger`.

TYPO3 used two types of the deprecated events to provide required
additional database schema handling information:

* `schema-definition-events [1]`
* `schama-manipulation-events [2]`

The proposed way to replace the deprecated `schema-definition-events`
is to use custom SchemaManager classes to provide the required changes.
Therefore, all doctrine SchemaManager variants needs to be extended and
replaced using a custom SchemaManagerFactory. This also also mitigates
the requirement that a SchemaManagerFactory needs to be always set
which we now do.

To mitigate the deprecated `schama-manipulation-events` the proposed
way is to implement custom platform classes. We now extend all provided
platform classes for supported dbms vendors and versions.
To ensure the extended platform classes are used, a custom doctrine/dbal
driver middleware and a driver decorator is added to the system as
global connection middlewares. Global connection middlewares can be
opened up as a feature with another patch.

The old event classes of the deprecated `doctrine/event-manager`
integration are removed and not considered since they are core
internal implementations.

Namespace imports for platform classes are modified in most places
to aliases prefixed with `Doctrine` to make it easier to differentiate
between TYPO3 and doctrine implementations.

Beside the fact that the introduced platform classes are marked as
`@internal` an important ReST file is added to provide information
why the core classes should not be used especially for `instanceof`
checks.

[1] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-extension-via-schema-definition-events
[2] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-extension-via-schema-manipulation-events
[3] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-not-setting-a-schema-manager-factory

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Garvin Hicking +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 57

Show 37 more files

Review log 2336

Show 611 earlier messages
  1. Stefan Bürk uploaded patch set 1 10/26/23, 16:38

  2. core-ci voted on patch set 1 V -1 10/26/23, 16:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48255

  3. Stefan Bürk uploaded patch set 2 V -1 10/26/23, 16:55

  4. core-ci voted on patch set 2 V -1 10/26/23, 17:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48256

  5. Stefan Bürk rebased onto patch set 3 V -1 11/06/23, 09:32

  6. core-ci voted on patch set 3 V -1 11/06/23, 09:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48625

  7. Stefan Bürk uploaded patch set 4 V -1 11/07/23, 11:38

  8. core-ci voted on patch set 4 V -1 11/07/23, 11:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48686

  9. Stefan Bürk uploaded patch set 5 V -1 11/16/23, 12:48

  10. core-ci voted on patch set 5 V +1 11/16/23, 12:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49023

  11. Stefan Bürk rebased onto patch set 6 V +1 11/17/23, 06:47

  1. core-ci voted on patch set 6 V +1 11/17/23, 06:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49052

  2. Stefan Bürk uploaded patch set 7 V +1 11/17/23, 16:10

  3. core-ci voted on patch set 7 V +1 11/17/23, 16:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49070

  4. Stefan Bürk wrote 11/19/23, 16:18

    Topic set to doctrine-dbal
  5. Stefan Bürk uploaded patch set 8 V +1 11/19/23, 18:17

  6. core-ci voted on patch set 8 V +1 11/19/23, 18:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49101

  7. Stefan Bürk rebased onto patch set 9 11/19/23, 18:42

    Copied Votes: * Verified+1 (copy condition: "changekind:NO_CHANGE")
  8. Stefan Bürk uploaded patch set 10 11/19/23, 18:47

    Copied Votes: * Verified+1 (copy condition: "changekind:NO_CHANGE")
  9. core-ci voted on patch set 9 V +1 11/19/23, 18:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49102

  10. core-ci voted on patch set 10 V +1 11/19/23, 18:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49103

  11. Benni Mack commented on patch set 11 V +1 11/19/23, 22:15

    Published edit on patch set 10.
  12. Benni Mack voted on patch set 11 V +1 CR +1 11/19/23, 22:15

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

  14. Oliver Klee voted on patch set 11 CR +1 11/20/23, 07:07

  15. Benni Mack commented on patch set 11 V 0 CR 0 11/20/23, 11:39

    maybe we could use the Middleware approach instead of extending all platforms to have a separate helper class to identify the platform name and features?
  16. Stefan Bürk commented on patch set 11 11/20/23, 11:58

    Reply

    Sadly, that's not possible. doctrine middleware can only be used to decorate `driver`, `connection`, `statement` and `result`. And still, extending all platform classes would be needed needed to integrate the needed changes for the schema definition and alter stuff. Driver are returning the platform created with "new", eventually based on version aware things. That changes slightly with doctrine/dbal 4 - but still this is the only way to replace the deprecated events. See: https://github.com/doctrine/dbal/issues/5784
  17. Stefan Bürk rebased onto patch set 12 CR +1 V +1 11/20/23, 12:41

  18. Christian Kuhn uploaded patch set 13 11/20/23, 12:46

  19. core-ci voted on patch set 12 V +1 11/20/23, 12:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49127

  20. core-ci voted on patch set 13 V +1 11/20/23, 12:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49130

  21. Oliver Klee voted on patch set 13 V +1 11/20/23, 13:16

  22. Christian Kuhn voted on patch set 13 V +1 CR +1 11/20/23, 14:04

  23. Garvin Hicking voted on patch set 13 V +1 CR +1 11/20/23, 14:18

  24. Stefan Bürk voted on patch set 13 V +2 CR +2 11/20/23, 14:24

  25. Stefan Bürk merged patch set 14 11/20/23, 14:24