Closed GromNaN closed 6 months ago
I remember that #[AsDocumentListener]
was introduced to mirror #[AsEntityListener]
, is that the same thing? I cannot check it now 😞
It's called AsDoctrineListener
in DoctrineBundle
(it was renamed). That's exactly the same feature.
It's called
AsDoctrineListener
inDoctrineBundle
(it was renamed). That's exactly the same feature.
What I meant is that there are two of them:
Seems like #[AsDocumentListener]
was created to mirror the second one (not the renamed one which was #[AsEventListener]
), but there is no similar implementation to EntityListenerPass
, so I'm not sure if the $method
and $lazy
parameters are used here.
Thanks for your reviews. I discovered this feature last night, I'm going to revisit it with a more awake eye.
It seems that DoctrineMongoDBBundle
diverged from DoctrineBundle
.
RegisterEventListenersAndSubscribersPass
is registered
doctrine.event_listener
and doctrine.event_subscriber
in DoctrineBundle
doctrine_mongodb.odm.event_listener
and doctrine_mongodb.odm.event_subscriber
in DoctrineMongoDBBundle
(note the additionnal .odm
)The respective EventSubscriberInterface
autoconfigure:
doctrine.event_subscriber
in DoctrineBundle
doctrine_mongodb.odm.event_subscriber
in DoctrineMongoDBExtension
#[AsDoctrineListener]
configure the tag doctrine.event_listener
in DoctrineBundle
#[AsEntityListener]
configure the tag doctrine.orm.entity_listener
in DoctrineBundle
#[AsDocumentListener]
configure the tag doctrine_mongodb.odm.event_subscriber
in DoctrineMongoDBBundle
I conclude that DoctrineMongoDBBundle\AsDocumentListener
equivalent to DoctrineBundle\AsDoctrineListener
On the #[AsDocumentListener]
class, the supported parameters should be the same as #[AsDoctrineListener]
.
$priority
can be added: https://github.com/doctrine/DoctrineMongoDBBundle/pull/822$method
and $lazy
have no effect: https://github.com/doctrine/DoctrineMongoDBBundle/pull/825I'm thinking we should rename the class AsDocumentListener
to AsDoctrineListener
, to be clear. That would solve the incorrect deprecation message in the bridge: https://github.com/doctrine/DoctrineMongoDBBundle/issues/816
Thanks for taking a look at this!
@franmomu @malarzm do you agree with the deprecation and doc change?
Same as https://github.com/doctrine/DoctrineBundle/pull/1664.
Fix https://github.com/doctrine/DoctrineMongoDBBundle/issues/816
I rewrote the documentation, by merging
DoctrineBundle
event doc and the good parts of this bundle doc. All mentions to theEventSubscriberInterface
have been removed.