Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

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

@doctrinebot

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

ecc556f

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by @beberlei:

merged into 2.1.x

@doctrinebot doctrinebot added this to the 2.1.2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.