merged branch jmikola/patch-4 (PR #3540)

Commits
-------

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

Discussion
----------

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

More lively discussion from: doctrine/DoctrineMongoDBBundle#84.
This commit is contained in:
Fabien Potencier 2012-03-10 16:35:40 +01:00
commit 1a2642a85a

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;
}