Hi,
I am a newbie to Zend framework, I want to know how can we restrict the call to predispatch() function in my controller for any particular action.
-DevD
Hi,
I am a newbie to Zend framework, I want to know how can we restrict the call to predispatch() function in my controller for any particular action.
-DevD
In your controller try
public function preDispatch()
{
if($this->getRequest()->getActionName() === 'actionName') {
return; // ignoring preDispatch
}
// run preDispatch code when not actionName
}
The preDispatch method is called before any controller Actions are called in the MVC Request Lifecyle. Thus, you cannot disable preDispatch from an individual action.
You can create a property inside your controller or a variable in the preDispatch method where you put in the action names (without the Action suffix) you want preDispatch to return from without doing anything. In the example code above, you wouldn't test against one action name but against the list of action names, probably with in_array.
See http://devzone.zend.com/article/11978-Zend-Framework-MVC-Request-Lifecycle