Skip to content

Commit

Permalink
Merge pull request #183 from tienvx/update-path-validation
Browse files Browse the repository at this point in the history
Update path validation
  • Loading branch information
tienvx committed Mar 11, 2019
2 parents c80770a + 4e5b6e2 commit 2cd662b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Entity/Bug.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class Bug
private $status = 'new';

/**
* @ORM\Column(type="json_document", options={"jsonb": true}, nullable=true)
* @ORM\Column(type="json_document", options={"jsonb": true})
* @Assert\NotNull
* @MbtAssert\Path
*/
private $path;
Expand Down
8 changes: 4 additions & 4 deletions src/Validator/Constraints/PathValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public function validate($value, Constraint $constraint)
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Path');
}

if (empty($value)) {
return;
}

if (!is_array($value)) {
throw new UnexpectedTypeException($value, 'array');
}

if (empty($value)) {
return;
}

try {
GraphPath::unserialize($value);
} catch (Exception $exception) {
Expand Down

0 comments on commit 2cd662b

Please sign in to comment.