Skip to content

Loading…

DDC-1596: Discriminator column has no table alias #2233

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user ghennady:

Some single table inheritance

/****
 * @Orm\Entity
 * @Orm\Table(name="resource")
 * @Orm\InheritanceType("SINGLE_TABLE")
 * @Orm\DiscriminatorColumn(name="type", type="string")
 * @Orm\DiscriminatorMap({"Container" = "Container", "News"="News"})
 */
abstract class Resource
{
}
$em->getRepository('News')->find($id)
/****
* generate SQL like this: 
* SELECT t0.id AS id1, t0.name AS name2, type FROM resource t0 WHERE t0.id = ? AND t0.type IN ('News')
*/

Column type has no table alias.
I expected SQL like this:

SELECT t0.id AS id1, t0.name AS name2, t0.type FROM resource t0 WHERE t0.id = ? AND t0.type IN ('News')

Proposed patch attached

@doctrinebot

Comment created by @guilhermeblanco:

Fixed in bb10211

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.