Skip to content

Commit 3fd866c

Browse files
committed
[3.0] Remove calls to not-existent method
1 parent f4f7fef commit 3fd866c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Validator/Constraints/UniqueEntityValidator.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Doctrine\Validator\Constraints;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15-
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1615
use Symfony\Component\Validator\Constraint;
1716
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1817
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -139,16 +138,9 @@ public function validate($entity, Constraint $constraint)
139138
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
140139
$invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]];
141140

142-
if ($this->context instanceof ExecutionContextInterface) {
143-
$this->context->buildViolation($constraint->message)
144-
->atPath($errorPath)
145-
->setInvalidValue($invalidValue)
146-
->addViolation();
147-
} else {
148-
$this->buildViolation($constraint->message)
149-
->atPath($errorPath)
150-
->setInvalidValue($invalidValue)
151-
->addViolation();
152-
}
141+
$this->context->buildViolation($constraint->message)
142+
->atPath($errorPath)
143+
->setInvalidValue($invalidValue)
144+
->addViolation();
153145
}
154146
}

0 commit comments

Comments
 (0)