コード例 #1
0
 /**
  * @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);
 }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #4
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);
 }
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
ファイル: Compose.php プロジェクト: raven7/Restler
 /**
  * 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;
 }
コード例 #7
0
 /**
  * @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;
 }
コード例 #8
0
 /**
  * Constructor
  * 
  * @param int $id
  */
 public function __construct($id)
 {
     parent::__construct('survey_not_found', 404, array('id' => $id));
 }
コード例 #9
0
ファイル: RestRequest.php プロジェクト: as3io/modlr
 /**
  * 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;
 }
コード例 #10
0
 /**
  * Constructor
  * 
  * @param Survey $survey
  */
 public function __construct($survey)
 {
     parent::__construct('vote_already_exists', 403, array('survey_id' => $survey->id));
 }
コード例 #11
0
 /**
  * @param array $errors
  * @param int $code
  */
 public function __construct(array $errors, $code = 422)
 {
     $this->errors = $errors;
     parent::__construct(json_encode($errors), $code, null);
 }
コード例 #12
0
ファイル: NoInputException.php プロジェクト: alebon/graviton
 /**
  * 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);
 }
コード例 #13
0
 public function __construct($controller, $name)
 {
     parent::__construct(sprintf('Missing parameter %s in %s', $name, $controller), 0);
     $this->controller = $controller;
     $this->name = $name;
 }
コード例 #14
0
 /**
  * Constructor
  * 
  * @param string $name name of the bad parameter
  */
 public function __construct($name)
 {
     parent::__construct('rest_bad_parameter', 400, $name);
 }
コード例 #15
0
ファイル: InvalidHashException.php プロジェクト: sulu/sulu
 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);
 }
コード例 #16
0
 /**
  * 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);
 }
コード例 #17
0
 /**
  * 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;
 }
コード例 #18
0
 /**
  * Constructor
  * 
  * @param string $updated_since
  */
 public function __construct($updated_since)
 {
     parent::__construct('rest_updatedsince_bad_format', 400, array('updatedSince' => $updated_since));
 }
コード例 #19
0
 /**
  * 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);
 }
コード例 #20
0
 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;
 }
コード例 #21
0
 /**
  * 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);
 }
コード例 #22
0
 /**
  * @param string $message
  * @param int $code
  */
 public function __construct($message, $code = 401)
 {
     parent::__construct($message, $code, null);
 }
コード例 #23
0
 /**
  * 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);
 }
コード例 #24
0
 public function __construct($verb, $url, ValidationResults $validationResults)
 {
     parent::__construct($validationResults->__toString(), $verb, $url);
     $this->validationResults = $validationResults;
 }
コード例 #25
0
 /**
  * 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);
 }