<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 19:03:52 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-2250/DDC-2250.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-2250] Joining Associations in Single Inheritance Scheme</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2250</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Let&apos;s assume the following class hierarchy:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
AbstractComment
SpecialComment &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; AbstractComment
{
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $specialAssociation;
}
RegularComment &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; RegularComment
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, I&apos;d like to write a query such as:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
SELECT c, a FROM AbstractComment c LEFT JOIN c.specialAssociation a
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The idea is to preload the association when selecting all comments. Now, that association is only present on a sub-class of the queried class, but since it is a single table inheritance, Doctrine should be able to join it for those entities where it is present.&lt;/p&gt;

&lt;p&gt;At the moment unfortunately, Doctrine shows an error that the association does not exist on the AbstractComment class. Also, there is no real alternative to this except moving the collection to the base class even if it does not belong there.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14396">DDC-2250</key>
            <summary>Joining Associations in Single Inheritance Scheme</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="7">Can&apos;t Fix</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="johannes">Johannes Schmitt</reporter>
                        <labels>
                    </labels>
                <created>Sun, 20 Jan 2013 11:00:46 +0000</created>
                <updated>Sun, 20 Jan 2013 13:25:40 +0000</updated>
                    <resolved>Sun, 20 Jan 2013 11:51:58 +0000</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19344" author="beberlei" created="Sun, 20 Jan 2013 11:51:58 +0000"  >&lt;p&gt;DQL has strict typing with regard to inheritance, this type of query is not possible.&lt;/p&gt;</comment>
                    <comment id="19347" author="johannes" created="Sun, 20 Jan 2013 13:25:40 +0000"  >&lt;p&gt;A too bad. I guess the code around inheritance is already quite complex that it does not make sense to add an exception for this case.&lt;/p&gt;

&lt;p&gt;Do you think it would somehow (maybe manually) be possible to load collections in a batch operation? For example, something like this:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$batch = array();
foreach ($comments as $comment) {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($comment &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; SpecialComment) {
        $batch[] = $comment-&amp;gt;getSpecialAssociation();
    }
}

$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;batchLoad($batch);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>