use the correct class name to retrieve mapped class' metadata and repository
This commit is contained in:
parent
9ec6a9c3dc
commit
cd4df11b06
@ -74,8 +74,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
||||
}
|
||||
}
|
||||
|
||||
$className = $this->context->getClassName();
|
||||
$class = $em->getClassMetadata($className);
|
||||
$class = $em->getClassMetadata(get_class($entity));
|
||||
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
|
||||
|
||||
$criteria = array();
|
||||
@ -110,7 +109,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
||||
}
|
||||
}
|
||||
|
||||
$repository = $em->getRepository($className);
|
||||
$repository = $em->getRepository(get_class($entity));
|
||||
$result = $repository->{$constraint->repositoryMethod}($criteria);
|
||||
|
||||
/* If the result is a MongoCursor, it must be advanced to the first
|
||||
|
Reference in New Issue
Block a user