mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1640: Actual classMetadata is not used when entity with DiscriminatorMap is hydrated, instead AbstractClass metaData is used. #2060
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 8, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jelte@marlon:
Because the className changes in ObjectHydrator:226 it might be that the ClassMetadata has not been loaded yet.
When the classMetadata has not been loaded the PostLoad events are not executed.
adding the following after the className has changed solves the issue.
example:
When I would do now:
$service would be a concrete class ServceA or ServiceB, but these ClassMetadata's might not be loaded yet. If this is the cause then $service->status will be null as the @PostLoad has not been executed.
@doctrinebot commented on GitHub (Feb 9, 2012):
Comment created by jelte@marlon:
I've have found the same issue with the SimpleObjectHydrator.
Although here it might have worse consequences.
When a row is hydrated it the class has a discriminatorMap, the classMetadata of the defined class (usually the abstract class) is used and not the actual classMetadata of the class it will be converted to.
Same issue here that the @PostLoad isn't triggered but also
uses the wrong classMetadata is used.
should be: Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator:86
@doctrinebot commented on GitHub (Feb 9, 2012):
Comment created by jelte@marlon:
Changed summery to better reflect the bug.
@doctrinebot commented on GitHub (Feb 17, 2012):
Comment created by @beberlei:
Fixed.
@doctrinebot commented on GitHub (Feb 17, 2012):
Issue was closed with resolution "Fixed"