mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3170: SimpleObjectHydrator fails to get discriminator column from mapped SQL result #3928
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 (Jun 17, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user ureimers:
When querying a simple entity which uses single table- or class table inheritance using simple object hydration (
AbstractQuery::HYDRATE_SIMPLEOBJECT), the mapped discriminator column is not retrieved correctly.Example:
The SQL statement used is equal to:
As you can see, the
typecolumn is given an alias oftype1. This is saved in theResultSetMappingof the request but not taken into account when actually retrieving the discriminator column back from the SQL result.The problem is inside SimpleObjectHydrator#hydrateRowData().
When the discriminator column name is fetched via
the result is simply
typewhich is wrong because the alias istype2. This can be fixed by addingright after the column retrieval, because then the alias of the meta field
typeis correctly taken into account.I'll create a PR with a unit test for this fix right after this ticket's creation.
I hope I'm doing everything right, this is my first contribution.
@doctrinebot commented on GitHub (Jun 17, 2014):
Comment created by ureimers:
PR is https://github.com/doctrine/doctrine2/pull/1060
I though that I first create a ticket, then propose a fix for that with a PR and by adding the Ticket ID in the PR-Title they are linked automatically. But unfortunately it seems I've done something wrong there.
@doctrinebot commented on GitHub (Jun 17, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1060] was closed:
https://github.com/doctrine/doctrine2/pull/1060