[DoctrineBridge][Messenger] Allow using middlewares without the ORM#64219
Open
MatTheCat wants to merge 4 commits into
Open
[DoctrineBridge][Messenger] Allow using middlewares without the ORM#64219MatTheCat wants to merge 4 commits into
MatTheCat wants to merge 4 commits into
Conversation
062ee26 to
47229e1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR starts by splitting
AbstractDoctrineMiddlewareintoAbstractOrmMiddlewareandAbstractDbalMiddleware.The latter deprecates but still allows to be passed an entity manager name. A connection name can be passed when also passing
$isConnectionNametotrue, which makes the change opt-in.Then for Symfony 9 we can
AbstractDbalMiddlewaresupport for entity managersAbstractDbalMiddleware::$managerRegistryby aConnectionRegistryAbstractDbalMiddleware::$managerOrConnectionName$connectionNameAbstractDbalMiddleware::$isConnectionName(since it will then be unused)Middlewares were updated accordingly by extending
AbstractDbalMiddleware:DoctrineCloseConnectionMiddlewareandDoctrineOpenTransactionLoggerMiddlewarewere no-brainers since they only act on connections (see [DoctrineBridge] Cannot setdoctrine_open_transaction_logger’s entity manager name the same way than other middlewares #64194 though)DoctrinePingConnectionMiddlewarestill resets closed entity managers if$isConnectionNameisfalseto keep BC, but a newDoctrineResetClosedEntityManagerMiddlewarewas 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?