<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 11:19:30 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-2260/DDC-2260.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-2260] Partial DQL query doesn&apos;t respect given order of columns</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2260</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When executing partial DQL queries it may be important to keep given order of columns e.g. for &quot;pairs&quot; hydrator when first column of a pair is used as a key and second - as value. For example query 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-sql&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;select&lt;/span&gt; partial u.{id,name} &lt;span class=&quot;code-keyword&quot;&gt;from&lt;/span&gt; my:User u&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;will expect &quot;id&quot; to be first in resulted set and &quot;name&quot; to be second and not vice versa.&lt;/p&gt;

&lt;p&gt;However Doctrine parses this part of statement via iterating over fields mapping from entity&apos;s class metadata (as can be seen in &lt;tt&gt;Doctrine\ORM\Query\SqlWalker::walkSelectExpression()&lt;/tt&gt;):&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;foreach ($class-&amp;gt;fieldMappings as $fieldName =&amp;gt; $mapping) {
  &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($partialFieldSet &amp;amp;&amp;amp; ! in_array($fieldName, $partialFieldSet)) {
    &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
  }
  ...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and hence given columns order preserving is not guaranteed.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14419">DDC-2260</key>
            <summary>Partial DQL query doesn&apos;t respect given order of columns</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="flying">Alexander Grimalovsky</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Jan 2013 10:42:01 +0000</created>
                <updated>Sun, 27 Jan 2013 15:48:58 +0000</updated>
                                    <version>2.3.2</version>
                                                <component>DQL</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19418" author="ocramius" created="Sat, 26 Jan 2013 15:55:02 +0000"  >&lt;p&gt;What is the advantage in respecting the order given in the DQL query?&lt;/p&gt;</comment>
                    <comment id="19426" author="flying" created="Sun, 27 Jan 2013 10:01:12 +0000"  >&lt;p&gt;Currently the only practical reason for it that I found is &quot;pairs&quot; hydrator. However it is, of course, possible to implement it without such change too. &lt;/p&gt;

&lt;p&gt;Generally speaking this behavior (getting result set with same order of columns that was given in a query) is something that is feeling &quot;natural&quot; for operations with database since it is how you normally get results from SQL queries.&lt;/p&gt;

&lt;p&gt;Maybe it will be enough to mention in documentation for Doctrine that given columns order is not guaranteed to be kept.&lt;/p&gt;</comment>
                    <comment id="19428" author="ocramius" created="Sun, 27 Jan 2013 15:48:39 +0000"  >&lt;p&gt;@&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=flying&quot; class=&quot;user-hover&quot; rel=&quot;flying&quot;&gt;Alexander Grimalovsky&lt;/a&gt; I don&apos;t think it&apos;s worth mentioning it. Also, including a fix for this is quite complex. If you prefer to document it, go for it!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>