We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36bccbb commit 9f973daCopy full SHA for 9f973da
src/Error/Exception/JsonApiException.php
@@ -9,9 +9,16 @@ class JsonApiException extends BadRequestException
9
{
10
protected $requestErrors;
11
12
- public function __construct(EntityInterface $entity, $message = null, $code = 400)
+ public function __construct(EntityInterface|array $entity, $message = null, $code = 400)
13
14
- $this->requestErrors = $entity->getErrors();
+ if (is_array($entity)) {
15
+ foreach ($entity as $ent) {
16
+ $this->requestErrors[] = $ent->getErrors();
17
+ }
18
19
+ if (!is_array($entity)) {
20
+ $this->requestErrors = $entity->getErrors();
21
22
23
if ($message === null) {
24
$message = 'Bad Request';
0 commit comments