/** * @param string $entity The type of the entity, which was not found * @param string $argument The argument of the entity, which was not passed */ public function __construct($entity, $argument) { $this->entity = $entity; $this->argument = $argument; $message = 'The "' . $entity . '"-entity requires a "' . $argument . '"-argument'; parent::__construct($message, 0); }
/** * @param string $entity The type of the entity, which was not found * @param int $id The id of the entity, which was not found */ public function __construct($entity, $id) { $this->entity = $entity; $this->id = $id; $message = 'Entity with the type "' . $entity . '" and the id "' . $id . '" not found.'; parent::__construct($message, 0); }
/** * @param string $entity The type of the entity, which was not found * @param int $id The id of the entity, which was not found */ public function __construct($entity, $id) { $this->entity = $entity; $this->id = $id; $message = 'The id-field of the "' . $entity . '"-Entity already has an id with the value "' . $id . '" .'; parent::__construct($message, 0); }
/** * @param string $field */ public function __construct($field, $entity, $type, $code) { $this->field = $field; $this->entity = $entity; $this->type = $type; parent::__construct(sprintf('%s constraint for field "%s" of entity "%s" violated', ucfirst($type), $field, $entity), $code); }
/** * @param string $entity The type of the entity * @param string $argument The argument of the entity, which was invalid * @param null $customMessage */ public function __construct($entity, $argument, $customMessage = null) { $this->entity = $entity; $this->argument = $argument; $message = 'The "' . $entity . '"-entity requires a valid "' . $argument . '"-argument. '; if ($customMessage != null) { $message .= $customMessage; } parent::__construct($message, 0); }
/** * When the api call results in RestException this method * will be called to return the error message * * @param RestException $exception exception that has reasons for failure * * @return array */ public function message(RestException $exception) { //TODO: check Defaults::language and change result accordingly $r = array('error' => array('code' => $exception->getCode(), 'message' => $exception->getErrorMessage()) + $exception->getDetails()); if (!Scope::get('Restler')->getProductionMode() && self::$includeDebugInfo) { $r += array('debug' => array('source' => $exception->getSource(), 'stages' => $exception->getStages())); } return $r; }
/** * @param string $controller * @param string[] $names */ public function __construct($controller, $names) { parent::__construct(sprintf('Missing parameter "%s" in %s', implode('" or "', $names), $controller), 0); $this->controller = $controller; $this->names = $names; }
/** * Constructor * * @param int $id */ public function __construct($id) { parent::__construct('survey_not_found', 404, array('id' => $id)); }
/** * Extracts filtering criteria from an array of query params. * * @param array $params * @return self */ private function extractFilters(array $params) { if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) { return $this; } $filters = $params[self::PARAM_FILTERING]; if (!is_array($filters)) { throw RestException::invalidQueryParam(self::PARAM_FILTERING, 'The filter parameter must be an array keyed by filter name and value.'); } foreach ($filters as $key => $value) { $this->filters[$key] = $value; } return $this; }
/** * Constructor * * @param Survey $survey */ public function __construct($survey) { parent::__construct('vote_already_exists', 403, array('survey_id' => $survey->id)); }
/** * @param array $errors * @param int $code */ public function __construct(array $errors, $code = 422) { $this->errors = $errors; parent::__construct(json_encode($errors), $code, null); }
/** * Constructor * * @param string $message Error message * @param \Exception $prev Previous Exception */ public function __construct($message = "No Content", $prev = null) { parent::__construct(Response::HTTP_BAD_REQUEST, $message, $prev); }
public function __construct($controller, $name) { parent::__construct(sprintf('Missing parameter %s in %s', $name, $controller), 0); $this->controller = $controller; $this->name = $name; }
/** * Constructor * * @param string $name name of the bad parameter */ public function __construct($name) { parent::__construct('rest_bad_parameter', 400, $name); }
public function __construct($entity, $id) { parent::__construct(sprintf('The given hash for the entity of type "%s" with the id "%s" does not match the current hash.' . ' The entity has probably been edited in the mean time.', $entity, $id), 1102); }
/** * Constructor * * @param string $message Error message * @param \Exception $prev Previous Exception */ public function __construct($message = "x-dynamic-key ref-field could not be resolved", $prev = null) { parent::__construct(Response::HTTP_INTERNAL_SERVER_ERROR, $message, $prev); }
/** * Creates a new custom error * * @param [:var] details * @param lang.Throwable cause */ public function __construct($details, $cause = NULL) { parent::__construct($details['server.message'], $cause); $this->details = $details; }
/** * Constructor * * @param string $updated_since */ public function __construct($updated_since) { parent::__construct('rest_updatedsince_bad_format', 400, array('updatedSince' => $updated_since)); }
/** * Constructor * * @param string $message Error message * @param \Exception $prev Previous Exception */ public function __construct($message = "Record must not be modified", $prev = null) { parent::__construct(Response::HTTP_BAD_REQUEST, $message, $prev); }
public function __construct($controller, $name) { parent::__construct(sprintf('Parameter %s has wrong data type in %s', $name, $controller), 0); $this->controller = $controller; $this->name = $name; }
/** * Constructor * * @param FormErrorIterator $errors Errors from form * @param string $message Error message */ public function __construct(FormErrorIterator $errors, $message = 'Validation failed') { $this->errors = $errors; parent::__construct(Response::HTTP_BAD_REQUEST, $message); }
/** * @param string $message * @param int $code */ public function __construct($message, $code = 401) { parent::__construct($message, $code, null); }
/** * Constructor * * @param string $message Error message * @param \Exception $prev Previous Exception */ public function __construct($message = "Serialization Error", $prev = null) { parent::__construct(Response::HTTP_INTERNAL_SERVER_ERROR, $message, $prev); }
public function __construct($verb, $url, ValidationResults $validationResults) { parent::__construct($validationResults->__toString(), $verb, $url); $this->validationResults = $validationResults; }
/** * Constructor * * @param string $message Error message * @param \Exception $prev Previous Exception */ public function __construct($message = "Invalid JSON Patch", $prev = null) { parent::__construct(Response::HTTP_BAD_REQUEST, $message, $prev); }