Skip to content

[FrameworkBundle] make RegisterKernelListenersPass reusable #6643

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

Closed
wants to merge 1 commit into from
Closed

[FrameworkBundle] make RegisterKernelListenersPass reusable #6643

wants to merge 1 commit into from

Conversation

alexandresalome
Copy link

Bug fix: no
Feature addition: kinda
Backwards compatibility break: no

When I create a new event dispatcher for my applications, I would appreciate this code to be reusable.

@stof
Copy link
Member

stof commented Jan 9, 2013

@alexandresalome quick question: why creating another dispatcher ?

@alexandresalome
Copy link
Author

Sometimes you need to create a new dispatcher, out of Symfony kernel: Behat could be a good example.

Also in applications (like gitonomy) I tend to separate business events from kernel events. I do this for separation of concerns.

@@ -14,17 +14,47 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
* Compiler pass to register tagged services for an event dispatcher.
*/
class RegisterKernelListenersPass implements CompilerPassInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

then the class name isn't appropriate anymore

Copy link
Author

Choose a reason for hiding this comment

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

See the last message in PR. It can be moved to two locations (HttpKernel or EventDispatcher).

@bamarni
Copy link
Contributor

bamarni commented Jan 21, 2013

👍 I usually duplicate this file for my application events.

@alexandresalome
Copy link
Author

Regarding the question "should we create a new event dispatcher in our applications", the answer is clearly yes or no.

That being said, whatever this usage is correct or not, we still need this class for other cases.

An example: you want to create an application with a service container. Extensions in this application register services in your container. You want to allow registration on a dispatcher with tags on extension's services.

See the case?

Regarding the class, I think it should be moved to Symfony/Component/HttpKernel/DependencyInjection or Symfony/Component/EventDispatcher/DependencyInjection.

Waiting for advices,
Alexandre

@fabpot
Copy link
Member

fabpot commented Mar 25, 2013

Looks good to me. I think putting it in HttpKernel is slightly better.

@fabpot
Copy link
Member

fabpot commented Apr 25, 2013

I've finished this PR at #7848

@fabpot fabpot closed this Apr 25, 2013
fabpot added a commit to fabpot/symfony that referenced this pull request Apr 25, 2013
fabpot added a commit that referenced this pull request Apr 25, 2013
This PR was merged into the master branch.

Discussion
----------

[FrameworkBundle] make RegisterKernelListenersPass reusable

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6643
| License       | MIT
| Doc PR        | n/a

see #6643

Commits
-------

5047227 moved the kernel listener compiler pass to HttpKernel to make it reusable (refs #6643)
45f1a16 make RegisterKernelListenersPass reusable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants