doctrine/DoctrineMongoDBBundle — Issue #84: UniqueValidator, current(LoggableCursor) returns null
Author: analogic
Created: 2012-03-08 17:04:48+00:00
State: open

Its correct behaviour extended from \MongoCursor (first call without next() returns null), but in Symfony UniqueEntityValidator which is used by recent patch is this code:

```php
$result = $repository->findBy($criteria);

/* If no entity matched the query criteria or a single entity matched,
* which is the same as the entity being validated, the criteria is
* unique.
*/
if (0 === count($result) || (1 === count($result) && $entity === current($result))) {
return true;
}
```

Already saved unique objects can't be saved again...