use the correct class name to retrieve mapped class' metadata and repository

This commit is contained in:
Christian Flothmann 2013-11-28 17:08:45 +01:00
parent 9ec6a9c3dc
commit cd4df11b06

View File

@ -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