/**
  * @return \WoohooLabs\Yin\JsonApi\Schema\Error
  */
 protected function getDispatchError()
 {
     $error = new Error();
     $error->setStatus(404);
     $error->setTitle("Resource was not not found!");
     return $error;
 }
Ejemplo n.º 2
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     $errors = [];
     foreach ($this->validationErrors as $validationError) {
         $error = Error::create()->setStatus(400)->setCode("REQUEST_BODY_INVALID_JSON_API")->setTitle("Request body is an invalid JSON API document")->setDetail(ucfirst($validationError["message"]));
         if ($validationError["property"]) {
             $error->setSource(ErrorSource::fromPointer($validationError["property"]));
         }
         $errors[] = $error;
     }
     return $errors;
 }
Ejemplo n.º 3
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RELATIONSHIP_NOT_EXISTS")->setTitle("The requested relationship does not exist!")->setDetail($this->getMessage())];
 }
Ejemplo n.º 4
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(500)->setCode("RESPONSE_BODY_INVALID_JSON")->setTitle("Response body is an invalid JSON document")->setDetail($this->getMessage())];
 }
Ejemplo n.º 5
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(403)->setCode("FULL_REPLACEMENT_PROHIBITED")->setTitle("Full replacement is prohibited")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/relationships/{$this->relationshipName}"))];
 }
Ejemplo n.º 6
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("APPLICATION_ERROR")->setTitle("Application error")->setDetail("An application error has occurred!")];
 }
Ejemplo n.º 7
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(406)->setCode("MEDIA_TYPE_UNACCEPTABLE")->setTitle("The provided media type is unacceptable")->setDetail($this->getMessage())->setSource(ErrorSource::fromParameter("Accept"))];
 }
Ejemplo n.º 8
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(403)->setCode("REMOVAL_PROHIBITED")->setTitle("Removal is prohibited")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/relationships/{$this->relationshipName}"))];
 }
Ejemplo n.º 9
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RESOURCE_IDENTIFIER_ID_MISSING")->setTitle("An ID for the resource identifier is missing")->setDetail("An ID for the resource identifier must be included!")];
 }
Ejemplo n.º 10
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("INCLUSION_UNRECOGNIZED")->setTitle("Inclusion is unrecognized")->setDetail("Included paths '" . implode(", ", $this->unrecognizedIncludes) . "' can't be recognized by the endpoint!")->setSource(ErrorSource::fromParameter("include"))];
 }
Ejemplo n.º 11
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("INCLUSION_UNSUPPORTED")->setTitle("Inclusion is unsupported")->setDetail("Inclusion is not supported by the endpoint!")->setSource(ErrorSource::fromParameter("include"))];
 }
Ejemplo n.º 12
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(403)->setCode("CLIENT_GENERATED_ID_REQUIRED")->setTitle("Required client generated ID")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/id"))];
 }
Ejemplo n.º 13
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("SORTING_UNSUPPORTED")->setTitle("Sorting is unsupported")->setDetail("Sorting is not supported by the endpoint!")->setSource(ErrorSource::fromParameter("sort"))];
 }
Ejemplo n.º 14
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RESOURCE_ID_INVALID")->setTitle("Resource ID is invalid")->setDetail("The resource ID '{$this->id}' is invalid!")->setSource(ErrorSource::fromPointer("/data/id"))];
 }
Ejemplo n.º 15
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("SORTING_UNRECOGNIZED")->setTitle("Sorting paramter is unrecognized")->setDetail("Sorting parameter '{$this->sortParam}' can't be recognized by the endpoint!")->setSource(ErrorSource::fromParameter("sort"))];
 }
Ejemplo n.º 16
0
 /**
  * @inheritDoc
  */
 public function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RESOURCE_TYPE_UNACCEPTABLE")->setTitle("Resource type is unacceptable")->setDetail("Resource type '{$this->currentType}' is unacceptable!")->setSource(ErrorSource::fromPointer("/data/type"))];
 }
Ejemplo n.º 17
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(403)->setCode("CLIENT_GENERATED_ID_NOT_SUPPORTED")->setTitle("Client generated ID is not supported")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/id"))];
 }
Ejemplo n.º 18
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RESOURCE_NOT_FOUND")->setTitle("Resource not found")->setDetail($this->getMessage())];
 }
Ejemplo n.º 19
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RESOURCE_TYPE_MISSING")->setTitle("Resource type is missing")->setDetail("A resource type must be included in the document!")->setSource(ErrorSource::fromPointer("/data"))];
 }
Ejemplo n.º 20
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("QUERY_PARAM_UNRECOGNIZED")->setTitle("Query parameter is unrecognized")->setDetail("Query parameter '{$this->unrecognizedQueryParam}' can't be recognized by the endpoint!")->setSource(ErrorSource::fromParameter($this->unrecognizedQueryParam))];
 }
Ejemplo n.º 21
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("RELATIONSHIP_TYPE_INAPPROPRIATE")->setTitle("Relationship type is inappropriate")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/relationships/{$this->relationshipName}"))];
 }
Ejemplo n.º 22
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(409)->setCode("CLIENT_GENERATED_ID_ALREADY_EXISTS")->setTitle("Client generated ID already exists")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer("/data/id"))];
 }
Ejemplo n.º 23
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(415)->setCode("MEDIA_TYPE_UNSUPPORTED")->setTitle("The provided media type is unsupported")->setDetail($this->getMessage())->setSource(ErrorSource::fromParameter("Content-Type"))];
 }
Ejemplo n.º 24
0
 /**
  * @inheritDoc
  */
 protected function getErrors()
 {
     return [Error::create()->setStatus(400)->setCode("DATA_MEMBER_MISSING")->setTitle("Missing `data` member at the document's top level")->setDetail($this->getMessage())->setSource(ErrorSource::fromPointer(""))];
 }