Closed IonBazan closed 2 years ago
I'm prolly missing something, but how is this different from https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.2/reference/events.html#lifecycle-callbacks?
@malarzm this is just a way to register an EventListener without touching services.yaml
- instead of tagging the service there, you can add an attribute to the class. This mirrors the ORM's feature: https://github.com/doctrine/DoctrineBundle/pull/1345 and uses Symfony 5.3 feature: https://symfony.com/blog/new-in-symfony-5-3-service-autoconfiguration-and-attributes
Ah cool, somehow I thought I saw in PR #AsDocumentListener
on a document class and thought about lifecycle callbacks. Must have been late, sorry ^^
This PR adds
AsDocumentListener
attribute which addsdoctrine_mongodb.odm.event_listener
tag to the service.Depends on #716 as using attributes in DI requires class to be found in order to use Reflection.