mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1819: Allow ResultSetMapping to be used for objects that are not entities #2288
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 (May 11, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user marijn:
Currently
Doctrine\ORM\Query\ResultSetMappingcan only be used to query the database for entities using theEntityManager::createNativeQuerymethod. It would be great if we could use this as well for objects that are not entities. That way we can create simple DTO's and map them to a query using theResultSetMapping.I'll open a PR If there are no objections.
@doctrinebot commented on GitHub (May 11, 2012):
Comment created by @beberlei:
Good idea. You could make this happen by adding a ArbitraryObjectHydrator that does not use the ClassMetadata but creates ReflectionProperty instances during the hydration.
Api would then be:
@doctrinebot commented on GitHub (May 13, 2012):
Comment created by marijn:
Thanks for your input. I'll try to work on some tests this week.
@doctrinebot commented on GitHub (May 14, 2012):
Comment created by marijn:
I've started working on the test suite in this PR.
@beberlei commented on GitHub (Dec 5, 2020):
This was added with new object mappings in 2.4