Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to check an action is forwared from another?

Example: in Controller Session/addnewproduct 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 addnewproduct or directly from browser? (or I must add some params like a flag variable to check?)

Thanks



5.5k
Accepted
answer

Docs said: (http://docs.phalconphp.com/en/latest/api/Phalcon%5Dispatcher.html)

Dispatcher

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


30.7k
edited Mar '14

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



3.6k
edited Mar '14

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