DDC-1354: ClassName proxy classes has includes '\' in front of namespace while other don't #1972

doctrinebot opened this Issue Aug 31, 2011 · 3 comments

2 participants


Jira issue originally created by user bas.wad:

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 [ getparentclass($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


Comment created by @guilhermeblanco:

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. =)



Issue was closed with resolution "Fixed"


Comment created by @beberlei:

merged into 2.1.x

@doctrinebot doctrinebot added this to the 2.1.2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment