Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[DependencyInjection] Create event managers per connection (BC break)
This commit relies upon new Doctrine bridge classes in symfony/symfony#3434. Previously, no event manager was given as a constructor argument for a Connection service, which lead to a new object being created internally. Since that event manager was not injected and wasn't registered with the service container, the compiler pass was unable to assign listeners on core doctrine-mongdb events. This commit makes the event manager creation consistent with DoctrineBundle. Event managers now exist per connection, and document managers use the event manager of their connection. BC break: the syntax for tags has changed. Previously, listeners were tagged as "doctrine.odm.mongodb.%s_event_listener", with the DM's configuration name as a placeholder. The "doctrine.common.event_listener" tag was also supported for global listeners. Listeners must now be tagged as "doctrine.odm.mongodb.event_listener". Tags may use a "connection" attribute to target a specific connection by name. Additionally, "priority" is also supported. This change applies to event subscribers as well.
- Loading branch information
Showing
5 changed files
with
66 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#112 is it possible to apply this patch to 2.0 branch too?
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it is not. Read the commit message: it relies on the new classes introduced in symfony 2.1
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So no hope for using Connection's events on 2.0?
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not without a refactoring targeting only the 2.0 branch, which is unlikely. Refactoring generally don't occurs in maintenance branches, and as 2.1 is already in beta now, I don't think it is worth doing such a refactoring (which would impact users using the 2.0 branch in their projects)
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stof is correct. If you do need Connection events, I'd suggest back-porting the functionality in your own fork. Doing so in the 2.0 branch of this bundle would involve a bit of redundancy, since the bridge classes aren't available.
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my own recommendation would be to upgrade to 2.1 beta :)
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't use betas on production :(
43e34f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kusmierz I know some companies using 2.1-dev since months even it was not even beta :)
And the MongoDB ODM is only alpha, so you are not using only stable tools.