Skip to content

Deprecated ContainerAwareEventDispatcher #7372

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 5 commits into from

Conversation

javiereguiluz
Copy link
Member

This fixes #7340.

@xabbuh
Copy link
Member

xabbuh commented Jan 16, 2017

Instead of documenting the deprecation I would update the example to show code that will be working with Symfony 4.0 too.

@javiereguiluz
Copy link
Member Author

@xabbuh you mean the example in components/event_dispatcher.rst?

@xabbuh
Copy link
Member

xabbuh commented Jan 16, 2017

Yes, maybe move it to its own article and then also add a link in the existing chapter to it.

@javiereguiluz
Copy link
Member Author

I wonder ... why not remove that example entirely? It doesn't explain nothing special ... just how to define services with tags, right?

@xabbuh
Copy link
Member

xabbuh commented Jan 16, 2017

Fine for me too. I am just afraid that users with older Symfony versions might be confused (sure, in an ideal world they wouldn't read the 3.2 docs, but you know what's going on).

@javiereguiluz
Copy link
Member Author

I've checked other articles and I have a question.

In service_container/tags.rst we say that if you add this code, the Twig extension will be automatically registered:

$definition = new Definition(AppExtension::class);
$definition->setPublic(false);
$definition->addTag('twig.extension');
$container->setDefinition('app.twig_extension', $definition);

But that's not true, right? You need to add some special compiler pass to manage the twig.extension tag.

That's why the example in event_dispatcher.rst mentions the RegisterListenersPass().


So I propose the following:

  • Remove the event_dispatcher.rst example entirely
  • Improve service_container/tags.rst to better explain what you must do to enable the service tags

@xabbuh
Copy link
Member

xabbuh commented Jan 16, 2017

Well, service_container/tags.rst addresses users of the full-stack framework so we can safely assume that the compiler pass is registered. The event_dispatcher.rst however is located in the components section where we cannot make this assumption.

Registering service definitions and tagging them with the ``kernel.event_listener``
and ``kernel.event_subscriber`` tags is not enough to enable the event listeners
and event subscribers. You must also register the ``RegisterListenersPass()``
compiler pass in the container builder::
Copy link
Member

Choose a reason for hiding this comment

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

I would remove the "compiler pass" part here. This reads a bit weird.

Registering service definitions and tagging them with the
``kernel.event_listener`` and ``kernel.event_subscriber`` tags is not enough
to enable the event listeners and event subscribers. You must also register
in the container builder a compiler pass called ``RegisterListenersPass()``::
Copy link
Member

Choose a reason for hiding this comment

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

You must also register a compiler pass call RegisterListenersPass in the container builder

@xabbuh
Copy link
Member

xabbuh commented Jan 17, 2017

👍

Status: Reviewed

@xabbuh
Copy link
Member

xabbuh commented Jan 31, 2017

Thank you @javiereguiluz.

@xabbuh xabbuh closed this in 52e558d Jan 31, 2017
@javiereguiluz javiereguiluz deleted the fix_7340 branch May 24, 2018 16:05
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.

ContainerAwareEventDispatcher has been deprecated
3 participants