I'm trying to fix that. However, I just reused what was done here: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php#L846