mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Doctrine 2 Native Query ResultSetMapping doesn't return joined object #5797
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 @Inmmelman on GitHub (Dec 7, 2017).
I have 3 entities. And try to load data by native SQL with ResultSetMapping. My question is abount why all times profile is null. Code is under text. Please help to resolve this((( I try to join table by addFieldResult and fill columns from this table, but it's doen't has any effects. Domain entity load fine.
I thinking this problem can be because account and profile entitites have the same name of relation field and profile "inversedBy="account""
If I try to use
$rsm->addFieldResult('p', 'first_name', 'firstName', Profile::class);for load specified field for Profile hydration doesn't work. ObjectHydrator.php in hydrateRowData checks hydrateRowData that must contains isIdentifier fields, in my case first_name it's not identifier and after this check finally set value to null.
Fetching data code
Account:
Profile:
Domain:
@lcobucci commented on GitHub (Dec 19, 2017):
@Inmmelman do you really need to use the native API on that case? I mean, do you have what you need when not using it?
@popovserhii commented on GitHub (Dec 11, 2018):
Is there any news about this issue?
@Halanson commented on GitHub (Dec 19, 2018):
I run into a very similar issue. I ended up with just
$rsm->addRootEntityFromClassMetadata(\App\Entity\Account::class, 'a');