Skip to content
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

add AsDocumentListener attribute #715

Merged
merged 1 commit into from
Nov 26, 2021

Conversation

IonBazan
Copy link
Member

@IonBazan IonBazan commented Nov 23, 2021

This PR adds AsDocumentListener attribute which adds doctrine_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.

@IonBazan IonBazan force-pushed the feature/as-document-listener branch 2 times, most recently from 6e5a0d7 to bd0c809 Compare November 24, 2021 06:22
@IonBazan IonBazan marked this pull request as ready for review November 24, 2021 06:23
@IonBazan IonBazan self-assigned this Nov 24, 2021
@IonBazan IonBazan added this to the 4.4.0 milestone Nov 24, 2021
@malarzm
Copy link
Member

malarzm commented Nov 24, 2021

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?

@IonBazan
Copy link
Member Author

@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: doctrine/DoctrineBundle#1345 and uses Symfony 5.3 feature: https://symfony.com/blog/new-in-symfony-5-3-service-autoconfiguration-and-attributes

@malarzm
Copy link
Member

malarzm commented Nov 25, 2021

Ah cool, somehow I thought I saw in PR #AsDocumentListener on a document class and thought about lifecycle callbacks. Must have been late, sorry ^^

@IonBazan IonBazan merged commit f501a53 into doctrine:4.4.x Nov 26, 2021
@IonBazan IonBazan deleted the feature/as-document-listener branch November 26, 2021 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants