Fix issue with MongoId objects in UnitOfWork

When using references and embedded objects with references, you get this exception when trying to get the referenced object.

```
[Symfony\Component\Debug\Exception\ContextErrorException]                                                                                                                      
  Warning: Illegal offset type in isset or empty in 
./vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php line 1693
```