diff --git a/src/Entity/Bug.php b/src/Entity/Bug.php index 68dd93df..6da66f2c 100644 --- a/src/Entity/Bug.php +++ b/src/Entity/Bug.php @@ -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; diff --git a/src/Validator/Constraints/PathValidator.php b/src/Validator/Constraints/PathValidator.php index 78667a6f..30b8f085 100644 --- a/src/Validator/Constraints/PathValidator.php +++ b/src/Validator/Constraints/PathValidator.php @@ -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) {