Skip to content

Commit cd4df11

Browse files
author
Christian Flothmann
committed
use the correct class name to retrieve mapped class' metadata and repository
1 parent 9ec6a9c commit cd4df11

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public function validate($entity, Constraint $constraint)
7474
}
7575
}
7676

77-
$className = $this->context->getClassName();
78-
$class = $em->getClassMetadata($className);
77+
$class = $em->getClassMetadata(get_class($entity));
7978
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
8079

8180
$criteria = array();
@@ -110,7 +109,7 @@ public function validate($entity, Constraint $constraint)
110109
}
111110
}
112111

113-
$repository = $em->getRepository($className);
112+
$repository = $em->getRepository(get_class($entity));
114113
$result = $repository->{$constraint->repositoryMethod}($criteria);
115114

116115
/* If the result is a MongoCursor, it must be advanced to the first

0 commit comments

Comments
 (0)