[DoctrineBridge] Iterator->current() is not the same as current(Iterator)

This commit is contained in:
Jeremy Mikola 2012-03-09 10:27:18 -05:00
parent 4bb65c7057
commit c8e74da8be

View File

@ -106,7 +106,7 @@ class UniqueEntityValidator extends ConstraintValidator
* which is the same as the entity being validated, the criteria is
* unique.
*/
if (0 === count($result) || (1 === count($result) && $entity === current($result))) {
if (0 === count($result) || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)))) {
return true;
}