xil3
xil3

Reputation: 16439

How to create a pre-dispatch in symfony, which gets called before any module/action?

As the title says, I'm basically trying to create a pre-dispatch, similar to how it works in Zend, but I need it done in Symfony.

For example - if someone navigates to a certain module/action, it would run my pre-dispatch first before doing that, and do the same for any module/action.

Would I need to create a plugin for this? Or is this something that I can setup some other way. Unfortunately I didn't find much information about it in the official documentation, so I thought I'd ask on here.

Upvotes: 1

Views: 1642

Answers (2)

haynar
haynar

Reputation: 6030

In Symfony2 you should do something like this, because the preExecute method is not available there: How to create a something like Zend preDispatch method in Symfony2

Upvotes: 3

greg0ire
greg0ire

Reputation: 23255

you can use a filter. I didn't find any documentation for this in sf 1.4 documentation, all there is is a documentation regarding the filters.yml file. Anyway, it works with sf1.4, no problem.

Upvotes: 3

Related Questions