Skip to content

Commit c68eb35

Browse files
committed
Rules validator recursively converts object to array for validation.
Fixes #3
1 parent 1460e52 commit c68eb35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Validator/Attributes/RulesValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace CloudCreativity\JsonApi\Validator\Attributes;
2020

2121
use CloudCreativity\JsonApi\Contracts\Error\ErrorObjectInterface;
22+
use CloudCreativity\JsonApi\Object\ObjectUtils;
2223
use CloudCreativity\JsonApi\Validator\AbstractValidator;
2324
use CloudCreativity\JsonApi\Validator\Helper\RequiredTrait;
2425
use Illuminate\Contracts\Support\MessageBag;
@@ -146,7 +147,7 @@ protected function validate($value)
146147
return;
147148
}
148149

149-
$validator = $this->make(get_object_vars($value));
150+
$validator = $this->make(ObjectUtils::toArray($value));
150151

151152
if ($validator->fails()) {
152153
$this->error(static::ERROR_VALIDATION_FAILED);

0 commit comments

Comments
 (0)