Atlantic18/DoctrineExtensions — pull request #1188 by zeliard91 (2014-11-15 02:17:42+00:00)
Title: Fix MongoDB SortableGroup on a reference document

Question | Answer
-------- | ------
Bug fix ? | yes
New feature ? | no
BC breaks ? | no
Tests pass ? | yes

When we set SortableGroup on a referenced attribute like this :
```php
/**
* @Gedmo\SortableGroup
* @ODM\ReferenceOne(targetDocument="Sortable\Fixture\Document\Category")
*/
protected $category;
```
an exception is thrown when we try to update the document.

This happens in ODM\Gedmo\Sortable\Mapping\Event\Adapter\ODM::getMaxPosition();
on the instruction
$document = $qb->getQuery()->getSingleResult();

MongoException: zero-length keys are not allowed, did you use $ with double quotes?

I've add a condition in the querybuilder to handle the case of a sortable group based on a referenced document.

@stof, is !$dm->getMetadataFactory()->isTransient(ClassUtils::getClass($value)) the right way to test if an object is handle by Doctrine ?