/** * Before dispatching, digest PUT request body and set params * * @param IfwPsn_Vendor_Zend_Controller_Request_Abstract $request */ public function preDispatch(IfwPsn_Vendor_Zend_Controller_Request_Abstract $request) { if (!$request instanceof IfwPsn_Vendor_Zend_Controller_Request_Http) { return; } if ($this->_request->isPut()) { $putParams = array(); parse_str($this->_request->getRawBody(), $putParams); $request->setParams($putParams); } }
/** * Retrieve rendered contents of a controller action * * If the action results in a forward or redirect, returns empty string. * * @param string $action * @param string $controller * @param string $module Defaults to default module * @param array $params * @return string */ public function action($action, $controller, $module = null, array $params = array()) { $this->resetObjects(); if (null === $module) { $module = $this->defaultModule; } // clone the view object to prevent over-writing of view variables $viewRendererObj = IfwPsn_Vendor_Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); IfwPsn_Vendor_Zend_Controller_Action_HelperBroker::addHelper(clone $viewRendererObj); $this->request->setParams($params)->setModuleName($module)->setControllerName($controller)->setActionName($action)->setDispatched(true); $this->dispatcher->dispatch($this->request, $this->response); // reset the viewRenderer object to it's original state IfwPsn_Vendor_Zend_Controller_Action_HelperBroker::addHelper($viewRendererObj); if (!$this->request->isDispatched() || $this->response->isRedirect()) { // forwards and redirects render nothing return ''; } $return = $this->response->getBody(); $this->resetObjects(); return $return; }