8000 [DoctrineBridge] Iterator->current() is not the same as current(Itera… · symfony/symfony@c8e74da · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit c8e74da

Browse files
committed
[DoctrineBridge] Iterator->current() is not the same as current(Iterator)
1 parent 4bb65c7 commit c8e74da

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