/** * Called on successful routing of a service call * Prepares the service to a request to be rendered * * @return boolean $result - if false then fail fast no call to runCallMethod() should be made. */ public function setupRequest() { // Make sure we have a route matched (this should caught and an exception thrown on Manager::determineRoute()) if (!$this->matched_route instanceof RouteMetaData) { return false; } // If its a GET request and no expose fields are present, fail early $expose = $this->matched_route->getExpose(); if ($this->getRequest()->getHttpMethod() == Request::METHOD_GET && (empty($expose) || sizeof($expose) == 1 && empty($expose[0]))) { $this->renderDeterminedRepresentation($this->getActionInstance()->createResultSet(array())); return false; } return true; }
/** * Called on successful routing of a service call * Prepares the service to a request to be rendered * * @return boolean $result - if false then fail fast no call to runCallMethod() should be made. */ protected function setupRequest() { // Make sure we have a route matched (this should caught and an exception thrown on Manager::determineRoute()) if (!$this->matched_route instanceof RouteMetaData) { return false; } // Proceed to run the service action if ($this->matched_route->isExposeDisabled()) { return true; } // If its a GET request and no expose fields are present, fail early if ($this->getRequest()->getHttpMethod() == Request::METHOD_GET) { $expose = $this->matched_route->getExpose(); if (count($expose) === 0 || count($expose) == 1 && empty($expose[0])) { $this->renderDeterminedRepresentation($this->getActionInstance()->createResultSet(array())); return false; } } return true; }
/** * Create an instance of ExposeFields - use create() method * @param RouteMetaData $route - requires a matched route */ private function __construct(RouteMetaData $route) { $this->route = $route; $this->route_expose = $route->getExpose(); }