Mario Legenda
Mario Legenda

Reputation: 759

Symfony2 Sending RedirectResponse from Before Filter

I'm using Before Filter to detect what language is the application using (is it english or something else, for example) and then doing some stuff with it. After I've done that stuff, I would like to send a RedirectResponse to another Symfony route like this...

return new RedirectResponse(route_name)

but that doesn't work beacuse I'm not extending ContainerAware so the component that is getting the RedirectResponse object doesn't know what to do with it.

My question is, how to redirect from a before filter after I'm done with it?

Upvotes: 1

Views: 166

Answers (1)

szecsikecso
szecsikecso

Reputation: 301

Here are some question related answer: Symfony2 redirect for event listener? Elnur Abdurrakhimov's answer or NHG's anwer would be helpful for you.

Upvotes: 2

Related Questions