8000 merged branch jmikola/patch-4 (PR #3540) · symfony/symfony@1a2642a · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a2642a

Browse files
committed
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.
2 parents b301bd3 + c8e74da commit 1a2642a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function isValid($entity, Constraint $constraint)
106106
* which is the same as the entity being validated, the criteria is
107107
* unique.
108108
*/
109-
if (0 === count($result) || (1 === count($result) && $entity === current($result))) {
109+
if (0 === count($result) || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)))) {
110110
return true;
111111
}
112112

0 commit comments

Comments
 (0)
0