mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Allow ResultSetMapping to hydrate unmapped entity parameter #7394
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 @Jarod-MIDY on GitHub (Jul 10, 2024).
Feature Request
Summary
While using the ResultSetMapping object to hydrate a doctrine-managed entity from a native SQL request I could not hydrate parameters that do not correspond to a db column.
the SQL query counts the total number of pages by book. I don't want to add a nb_pages column in my book table.
the entity :
the mapping :
@soullivaneuh commented on GitHub (Jul 11, 2024):
The logic described above produce the following error:
It is because the
nbPagesis not part of the class metadata used byAbstractHydrator.The
ColumnResultannotation looks to be the solution in order to make it considering the field to the metadata as a result only property.However, this annotation was removed before the attribute migration by https://github.com/doctrine/orm/pull/7095 and https://github.com/doctrine/orm/pull/10114 without any explanation of why referenced.
@mkoskl commented on GitHub (Jan 5, 2026):
I have similar use-case. Is there a solution for this?