<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu May 23 17:01:40 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-1927/DDC-1927.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-1927] Pagination of a SELECT of specific fields results in a RuntimeException</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1927</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When paginating a DQL string which selects specific fields it results in the following error: PHP Fatal error:  Uncaught exception &apos;RuntimeException&apos; with message &apos;Not all identifier properties can be found in the ResultSetMapping: id&apos;&lt;/p&gt;

&lt;p&gt;NOT working: &apos;SELECT c.id, c.number FROM Application\Entity\Course c&apos;&lt;br/&gt;
WORKING: &apos;SELECT c FROM Application\Entity\Course c&apos;&lt;br/&gt;
WORKING: &apos;SELECT c, c.id, c.number FROM Application\Entity\Course c&apos;&lt;/p&gt;

&lt;p&gt;Setting hydration mode to scalar results makes no difference.&lt;/p&gt;

&lt;p&gt;Gist to example code and stack trace: &lt;a href=&quot;https://gist.github.com/d5cd6d0b0ac28e722dd7&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/d5cd6d0b0ac28e722dd7&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="13854">DDC-1927</key>
            <summary>Pagination of a SELECT of specific fields results in a RuntimeException</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="netiul">Zacharias Luiten</reporter>
                        <labels>
                        <label>paginator</label>
                    </labels>
                <created>Mon, 16 Jul 2012 10:10:55 +0000</created>
                <updated>Thu, 18 Apr 2013 20:22:25 +0000</updated>
                    <resolved>Sun, 25 Nov 2012 12:23:36 +0000</resolved>
                            <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="18403" author="beberlei" created="Sun, 29 Jul 2012 08:47:56 +0000"  >&lt;p&gt;First results: This is very complicated to support, the pagination was designed for entity results. I have to check this when I have more time.&lt;/p&gt;</comment>
                    <comment id="18477" author="dquintard" created="Wed, 8 Aug 2012 12:00:22 +0000"  >&lt;p&gt;Hi Benjamin,&lt;br/&gt;
I can change my code to select entity results (even for hundreds/thousands results).&lt;br/&gt;
But for now Pagination is not usable with ResultSetMapping::addScalarResult &lt;/p&gt;</comment>
                    <comment id="18982" author="mpinkston" created="Tue, 13 Nov 2012 17:06:42 +0000"  >&lt;p&gt;The reason this error occurs is because the Paginator creates its own ResultSetMapping and relies on the SqlWalker to configure it (see Doctrine\ORM\Query\SqlWalker::walkSelectExpression).&lt;/p&gt;

&lt;p&gt;Doctrine will interpret each field in the first example (SELECT c.id, c.number...) as a PathExpression and add it to the result set mapping as a scalar result. This makes it impossible for the paginator to reliably know which field can be considered an identifier.&lt;/p&gt;

&lt;p&gt;A quick fix might be to re-write the query to use PartialObjectExpression: SELECT partial c.&lt;/p&gt;
{id, number}
&lt;p&gt; ...&lt;/p&gt;

&lt;p&gt;(edited after a re-read and realization that a custom ResultSetMapping wouldn&apos;t cut it)&lt;/p&gt;
</comment>
                    <comment id="19052" author="beberlei" created="Sun, 25 Nov 2012 12:23:36 +0000"  >&lt;p&gt;Allowing generic+complex pagination on scalar results is impossible for us, closing as can&apos;t fix. &lt;/p&gt;

&lt;p&gt;Just use LIMITs yourself here or as suggested partial objects.&lt;/p&gt;</comment>
                    <comment id="20060" author="vecchia" created="Thu, 18 Apr 2013 20:22:25 +0000"  >&lt;p&gt;imho this pagination feature is quite useless if we are forced to fetch the complete Entity. Take for example a big table with a lot of data: extracting all the infos will take a lot of time... There should be a way to support the first query type&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>