mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1059: Add helper for ResultSetMapping #1324
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 (Mar 5, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @beberlei:
Building a ResultSetMapping yourself is tedious work, it can be simplified by passing ClassMetadata instances, so that the RSM even changes when the Entity Metadata changes.
Two use-cases:
@doctrinebot commented on GitHub (Mar 24, 2011):
Comment created by mridgway:
What are the inputs and outputs from this? Would this return just the ResultSetMap and then you'd be expected to generate the SQL yourself?
The main reason for using the RSM is if you are trying to do something that is not supported in DQL. With the SQL query building functions being added to the DBAL, would it be better to have a helper that takes in DQL (or DQL parts?) and returns the SQL query and the RSM?
I'm not sure if this covers all use cases, but probably the most common.
@doctrinebot commented on GitHub (Mar 25, 2011):
Comment created by @beberlei:
I was thinking this accepts a ClassMetadata instance, or the EM + ClassName. Additionally you might need to pass a prefix when you have to build a query for many tables that have equally named columns:
Naming and API is open to discussion obviously :-)
The goal should be that you dont have to change your native queries when you add or remove a column from your entity.
@doctrinebot commented on GitHub (Mar 29, 2011):
Comment created by mridgway:
I made a first pass at this:
20dc72ef9aThis basically creates new functions with the same functionality as addEntityResult and addJoinedEntityResult except that they take in ClassMetadata and will add the fields from the class automatically. There is also an additional parameter for each function that is a prefix that is added to the entity's column name (see test case for example).
One problem with this implementation is that it doesn't use DBAL\Platforms\AbstractPlatform::getSQLResultCasing since we don't have access to the connection.
There are probably other problems, but I wanted to get some feedback on whether this is heading in the right direction.
@doctrinebot commented on GitHub (May 15, 2011):
Comment created by @beberlei:
This was implemented by Michael, thank you!
@doctrinebot commented on GitHub (May 15, 2011):
Issue was closed with resolution "Fixed"