-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added "How to create an event subscriber" #4538
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
Conversation
I've added the information about how to create an event subscriber to the "How to create an Event listener" cookbook recipe.
@@ -1,18 +1,24 @@ | |||
.. index:: | |||
single: Events; Create listener | |||
single: Events; Create listener, Create subscriber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? I think you will have so split this into two indexes:
.. index::
single: Events; Create listener
single: Events; Create subscriber
I've fixed my previous error in the definition of an index entry.
Creating an Event Listener | ||
-------------------------- | ||
|
||
The most common way to listen to an event is to register an event listener: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has to be a double colon (::
) in order to enable highlighting for the following code block
Thank you for starting this! We have some detailed documentation about this in the components section, could you please reference that from this article. Some like: 'To learn more about event subscribers, see ...' |
a service that will act as an event listener on that event. In this entry, | ||
you will create a service that will act as an Exception Listener, allowing | ||
a service that will act as an event listener on that event. You can do that in two different ways, | ||
creating an Event Listener or an Event Subscriber instead. In this entry, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you use "Event Listener" and "Event Subscriber", but in the rest of the article it's "event listener" and "event subscriber". Is there any reason for the capitalization of letters in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, there's no reason to do that, I'm going to fix it, thanks.
It seems like my pull request has been forgotten :/ |
you will create a service that will act as an Exception Listener, allowing | ||
a service that will act as an event listener on that event. You can do that in two different ways, | ||
creating an event listener or an event subscriber instead. In this entry, | ||
you will see the two ways of creating a service that will act as an exception listener, allowing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please wrap lines after the first word that crosses the 72nd character?
@beni0888 Thank you for working on this. Unfortunately, we don't receive notifications when someone pushes new commits on a pull request. Just leave us a message when you add commits next time. :) |
ping @beni0888 Can you please update this PR? (If you have no time to do it, feel free to say that too, we'll then finish this PR) |
@wouterj yes, I'm sorry I've been quite bussy... I'll try to fix it today :) |
|
||
Symfony has various events and hooks that can be used to trigger custom | ||
behavior in your application. Those events are thrown by the HttpKernel | ||
component and can be viewed in the :class:`Symfony\\Component\\HttpKernel\\KernelEvents` class. | ||
|
||
To hook into an event and add your own custom logic, you have to create | ||
a service that will act as an event listener on that event. In this entry, | ||
you will create a service that will act as an Exception Listener, allowing | ||
a service that will act as an event listener on that event. You can do that in two different ways, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service that will listen to that event.
@wouterj I'm very sorry for not to fix the problems in this PR as I promised, but I've been really busy and I haven't been able to do it. However, I keep this task in my mind and I will do it as soon as possible. Sorry. |
@beni0888 there is no need to apologize at all! This is a volunteer work and we understand that sometimes we face large workloads which prevents us from dedicating time to open source projects. Feel free to work on this when you can and, if you think you cannot finish it, please tell us and we'll overtake this pull request. Thanks. |
@beni0888 this saturday, we'll be hosting a doc sprint day. Would you like to finish this PR yourself (maybe during the day?) or should we put it on a list so others can finish it? |
@wouterj I think I won't be able to work on this PR this saturday and It's opened for too long, so it would be nice if you put it on the list :) |
@javiereguiluz Thanks and sorry for not finish it myself |
@beni0888 no worries! Starting things is always the most important part. Your PR "forced" us to write this cookbook ... and that's great! Thanks. |
…888, javiereguiluz) This PR was merged into the 2.3 branch. Discussion ---------- Added a cookbook section about event subscribers | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | - This PR finishes the work made by @beni0888 in #4538. Commits ------- b5a82ca Final changes ba9ec6b Reworded the introduction and other minor fixes 483f029 Added a note about the advantages/drawbacks of listeners/subscribers e56fed8 Fixed minor issues c8c8bf8 Reworded the subscriber introduction 36b1d10 Fixed the name of the services file a444951 Implemented the suggestions made by @xabbuh 9a6dab7 Completed the cookbook about the event subscriber 0184e0f Added a note about the priority meaning in event subscribers
I've added the information about how to create an event subscriber to the "How to create an Event listener" cookbook recipe. I think that there isn't a recipe in the cookbook about that and it can be useful.