Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Git Master
-
Fix Version/s: 2.3
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
Some single table inheritance
Resource.php
/** * @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
Fixed in https://github.com/doctrine/doctrine2/commit/bb1021198355871bd78b19c7795900be0020520b