setRequest($request) ->setResponse($response); $this->_helper = new Helper\Broker($this); $this->init(); } /** * * function run when controller is initialized, can be overridden if functionality is needed to apply for * all actions */ public function init() { } /** * * return request object * * @return \Cube\Controller\Request\AbstractRequest */ public function getRequest() { return $this->_request; } /** * * set request object * * @param \Cube\Controller\Request\AbstractRequest $request * * @return \Cube\Controller\Action\AbstractAction */ public function setRequest(AbstractRequest $request) { $this->_request = $request; return $this; } /** * * get response object * * @return \Cube\Controller\Response\ResponseInterface */ public function getResponse() { return $this->_response; } /** * * set response object * * @param \Cube\Controller\Response\ResponseInterface $response * * @return \Cube\Controller\Action\AbstractAction */ public function setResponse(ResponseInterface $response) { $this->_response = $response; return $this; } /** * * forward to another action/controller/module * * used by the front controller dispatcher and initiates a dispatch loop * the pre-dispatch and post-dispatch plugins will be run on each loop * * @param string $action * @param string $controller * @param string $module * @param array|null $params */ final protected function _forward($action, $controller = null, $module = null, $params = null) { $request = $this->getRequest(); if ($controller !== null) { $request->setController($controller); } if ($module !== null) { $request->setModule($module); } if ($params !== null) { $request->setParams($params); } $request->setAction($action) ->setDispatched(false); } }