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

Added EventSubscriberInterface marker interface to support autoconfiguration #1119

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

lyrixx
Copy link
Contributor

@lyrixx lyrixx commented Jan 6, 2020

fixes #674

By implementing Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface, your Doctrine ORM Subscribers will be automatically configured

@lyrixx lyrixx changed the title Added ServiceEventSubscriber marker interface to support autoconfiguration Added EventSubscriberInterface marker interface to support autoconfiguration Jan 6, 2020
@ostrolucky
Copy link
Member

This is solution for #821 right? But interface proposed in this PR looks nothing like proposals in issue.

@lyrixx
Copy link
Contributor Author

lyrixx commented Jan 6, 2020

Nope, it's for #674 as stated in the PR description.

@alcaeus alcaeus changed the base branch from 1.12.x to master January 8, 2020 10:08
@alcaeus alcaeus added this to the 2.1.0 milestone Jan 8, 2020
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've moved this to master (2.1.x-dev) as SemVer requires the new interface to be introduced in a new minor release.

@alcaeus alcaeus merged commit 54b64c9 into doctrine:master Jan 9, 2020
@alcaeus
Copy link
Member

alcaeus commented Jan 9, 2020

Thanks @lyrixx! 🎉

@alcaeus alcaeus self-assigned this Jan 9, 2020
@lyrixx lyrixx deleted the autoconfigure branch January 9, 2020 11:24
@rvanlaak
Copy link

rvanlaak commented Jan 9, 2020

Brilliant in its simplicity! 👏

Would it be possible to on userland let DI alias the old interface for the new one, so without making code changes to PHP this autowiring could get used (read: tested) on our application?

@lyrixx
Copy link
Contributor Author

lyrixx commented Jan 9, 2020

@rvanlaak thanks.

If you are using only the ORM (and not the ORM) (see explaination here you can do that:

services:
    _instanceof:
        Doctrine\Common\EventSubscriber:
            tags: [ doctrine.event_subscriber ]

@rvanlaak
Copy link

rvanlaak commented Jan 9, 2020

Had that one in mind, which probably is sufficient. Was more thinking of something conceptual like:

Doctrine\Common\EventSubscriber:
    alias: Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface 

This in order to gain advantage of all functionality the doctrine bundle in the possible future would add via DI (e.g. tags, compiler passes) based on EventSubscriberInterface.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Aug 9, 2021
This PR was merged into the 4.4 branch.

Discussion
----------

[Doctrine] Document EventSubscriberInterface

`Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface` was introduced in doctrine/DoctrineBundle#1119

Fixes #15234

Commits
-------

e8b3b04 Add note about EventSubscriberInterface introduced in DoctrineBundle 2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autoconfiguration for event subscribers
6 participants