Skip to content

first draft cookbook before/after listeners (issue #649) #1461

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

Merged
merged 3 commits into from
Jun 25, 2012

Conversation

ricardclau
Copy link
Contributor

First draft for a cookbook on creating a before listener.
I'd like to receive your comments and once everything is ok, write an example also for an after listeners

This pull request is refered to issue #649: [Cookbook] Idea of article: "How to create before and after filters"

So, waiting for your comments! (And sorry for the delay on doing this)


In Symfony1, this was achieved with the preExecute and postExecute methods, most major frameworks have similar
methods but there is no such thing in Symfony2. Good news is that there is a much better way to interfere our
Request -> Response process with the EventListener component.
Copy link
Member

Choose a reason for hiding this comment

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

the component is named EventDispatcher

@ricardclau
Copy link
Contributor Author

Fixed and added config via xml and php :)

@ricardclau
Copy link
Contributor Author

@weaverryan When you have got some spare time (if any ;)), could you please also review this first draft? Can I start working on a second part about a "before" listener?

/**
* $controller passed can be either a class or a Closure. This is not usual in Symfony2 but it may happen.
* If it is a class, it comes in array format
*/
Copy link
Member

Choose a reason for hiding this comment

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

Put this comment in a normal PHP comment (/* ... */ or // ...) but not in a PHPdoc comment (/** ... */).

@ricardclau
Copy link
Contributor Author

Good catches! I'll update my PR, thanks @wouterj

weaverryan added a commit that referenced this pull request Jun 25, 2012
first draft cookbook before/after listeners (issue #649)
@weaverryan weaverryan merged commit 38949cd into symfony:2.0 Jun 25, 2012
weaverryan added a commit that referenced this pull request Jun 25, 2012
* Shortened many lines slightly so that they break after the first word that crosses the 72nd character
* Corrected the underlines used for the headers
* Adding the map and index entries for the new cookbook
@weaverryan
Copy link
Member

Hi Ricard!

This is really great - nice work! I've made some tweaks and identified their nature in sha: 4e85d2b. The changes were really very minor - the biggest thing is to make your lines a little bit shorter.

Now you can get started on the after filter - Sorry for the delay on my end :)

Thanks!

@ricardclau
Copy link
Contributor Author

Hi Ryan!

No problem on that, you're a busy man :). Besides that, @stof and @wouterj already reviewed the doc so it was already better than my first draft.

Just to avoid that you have to check it again, which is the max line length for this files?

@stof
Copy link
Member

stof commented Jun 25, 2012

@ricardclau wrapping after the first word crossing 72 chars

@ricardclau
Copy link
Contributor Author

Ok, thx @stof!

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.

None yet

4 participants