We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to check an action is forwared from another?

Example: in Controller Session/add_new_product I have a forward:

return $this->dispatcher->forward(array( 'controller' => 'session', 'action' => 'login' ));

then in SessionController/login, how can I check request is forwarded from add_new_product or directly from browser? (or I must add some params like a flag variable to check?)

Thanks



7.5k
Accepted
answer

Docs said: (https://docs.phalcon.io/en/latest/api/Phalcon_Dispatcher.html)

Dispatcher

public boolean wasForwarded()
Check if the current executed action was forwarded by another one


43.9k
edited Mar '14

Hi, you can use Phalcons Request facility. Especially getHTTPReferer () function



5.3k
edited Mar '14

Hi Tomasz Ślązok, it's great, thank you very much, and thank le51 too