Details
Description
The classname given to the EntityPersister by the ProxyFactory includes a backslash '\' in front of the namespace while normal classes and the proxy itself don't have this. This issue causes it impossible to persist proxyclasses, because of the string comparison in UnitOfWork::executeUpdates in the statement [ get_parent_class($entity) == $className ] this will do 'some\namespace\someclass' == '\some\namespace\someclass'
Aftter some debugging work it seems the '\' is trimmed of when getting the ClassMetadata while this isn't done when a the proxyfactory creates the proxy. So it is probably fixed by placing:
$className = ltrim($className, '\');
at the start of ProxyFactory::getProxy where '\' is actually a double backslash but that cannot be posted here
That was not the issue, but it was a good starting point.
The actual problem was during mapping that targetEntity never ltrim'ed the entity name referred there.
Internally, Hydrator and UnitOfWork consume the ProxyFactory directly, so it lead to a wrong hashmap key for persisters.
By fixing the targetEntity value, everything is fixed. =)
https://github.com/doctrine/doctrine2/commit/ecc556f6872c0d44fff5678dc38e068422962aa0