From c8bab1218f04e58f3eb20c19ef9a4e61e9f6c88c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 5 Jun 2023 10:01:35 +0200 Subject: [PATCH] FIX [filiation][validator] adjust validation condition --- .../Relationship/RelationshipNoDuplicateValidator.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php index b44a966cc..5b1038287 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php @@ -47,10 +47,12 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator foreach ($relationships as $r) { if (spl_object_hash($r) !== spl_object_hash($value) - and $r->getFromPerson() === $fromPerson - || $r->getFromPerson() === $toPerson - || $r->getToPerson() === $fromPerson - || $r->getToPerson() === $toPerson + and + ( + ($r->getFromPerson() === $fromPerson and $r->getToPerson() === $toPerson) + || + ($r->getFromPerson() === $toPerson and $r->getToPerson() === $fromPerson) + ) ) { $this->context->buildViolation($constraint->message) ->addViolation();