Closed
Description
Hy,
It's possible to execute un forward from init function in controller ?
my example :
class RestController extends Controller
{
private $action;
private $controller;
/**
* Init for each action
*/
public function init()
{
// disable render for all action
Yaf\Dispatcher::getInstance()->disableView();
// check existing controller
$controllerAllow = array('repository');
$this->controller = $this->getRequest()->getActionName();
if (!in_array($this->controller, $controllerAllow))
Response::sendJsonException(EvaluationError::$codes[1120]);
// check method used
$methodAllow = array('GET', 'POST', 'PUT', 'DELETE');
$this->action = in_array($this->getRequest()->getMethod(), $methodAllow) ? strtolower($this->getRequest()->getMethod()) : 'get';
// redirect according to method
// $this->forward(strtolower($this->getModuleName()), $controller, $action);
}
}
error 500 with no log if I remove comment this line
// $this->forward(strtolower($this->getModuleName()), $controller, $action);
Thx
Metadata
Assignees
Labels
No labels