<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 16:24:11 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-1410/DDC-1410.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-1410] leftJoin with condition WITH &amp; Object Hydratation problem.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1410</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Here an example of a simple QueryBuilder :&lt;/p&gt;

&lt;p&gt;$queryBuilder	= $entityManager-&amp;gt;createQueryBuilder();&lt;br/&gt;
$queryBuilder-&amp;gt;select ( &quot;player, options&quot; );&lt;br/&gt;
$queryBuilder-&amp;gt;from ( &quot;Player_Model_Entity_Player&quot;, &quot;player&quot;);&lt;br/&gt;
$queryBuilder-&amp;gt;where (&quot;player.idPlayer = 12&quot;);&lt;br/&gt;
$queryBuilder-&amp;gt;leftJoin (&quot;player.options&quot;, &quot;options&quot;, &quot;WITH&quot;, &quot;options.enabled = :enabled&quot;);&lt;br/&gt;
$queryBuilder-&amp;gt;setParameter (&quot;enabled&quot;, 1);&lt;/p&gt;


&lt;p&gt;OptionA &amp;amp; OptionB &amp;amp; OptionC three entities.&lt;br/&gt;
User case :&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;OptionA.enabled = 1 &amp;amp; OptionB.enabled = 1 &amp;amp; OptionC.enabled = 1 : OK - All options are return.&lt;/li&gt;
	&lt;li&gt;OptionA.enabled = 1 &amp;amp; OptionB.enabled = 0 &amp;amp; OptionC.enabled = 0 : OK - only optionA is return.&lt;/li&gt;
	&lt;li&gt;OptionA.enabled = 1 &amp;amp; OptionB.enabled = 0 &amp;amp; OptionC.enabled = 1 : OK - only optionA &amp;amp; optionC is return.&lt;/li&gt;
	&lt;li&gt;OptionA.enabled = 0 &amp;amp; OptionB.enabled = 1 &amp;amp; OptionC.enabled = 1 : KO - no option return.&lt;/li&gt;
	&lt;li&gt;OptionA.enabled = 0 &amp;amp; OptionB.enabled = 0 &amp;amp; OptionC.enabled = 0 : OK - no option return.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I have test on OneToMany configuration and I have not problem. The problem only appear with ManyToMany relationships.&lt;/p&gt;

&lt;p&gt;The problem seems to be on hydratation. The data return on SQL command seems to be correct. &lt;/p&gt;</description>
                <environment>Debian 5 dotdeb&lt;br/&gt;
PHP 5.3&lt;br/&gt;
MySQL 5.0&lt;br/&gt;
Apache 2.2</environment>
            <key id="13075">DDC-1410</key>
            <summary>leftJoin with condition WITH &amp; Object Hydratation problem.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/blocker.png">Blocker</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 Oct 2011 14:37:33 +0000</created>
                <updated>Thu, 7 Jun 2012 23:56:49 +0000</updated>
                    <resolved>Fri, 28 Oct 2011 21:47:48 +0000</resolved>
                            <version>Git Master</version>
                                <fixVersion>2.1.3</fixVersion>
                                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16669" author="armetiz" created="Thu, 20 Oct 2011 13:25:32 +0000"  >&lt;p&gt;I have made some other search about it.&lt;/p&gt;

&lt;p&gt;On the queryBuilder described above, I was using getSingleResult / getResult.&lt;br/&gt;
When I&apos;m using getScalarResult I can see data of every options.&lt;/p&gt;

&lt;p&gt;Here the scalar result :&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;array(3) {
  [0]=&amp;gt;
  array(21) {
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;player_id&quot;&lt;/span&gt;]=&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_id&quot;&lt;/span&gt;]=&amp;gt;
    NULL
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_enabled&quot;&lt;/span&gt;]=&amp;gt;
    NULL
  }
  [1]=&amp;gt;
  array(21) {
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;player_id&quot;&lt;/span&gt;]=&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_id&quot;&lt;/span&gt;]=&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_enabled&quot;&lt;/span&gt;]=&amp;gt;
    bool(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
  }
  [2]=&amp;gt;
  array(21) {
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;player_id&quot;&lt;/span&gt;]=&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_id&quot;&lt;/span&gt;]=&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(4)
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;options_enabled&quot;&lt;/span&gt;]=&amp;gt;
    bool(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Do you have any clue ?&lt;/p&gt;</comment>
                    <comment id="16673" author="armetiz" created="Thu, 20 Oct 2011 14:58:24 +0000"  >&lt;p&gt;I think I have find the problem.&lt;/p&gt;

&lt;p&gt;See patch.&lt;br/&gt;
I have test the modification, it seem to be okay.&lt;/p&gt;

&lt;p&gt;In the 2.1.2 version, If the first related object wasn&apos;t a &quot;nonemptyComponents&quot;, the ObjectHydrator initialized the collection by a specific way.&lt;/p&gt;</comment>
                    <comment id="16674" author="armetiz" created="Thu, 20 Oct 2011 14:59:38 +0000"  >&lt;p&gt;It&apos;s a patch for Doctrine/ORM/Internal/Hydration/ObjectHydrator.php version 2.1.2.&lt;/p&gt;</comment>
                    <comment id="16675" author="armetiz" created="Thu, 20 Oct 2011 15:42:38 +0000"  >&lt;p&gt;I have add a correction on Github : &lt;a href=&quot;https://github.com/armetiz/doctrine2/commit/42d507632fd27a23220c38bb867b611c3caaab8e&quot; class=&quot;external-link&quot;&gt;https://github.com/armetiz/doctrine2/commit/42d507632fd27a23220c38bb867b611c3caaab8e&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="16693" author="beberlei" created="Tue, 25 Oct 2011 06:48:53 +0000"  >&lt;p&gt;Thanks for digging into that, I will evaluate this issue&lt;/p&gt;</comment>
                    <comment id="16694" author="armetiz" created="Tue, 25 Oct 2011 09:32:53 +0000"  >&lt;p&gt;No problem, It was blocking for me.&lt;br/&gt;
But I don&apos;t understand why this bug doesn&apos;t appear to other users. Because of that, I&apos;m wondering if it&apos;s a real bug or a miss configuration on my app.&lt;/p&gt;

&lt;p&gt;To be sure, the best will be to create a new test, but I&apos;m not really familiar to create ORM test case.. &lt;/p&gt;

&lt;p&gt;Thomas.&lt;/p&gt;</comment>
                    <comment id="16699" author="beberlei" created="Tue, 25 Oct 2011 18:59:39 +0000"  >&lt;p&gt;can you post your mappings?&lt;/p&gt;</comment>
                    <comment id="16701" author="armetiz" created="Wed, 26 Oct 2011 09:39:00 +0000"  >&lt;p&gt;PlayerEntity :&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;&amp;lt;?xml version=&lt;span class=&quot;code-quote&quot;&gt;&quot;1.0&quot;&lt;/span&gt; encoding=&lt;span class=&quot;code-quote&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;?&amp;gt;
&amp;lt;doctrine-mapping xmlns=&lt;span class=&quot;code-quote&quot;&gt;&quot;http:&lt;span class=&quot;code-comment&quot;&gt;//doctrine-project.org/schemas/orm/doctrine-mapping&quot;&lt;/span&gt;
&lt;/span&gt;      xmlns:xsi=&lt;span class=&quot;code-quote&quot;&gt;&quot;http:&lt;span class=&quot;code-comment&quot;&gt;//www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt;
&lt;/span&gt;      xsi:schemaLocation=&quot;http:&lt;span class=&quot;code-comment&quot;&gt;//doctrine-project.org/schemas/orm/doctrine-mapping
&lt;/span&gt;                    http:&lt;span class=&quot;code-comment&quot;&gt;//doctrine-project.org/schemas/orm/doctrine-mapping.xsd&quot;&amp;gt;
&lt;/span&gt;	&amp;lt;entity name=&lt;span class=&quot;code-quote&quot;&gt;&quot;PlayerEntity&quot;&lt;/span&gt;&amp;gt;
		&amp;lt;many-to-many field=&lt;span class=&quot;code-quote&quot;&gt;&quot;options&quot;&lt;/span&gt; target-entity=&lt;span class=&quot;code-quote&quot;&gt;&quot;OptionEntity&quot;&lt;/span&gt; mapped-by=&lt;span class=&quot;code-quote&quot;&gt;&quot;players&quot;&lt;/span&gt; /&amp;gt;
	&amp;lt;/entity&amp;gt;
&amp;lt;/doctrine-mapping&amp;gt;
{/code}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br/&gt;
&amp;lt;doctrine-mapping xmlns=&quot;http://doctrine-project.org/schemas/orm/doctrine-mapping&quot;&lt;br/&gt;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;br/&gt;
      xsi:schemaLocation=&quot;http://doctrine-project.org/schemas/orm/doctrine-mapping&lt;br/&gt;
                    &lt;a href=&quot;http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd&quot; class=&quot;external-link&quot;&gt;http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd&lt;/a&gt;&quot; &amp;gt;&lt;br/&gt;
	&amp;lt;entity name=&quot;OptionEntity&quot; table=&quot;options&quot;&amp;gt;		&lt;br/&gt;
		&amp;lt;many-to-many field=&quot;players&quot; target-entity=&quot;PlayerEntity&quot; inversed-by=&quot;options&quot;&amp;gt;&lt;br/&gt;
			&amp;lt;cascade&amp;gt;&lt;br/&gt;
				&amp;lt;cascade-merge /&amp;gt;&lt;br/&gt;
			&amp;lt;/cascade&amp;gt;&lt;br/&gt;
			&amp;lt;join-table name=&quot;compo_option_player&quot; /&amp;gt;&lt;br/&gt;
		&amp;lt;/many-to-many&amp;gt;&lt;br/&gt;
	&amp;lt;/entity&amp;gt;&lt;br/&gt;
&amp;lt;/doctrine-mapping&amp;gt;&lt;/p&gt;
{/code}

&lt;p&gt;I have post all the mapping, but it&apos;s Doctrine compliant.&lt;br/&gt;
PlayerEntity extends PlayerBaseEntity, and Option is a standalone Entity.&lt;br/&gt;
All define an auto generated identifier.&lt;br/&gt;
The join table is correctly configured.&lt;/p&gt;

&lt;p&gt;Do you need this mapping to create tests ?&lt;br/&gt;
To sum-up, this is a simply ManyToMany relation between an inheritance Entity &amp;amp; a simple Entity.&lt;/p&gt;

&lt;p&gt;Do you need any else ?&lt;/p&gt;

&lt;p&gt;Thomas.&lt;/p&gt;</comment>
                    <comment id="16713" author="beberlei" created="Fri, 28 Oct 2011 21:47:48 +0000"  >&lt;p&gt;Fixed.&lt;/p&gt;</comment>
                    <comment id="16782" author="beberlei" created="Tue, 8 Nov 2011 23:50:41 +0000"  >&lt;p&gt;This issue is referenced in Github Pull-Request GH-161&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/161&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/161&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="18051" author="beberlei" created="Thu, 7 Jun 2012 18:51:50 +0000"  >&lt;p&gt;A related Github Pull-Request &lt;span class=&quot;error&quot;&gt;&amp;#91;GH-161&amp;#93;&lt;/span&gt; was opened&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/dbal/pull/161&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/pull/161&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="18052" author="beberlei" created="Thu, 7 Jun 2012 23:56:49 +0000"  >&lt;p&gt;A related Github Pull-Request &lt;span class=&quot;error&quot;&gt;&amp;#91;GH-161&amp;#93;&lt;/span&gt; was closed&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/dbal/pull/161&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/pull/161&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11078" name="ObjectHydrator_DDC-1410_v1.patch" size="1127" author="armetiz" created="Thu, 20 Oct 2011 14:59:38 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>