[Validator] Validate object with it's own entity manager by default
This commit is contained in:
parent
5526072dba
commit
4ca09a931d
@ -54,7 +54,11 @@ class UniqueEntityValidator extends ConstraintValidator
|
||||
throw new ConstraintDefinitionException("At least one field has to be specified.");
|
||||
}
|
||||
|
||||
$em = $this->registry->getEntityManager($constraint->em);
|
||||
if ($constraint->em) {
|
||||
$em = $this->registry->getEntityManager($constraint->em);
|
||||
} else {
|
||||
$em = $this->registry->getEntityManagerForClass(get_class($entity));
|
||||
}
|
||||
|
||||
$className = $this->context->getCurrentClass();
|
||||
$class = $em->getClassMetadata($className);
|
||||
|
Reference in New Issue
Block a user