-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for member types before hydration
- Loading branch information
1 parent
08388a7
commit 4957da5
Showing
12 changed files
with
149 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace WoohooLabs\Yin\JsonApi\Exception; | ||
|
||
use WoohooLabs\Yin\JsonApi\Schema\Error; | ||
use WoohooLabs\Yin\JsonApi\Schema\ErrorSource; | ||
|
||
class ResourceIdentifierIdInvalid extends JsonApiException | ||
{ | ||
/** | ||
* @var mixed | ||
*/ | ||
protected $id; | ||
|
||
public function __construct($id) | ||
{ | ||
parent::__construct("The resource ID '$id' must be a string!"); | ||
$this->id = $id; | ||
} | ||
|
||
protected function getErrors(): array | ||
{ | ||
return [ | ||
Error::create() | ||
->setStatus("400") | ||
->setCode("RESOURCE_IDENTIFIER_ID_INVALID") | ||
->setTitle("Resource identifier ID is invalid") | ||
->setDetail("The resource ID '$this->id' must be a string!") | ||
]; | ||
} | ||
|
||
public function getId(): string | ||
{ | ||
return $this->id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace WoohooLabs\Yin\JsonApi\Exception; | ||
|
||
use WoohooLabs\Yin\JsonApi\Schema\Error; | ||
use WoohooLabs\Yin\JsonApi\Schema\ErrorSource; | ||
|
||
class ResourceIdentifierTypeInvalid extends JsonApiException | ||
{ | ||
/** | ||
* @var mixed | ||
*/ | ||
protected $type; | ||
|
||
public function __construct($type) | ||
{ | ||
parent::__construct("The resource type '$type' must be a string!"); | ||
$this->type = $type; | ||
} | ||
|
||
protected function getErrors(): array | ||
{ | ||
return [ | ||
Error::create() | ||
->setStatus("400") | ||
->setCode("RESOURCE_IDENTIFIER_TYPE_INVALID") | ||
->setTitle("Resource identifier type is invalid") | ||
->setDetail("The resource type '$this->type' must be a string!") | ||
]; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters