コード例 #1
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;
 }
コード例 #2
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}"))];
 }
コード例 #3
0
ファイル: RemovalProhibited.php プロジェクト: garethwi/yin
 /**
  * @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}"))];
 }
コード例 #4
0
ファイル: ResourceTypeMissing.php プロジェクト: garethwi/yin
 /**
  * @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"))];
 }
コード例 #5
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"))];
 }
コード例 #6
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}"))];
 }
コード例 #7
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"))];
 }
コード例 #8
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"))];
 }
コード例 #9
0
ファイル: ResourceIdInvalid.php プロジェクト: garethwi/yin
 /**
  * @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"))];
 }
コード例 #10
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"))];
 }
コード例 #11
0
ファイル: DataMemberMissing.php プロジェクト: garethwi/yin
 /**
  * @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(""))];
 }