mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-04 06:57:42 +00:00
allow the deletion of a relationship
This commit is contained in:
parent
85796c2271
commit
88961e3e7e
@ -39,6 +39,7 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||
|
||||
$fromPerson = $value->getFromPerson();
|
||||
$toPerson = $value->getToPerson();
|
||||
$relationType = $value->getRelation();
|
||||
|
||||
$relationships = $this->relationshipRepository->findBy([
|
||||
'fromPerson' => [$fromPerson, $toPerson],
|
||||
@ -46,11 +47,11 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||
]);
|
||||
|
||||
foreach ($relationships as $r) {
|
||||
if (
|
||||
$r->getFromPerson() === $fromPerson
|
||||
if ($r->getRelation()->getId() !== $relationType->getId() &&
|
||||
($r->getFromPerson() === $fromPerson
|
||||
|| $r->getFromPerson() === $toPerson
|
||||
|| $r->getToPerson() === $fromPerson
|
||||
|| $r->getToPerson() === $toPerson
|
||||
|| $r->getToPerson() === $toPerson)
|
||||
) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->addViolation();
|
||||
|
Loading…
x
Reference in New Issue
Block a user