-
-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow doctrine/event-manager 2 #2480
Conversation
I didn't see the issue open 🤦 yeah I'll take a look at those cases |
EventManager::dispatchEvent already checks if there are listeners for the event.
There is this one left: mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php Lines 90 to 101 in f5c1679
which maybe it's easier to read with the check first, but we could change it too. |
$this->evm->dispatchEvent( | ||
Events::loadClassMetadata, | ||
new LoadClassMetadataEventArgs($class, $this->dm) | ||
); | ||
|
||
// phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed | ||
if ($class->isChangeTrackingNotify()) { |
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.
This looks like it should have been called always not only when there are no event listeners for Events::loadClassMetadata
.
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.
Good catch 👍
$this->evm->dispatchEvent( | ||
Events::loadClassMetadata, | ||
new LoadClassMetadataEventArgs($class, $this->dm) | ||
); | ||
|
||
// phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed | ||
if ($class->isChangeTrackingNotify()) { |
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.
Good catch 👍
Re |
Thanks @franmomu! |
Summary
I haven't found any calls to
EventManager::getListeners()
method.