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 commented Jan 6, 2020

fixes #674

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

@lyrixx lyrixx force-pushed the lyrixx:autoconfigure branch from ef9a99e to 65e4a3d Jan 6, 2020
@lyrixx lyrixx force-pushed the lyrixx:autoconfigure branch from 65e4a3d to 9d2932a Jan 6, 2020
@lyrixx lyrixx changed the title Added ServiceEventSubscriber marker interface to support autoconfiguration Added EventSubscriberInterface marker interface to support autoconfiguration Jan 6, 2020
@ostrolucky

This comment has been minimized.

Copy link
Contributor

ostrolucky commented Jan 6, 2020

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

@lyrixx

This comment has been minimized.

Copy link
Contributor Author

lyrixx commented Jan 6, 2020

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

@lyrixx lyrixx force-pushed the lyrixx:autoconfigure branch from 9d2932a to 581a442 Jan 8, 2020
@alcaeus alcaeus changed the base branch from 1.12.x to master Jan 8, 2020
@alcaeus alcaeus added this to the 2.1.0 milestone Jan 8, 2020
@alcaeus alcaeus added this to 2.1 in Roadmap Jan 8, 2020
@alcaeus alcaeus added the Improvement label Jan 8, 2020
@alcaeus
alcaeus approved these changes Jan 8, 2020
Copy link
Member

alcaeus left a comment

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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@alcaeus

This comment has been minimized.

Copy link
Member

alcaeus commented Jan 9, 2020

Thanks @lyrixx! 🎉

@alcaeus alcaeus self-assigned this Jan 9, 2020
@lyrixx lyrixx deleted the lyrixx:autoconfigure branch Jan 9, 2020
@rvanlaak

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.