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.
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.
|Field||Original Value||New Value|
|Summary||@PostLoad event not triggered when entity loaded through ObjectHydrator||Actual classMetadata is not used when entity with DiscriminatorMap is hydrated, instead AbstractClass metaData is used.|
|Priority||Major [ 3 ]||Critical [ 2 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Fix Version/s||2.2.1 [ 10194 ]|
|Resolution||Fixed [ 1 ]|
|Workflow||jira [ 13425 ]||jira-feedback [ 15222 ]|
|Workflow||jira-feedback [ 15222 ]||jira-feedback2 [ 17086 ]|
|Workflow||jira-feedback2 [ 17086 ]||jira-feedback3 [ 19339 ]|