Skip to content

forward from init controller #163

Closed
Closed
@famonsei

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions