OK. So,

1. Add service

eg.
<service id="some.listener" class="Namespace\To\Your\Listener\Class
\YourListener">
            <tag name="kernel.listener" event="onCoreController" />
</service>

2. Create listener class

eg.

namespace Namespace\To\Your\Listener\Class;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;

class YourListener {

    /**
     *
     * pre execute emulation
     *
     * @param $event FilterControllerEvent
     * @return void
     */
    public function onCoreController(FilterControllerEvent $event) {
        if (HttpKernelInterface::MASTER_REQUEST === $event-
>getRequestType()) {
            $aController = $event->getController();
            if (isset($aController[0])) {
                $Controller = $aController[0];
                    $Controller->preExecute(); // also you should
check if method_exsist
            }
        }
    }

}


On 20 Kwi, 07:42, Dmitry Bykadorov <dmitry.bykado...@gmail.com> wrote:
> Can you provide any simple example? I have the same question )
>
> On Apr 19, 10:47 pm, Szymek <szewczyk.szy...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You should 
> > usehttp://symfony.com/doc/2.0/book/internals/kernel.html#oncorecontrolle...
>
> > On 17 Kwi, 21:04, kassel <alvaro.tou...@gmail.com> wrote:
>
> > > Hi All,
> > > At last i need not to repeat some methods in some diferents actions,
> > > and at las inyect data under the wiew?, like in SF 1.4 exists
> > > preExecute there is Something under SF2
>
> > > Thanks

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to