FIX [filiation][validator] adjust validation condition

This commit is contained in:
Julie Lenaerts 2023-06-05 10:01:35 +02:00
parent 72f5b0b275
commit c8bab1218f

View File

@ -47,10 +47,12 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
foreach ($relationships as $r) { foreach ($relationships as $r) {
if (spl_object_hash($r) !== spl_object_hash($value) if (spl_object_hash($r) !== spl_object_hash($value)
and $r->getFromPerson() === $fromPerson and
|| $r->getFromPerson() === $toPerson (
|| $r->getToPerson() === $fromPerson ($r->getFromPerson() === $fromPerson and $r->getToPerson() === $toPerson)
|| $r->getToPerson() === $toPerson ||
($r->getFromPerson() === $toPerson and $r->getToPerson() === $fromPerson)
)
) { ) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->addViolation(); ->addViolation();