<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 23:40:57 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/DC-601/DC-601.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>[DC-601] When using a join and giving an alias to each select column the hyrdrator only returns one row.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-601</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi All &lt;br/&gt;
I am running into a strange problem using Doctrine-1.2.2-- I have a  multi row result set but only the first row of it is returned in the hyrdated array that is generated. &lt;br/&gt;
I have tracked this down in the code to get a basic idea of whats going on &amp;#8211; it seems that the $id variable in the hydrateResultSet function in Doctrine_Hydrator_Graph isn&apos;t being populated properly with data about the fields that are returning from my query. The _gatherRowData function seems to never detect that one of my columns is an identifier (&quot;if ($cache&lt;span class=&quot;error&quot;&gt;&amp;#91;$key&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;isIdentifier&amp;#39;&amp;#93;&lt;/span&gt;) &lt;/p&gt;
{&quot; doesn&apos;t return true ever so the next line of code: &quot;$id[$dqlAlias] .= &apos;|&apos; . $value;&quot; doesn&apos;t run). 
I think this is the problem but I don&apos;t totally understand how the mapping process is taking place in this function so can&apos;t be absolutely sure. 

This hydration problem goes away if I don&apos;t use left joins in my query, or if I use a query where not every field I am requesting is assigned an alias (at least one of the fields doesn&apos;t use the &apos;as&apos; syntax). 
For instance this php: 
{code}
&lt;p&gt;$q = Doctrine_Query::create(); &lt;br/&gt;
$q-&amp;gt;from(&apos;Customer Customer&apos;); &lt;br/&gt;
$q-&amp;gt;leftJoin(&apos;Customer.Zip Zip&apos;); &lt;br/&gt;
$q-&amp;gt;addSelect(&apos;Customer.firstname as first_name&apos;); &lt;br/&gt;
$q-&amp;gt;addSelect(&apos;Customer.postalcode as postalcode&apos;); &lt;br/&gt;
$q-&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY); &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;Generates &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; DQL: 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;SELECT Customer.firstname as first_name, Customer.postalcode as postalcode FROM Customer Customer LEFT JOIN Customer.Zip Zip&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;And &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; SQL:
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;SELECT c.firstname AS c_&lt;em&gt;0, c.postalcode AS c&lt;/em&gt;_1 FROM customers c LEFT JOIN zips z ON c.postalcode = z.postalcode&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;Which results in &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; after hyrdration: 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;array(&apos;0&apos;=&amp;gt;array(&apos;first_name&apos;=&amp;gt;&apos;Armando&apos;, &apos;postalcode&apos;=&amp;gt;&apos;00659&apos;)) &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;
However the following code hydrates just fine: 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;$q = Doctrine_Query::create(); &lt;br/&gt;
$q-&amp;gt;from(&apos;Customer Customer&apos;); &lt;br/&gt;
$q-&amp;gt;addSelect(&apos;Customer.firstname as first_name&apos;); &lt;br/&gt;
$q-&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY); &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;As does &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; code: 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;$q = Doctrine_Query::create(); &lt;br/&gt;
$q-&amp;gt;from(&apos;Customer Customer&apos;); &lt;br/&gt;
$q-&amp;gt;leftJoin(&apos;Customer.Zip Zip&apos;); &lt;br/&gt;
$q-&amp;gt;addSelect(&apos;Customer.firstname&apos;); &lt;br/&gt;
$q-&amp;gt;addSelect(&apos;Customer.postalcode as postalcode&apos;); &lt;br/&gt;
$q-&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY); &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;
Here is the yaml &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the sample data I am testing on: 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; detect_relations: false&lt;br/&gt;
 package: Example&lt;br/&gt;
 options:&lt;br/&gt;
   type: INNODB&lt;br/&gt;
   charset: utf8&lt;br/&gt;
 Customer:&lt;br/&gt;
   tableName: customers&lt;br/&gt;
   columns:&lt;br/&gt;
     customer_id:&lt;br/&gt;
       type: integer(4)&lt;br/&gt;
       primary: true&lt;br/&gt;
       notnull: true&lt;br/&gt;
       autoincrement: true&lt;br/&gt;
     firstname:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
     lastname:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
     streetaddress:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
     city:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
     state:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
     postalcode:&lt;br/&gt;
       type: string(45)&lt;br/&gt;
   relations:&lt;br/&gt;
     Order:&lt;br/&gt;
       type: many&lt;br/&gt;
       local: customer_id&lt;br/&gt;
       foreign: customer_id&lt;br/&gt;
     Zip:&lt;br/&gt;
       type: one&lt;br/&gt;
       local: postalcode&lt;br/&gt;
       foreign: postalcode&lt;br/&gt;
   options:&lt;br/&gt;
     type: InnoDB&lt;br/&gt;
 Zip:&lt;br/&gt;
   connection: default_schema&lt;br/&gt;
   tableName: zips&lt;br/&gt;
   columns:&lt;br/&gt;
     postalcode:&lt;br/&gt;
       type: varchar(30)&lt;br/&gt;
       primary: true&lt;br/&gt;
     latitude: &apos;float(10,6)&apos;&lt;br/&gt;
     longitude: &apos;float(10,6)&apos;&lt;br/&gt;
     city: string(50)&lt;br/&gt;
     state: string(50)&lt;br/&gt;
     country: string(50)&lt;br/&gt;
     type: string(50)&lt;br/&gt;
   relations:&lt;br/&gt;
     Customer:&lt;br/&gt;
       type: many&lt;br/&gt;
       local: postalcode&lt;br/&gt;
       foreign: postalcode&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;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Perhaps there is something simple I am overlooking. To get around this I am just always selecting the primary key from my main table in every query.&lt;/p&gt;

&lt;p&gt;Thanks in advance for any advice.&lt;br/&gt;
Will Ferrer&lt;/p&gt;</description>
                <environment>XP Xamp</environment>
            <key id="11139">DC-601</key>
            <summary>When using a join and giving an alias to each select column the hyrdrator only returns one row.</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="willf1976">will ferrer</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Mar 2010 19:32:28 +0000</created>
                <updated>Mon, 2 Aug 2010 02:45:07 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="12564" author="willf1976" created="Sat, 3 Apr 2010 18:13:13 +0000"  >&lt;p&gt;This problem also exists in 1.2.2 so I have updated the post to reflect this.&lt;/p&gt;</comment>
                    <comment id="12582" author="naag" created="Tue, 6 Apr 2010 08:30:00 +0000"  >&lt;p&gt;I experienced the same problem with Doctrine 1.2 (r7329). I also fixed this by adding the primary key of the table I select from to the select list.&lt;/p&gt;</comment>
                    <comment id="12603" author="willf1976" created="Wed, 7 Apr 2010 20:20:21 +0000"  >&lt;p&gt;Hi Peter&lt;/p&gt;

&lt;p&gt;Thats how I am currently working around the bug as well but hopefully it will get rectified in a later version of doctrine.&lt;/p&gt;

&lt;p&gt;Thanks for the comment.&lt;/p&gt;

&lt;p&gt;Will&lt;/p&gt;</comment>
                    <comment id="13139" author="somedoun" created="Tue, 8 Jun 2010 09:08:54 +0000"  >&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;I&apos;m new to doctrine and since yesterday, I&apos;m experiencing exactly the same behavior.&lt;br/&gt;
Any news about this subject ? Is there a doctrine version where the pb is solved ? &lt;br/&gt;
Help !&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Doun&lt;/p&gt;</comment>
                    <comment id="13239" author="willf1976" created="Tue, 8 Jun 2010 19:13:11 +0000"  >&lt;p&gt;Hi Sam&lt;/p&gt;

&lt;p&gt;Currently I am working around this bug by always adding the primary key of the table to the select (like peter also mentions above).&lt;/p&gt;

&lt;p&gt;It is a work around for the problem but so far it has been reliable for me.&lt;/p&gt;

&lt;p&gt;I hope that helps until there is a patch for it.&lt;/p&gt;

&lt;p&gt;Will Ferrer&lt;/p&gt;</comment>
                    <comment id="13246" author="somedoun" created="Wed, 9 Jun 2010 05:18:14 +0000"  >&lt;p&gt;Hi Will&lt;/p&gt;

&lt;p&gt;I&apos;ll do so.&lt;br/&gt;
Thank you VM.&lt;/p&gt;

&lt;p&gt;Sam Doun&lt;/p&gt;</comment>
                    <comment id="13756" author="shuchi" created="Mon, 2 Aug 2010 02:26:10 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Has there been any patch release for the same? &lt;br/&gt;
We just upgraded from Doctrine 1.1 to 1.2 and our project now crashes.&lt;/p&gt;

&lt;p&gt;For DQL - &lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;function getServiceDetails($merchantId,$merchantServiceId) {
    $q = Doctrine_Query::create()
        -&amp;gt;select(&apos;b.*, m.name as merchant_service_name,payment_mode.name as payment_mode_name,payment_mode.id as paymentMode,p.id as paymentModeOption &apos;)
        -&amp;gt;from(&apos;ServicePaymentModeOption b&apos;)
        -&amp;gt;leftJoin(&quot;b.MerchantService m&quot;)
        -&amp;gt;leftJoin(&quot;m.Merchant merchant&quot;)
        -&amp;gt;leftJoin(&quot;b.PaymentModeOption p&quot;)
        -&amp;gt;leftJoin(&quot;p.PaymentMode payment_mode&quot;)
        -&amp;gt;where(&quot;merchant.id=?&quot;,$merchantId)
        -&amp;gt;andWhere(&quot;b.merchant_service_id=?&quot;,$merchantServiceId)
        -&amp;gt;groupBy(&apos;p.name&apos;);

    return $res = $q-&amp;gt;execute(array(),Doctrine::HYDRATE_ARRAY);
  }  
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Result with Doctrine 1.1 is&lt;/b&gt;&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Array
(
    [0] =&amp;gt; Array
        (
            [id] =&amp;gt; 1
            [merchant_service_id] =&amp;gt; 1
            [payment_mode_option_id] =&amp;gt; 1
            [created_at] =&amp;gt;
            [updated_at] =&amp;gt;
            [deleted] =&amp;gt;
            [created_by] =&amp;gt;
            [updated_by] =&amp;gt;
            [merchant_service_name] =&amp;gt; NIS Passport
            [merchant_name] =&amp;gt; NIS
            [payment_mode_option_name] =&amp;gt; Bank
            [payment_mode_name] =&amp;gt; Bank
            [paymentMode] =&amp;gt; 1
            [paymentModeOption] =&amp;gt; 1
            [MerchantService] =&amp;gt; Array
                (
                    [merchant_service_name] =&amp;gt; NIS Passport
                    [Merchant] =&amp;gt; Array
                        (
                            [merchant_name] =&amp;gt; NIS
                        )

                )

            [PaymentModeOption] =&amp;gt; Array
                (
                    [payment_mode_option_name] =&amp;gt; Bank
                    [paymentModeOption] =&amp;gt; 1
                    [PaymentMode] =&amp;gt; Array
                        (
                            [payment_mode_name] =&amp;gt; Bank
                            [paymentMode] =&amp;gt; 1
                        )

                )

        )
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Result with Doctrine 1.2 is&lt;/b&gt;&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Array
(
    [0] =&amp;gt; Array
        (
            [id] =&amp;gt; 1
            [merchant_service_id] =&amp;gt; 1
            [payment_mode_option_id] =&amp;gt; 1
            [created_at] =&amp;gt;
            [updated_at] =&amp;gt;
            [deleted_at] =&amp;gt;
            [created_by] =&amp;gt;
            [updated_by] =&amp;gt;
            [merchant_service_name] =&amp;gt; NIS Passport
            [merchant_name] =&amp;gt; NIS
            [payment_mode_option_name] =&amp;gt; Bank
            [payment_mode_name] =&amp;gt; Bank
            [paymentMode] =&amp;gt; 1
            [paymentModeOption] =&amp;gt; 1
        )
)

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We have used Hydration for the result set at lot of places. Please suggest if there could be a fix without going about revising everything that has been coded.&lt;/p&gt;

&lt;p&gt;Looking forward to a quick response.&lt;/p&gt;





</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>