Herr Nentu'
Herr Nentu'

Reputation: 1506

Symfony controller action execution before listener

Is it possible to have a controller action executed before a listener?

I need to trigger a database change on an action call before a listener checks if this change exists. Can this be set up or even possible in symfony 2/3?

The structure of actions should be like this:

  1. ControllerAction saves to database and returns a response
  2. Listener checks against the database and execute or redirect based on the end result from the DB

Now the Listener is having priority and I don't know if this is possible to be changed.

Upvotes: 0

Views: 660

Answers (1)

Ziumin
Ziumin

Reputation: 4860

Check kernel.response event and modify Response if needed. http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-response-event

Upvotes: 2

Related Questions