Is there a method like beforeAction
for Symfony 2 controllers? Also, is there a generic beforeAction
for the entire bundle/project?
No, unfortunately there isn't a preExecute
equivalent in symfony2, but instead you have access to a more powerful events model.
This article explains how to add a listener.
The event you want to listen to is onCoreController
Also see: http://symfony.com/doc/2.0/book/internals.html#the-event-dispatcher
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With