Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DoctrineBridge][Messenger] Allow using middlewares without the ORM#64219

Open
MatTheCat wants to merge 4 commits into
symfony:8.1from
MatTheCat:ticket_38988
Open

[DoctrineBridge][Messenger] Allow using middlewares without the ORM#64219
MatTheCat wants to merge 4 commits into
symfony:8.1from
MatTheCat:ticket_38988

Conversation

@MatTheCat
Copy link
Copy Markdown
Contributor

Q A
Branch? 8.1
Bug fix? no
New feature? yes
Deprecations? yes
Issues Fix #38988
License MIT

This PR starts by splitting AbstractDoctrineMiddleware into AbstractOrmMiddleware and AbstractDbalMiddleware.
The latter deprecates but still allows to be passed an entity manager name. A connection name can be passed when also passing $isConnectionName to true, which makes the change opt-in.

Then for Symfony 9 we can

  • remove AbstractDbalMiddleware support for entity managers
  • replace AbstractDbalMiddleware::$managerRegistry by a ConnectionRegistry
  • rename AbstractDbalMiddleware::$managerOrConnectionName $connectionName
  • deprecate passing AbstractDbalMiddleware::$isConnectionName (since it will then be unused)

Middlewares were updated accordingly by extending AbstractDbalMiddleware:

  • DoctrineCloseConnectionMiddleware and DoctrineOpenTransactionLoggerMiddleware were no-brainers since they only act on connections (see [DoctrineBridge] Cannot set doctrine_open_transaction_logger’s entity manager name the same way than other middlewares #64194 though)
  • DoctrinePingConnectionMiddleware still resets closed entity managers if $isConnectionName is false to keep BC, but a new DoctrineResetClosedEntityManagerMiddleware was created for this use-case (will need to be wired by the DoctrineBundle).
    I’m not sure this is the right call from a DX perspective though, which is why this PR doesn’t update the DoctrineTransactionMiddleware: should we rather make those act on entity managers depending on $isConnectionName? Or should we split them into an ORM and DBAL parts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DoctrineBridge] Allow to use DoctrinePingConnectionMiddleware without ORM

2 participants