<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 19 08:50:38 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-2225/DDC-2225.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-2225] Discriminator column is not considered correctly for class table inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2225</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Imagine having a class table inheritance for Employee and Person:&lt;/p&gt;

&lt;p&gt;class Person {} =&amp;gt; is mapped to table &quot;person&quot;&lt;br/&gt;
class Employee extends Person {}&#160;is mapped to table &quot;person_employee&quot;&lt;/p&gt;

&lt;p&gt;When selecting &quot;SELECT e FROM Employee&quot; the SqlWalker will not generate a WHERE condition for a correct discriminator column value (e.g. &quot;employee&quot;). The ORM seems to trust on the generated INNER JOIN (person.id = person_employee.id).&lt;/p&gt;

&lt;p&gt;Of course the table person_employee should only contain rows for Employee ojects. But if you have a discriminator value &quot;person&quot; for a row matching an Employee row, the repository will return a Person object although we selected from Employee.&lt;/p&gt;

&lt;p&gt;A simple fix is to add the correct DQL expression:&lt;br/&gt;
SELECT e FROM Employee WHERE e INSTANCE OF Employee&lt;/p&gt;

&lt;p&gt;Is there any reason, why the discriminator column is only considered for single table inheritance explicitly (see &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/SqlWalker.php#L426)?&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/SqlWalker.php#L426)?&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="14354">DDC-2225</key>
            <summary>Discriminator column is not considered correctly for class table inheritance</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="2">Won&apos;t Fix</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="perprogramming">Per Bernhardt</reporter>
                        <labels>
                    </labels>
                <created>Mon, 7 Jan 2013 15:02:56 +0000</created>
                <updated>Tue, 12 Feb 2013 10:45:29 +0000</updated>
                    <resolved>Tue, 12 Feb 2013 10:45:29 +0000</resolved>
                            <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19509" author="asm89" created="Sat, 9 Feb 2013 23:36:48 +0000"  >&lt;p&gt;Can you provide more information on your usecase and where this leads to wrong results? Unless you&apos;re altering the discriminator column values yourself this should be no problem?&lt;/p&gt;</comment>
                    <comment id="19510" author="ocramius" created="Sat, 9 Feb 2013 23:39:39 +0000"  >&lt;p&gt;JTI assumes that your rows in table `person_employee` are part of instances of `Employee`.&lt;/p&gt;

&lt;p&gt;If you manually altered the discriminator column, that cannot be helped, since the ORM does not support casting.&lt;/p&gt;</comment>
                    <comment id="19532" author="perprogramming" created="Tue, 12 Feb 2013 09:39:35 +0000"  >&lt;p&gt;Yes, the discriminator column is &quot;manually&quot; altered by our CMS. In other words, our CMS does not care to delete rows in any subtable, it only changes the discriminator column. So a valid solution for this situation is to change that, of course.&lt;/p&gt;

&lt;p&gt;But why does the ORM check the discriminator column only for single table inheritance? In other words: Why do we need to have a discriminator column for class table inheritance, if the ORM does not rely on it?&lt;/p&gt;</comment>
                    <comment id="19533" author="ocramius" created="Tue, 12 Feb 2013 09:46:23 +0000"  >&lt;p&gt;It is used during the hydration step to decide what type your entity is as far as I know, even if all values in the joined tables are NULL.&lt;/p&gt;</comment>
                    <comment id="19534" author="perprogramming" created="Tue, 12 Feb 2013 09:50:03 +0000"  >&lt;p&gt;Do you think it would break things when checking the discriminator column for class table inheritance in &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/SqlWalker.php#L426?&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/SqlWalker.php#L426?&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="19535" author="ocramius" created="Tue, 12 Feb 2013 10:31:28 +0000"  >&lt;p&gt;That check is not needed in JTI... And anyway, your logic wouldn&apos;t work if your CMS does an upcast somewhere.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>