<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 11:42:42 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-2191/DDC-2191.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-2191] Bug in QueryBuilder::add() method, param $append has no effect for where/having DQL parts</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2191</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Now &lt;tt&gt;$append&lt;/tt&gt; param of &lt;tt&gt;QueryBuilder::add()&lt;/tt&gt; method has no effect for &lt;tt&gt;where&lt;/tt&gt; and &lt;tt&gt;having&lt;/tt&gt; parts.&lt;/p&gt;

&lt;p&gt;In example:&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-none&quot;&gt;
$query-&amp;gt;add(&apos;where&apos;, &apos;u.some = ?1&apos;);
$query-&amp;gt;add(&apos;where&apos;, &apos;u.other = ?2&apos;, true);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;will result in the loss of condition &lt;tt&gt;u.some = ?1&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Explanation in code&lt;/b&gt;&lt;br/&gt;
&lt;b&gt;526&lt;/b&gt; line of &lt;tt&gt;Doctrine/ORM/QueryBuilder.php&lt;/tt&gt;, part of body &lt;tt&gt;add()&lt;/tt&gt; method:&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-none&quot;&gt;
if ($append &amp;amp;&amp;amp; $isMultiple) {
    if (is_array($dqlPart)) {
        $key = key($dqlPart);
        $this-&amp;gt;_dqlParts[$dqlPartName][$key][] = $dqlPart[$key];
    } else {
        $this-&amp;gt;_dqlParts[$dqlPartName][] = $dqlPart;
    }
} else {
    $this-&amp;gt;_dqlParts[$dqlPartName] = ($isMultiple) ? array($dqlPart) : $dqlPart;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;According to the code above &lt;tt&gt;$append&lt;/tt&gt; parameter is checked in conjunction with &lt;tt&gt;$isMultiple&lt;/tt&gt; variable, which is:&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-none&quot;&gt;
$isMultiple = is_array($this-&amp;gt;_dqlParts[$dqlPartName]);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;But in &lt;b&gt;56&lt;/b&gt; line of this file, class property &lt;tt&gt;&amp;#95;dqlParts&lt;/tt&gt; keys &lt;tt&gt;where&lt;/tt&gt; and &lt;tt&gt;having&lt;/tt&gt; are equal &lt;em&gt;null&lt;/em&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-none&quot;&gt;
private $_dqlParts = array(
    &apos;distinct&apos; =&amp;gt; false,
    &apos;select&apos;  =&amp;gt; array(),
    &apos;from&apos;    =&amp;gt; array(),
    &apos;join&apos;    =&amp;gt; array(),
    &apos;set&apos;     =&amp;gt; array(),
    &apos;where&apos;   =&amp;gt; null,
    &apos;groupBy&apos; =&amp;gt; array(),
    &apos;having&apos;  =&amp;gt; null,
    &apos;orderBy&apos; =&amp;gt; array()
);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;As a result, for the parts &lt;tt&gt;where&lt;/tt&gt; and &lt;tt&gt;having&lt;/tt&gt; condition &lt;b&gt;$append &amp;amp;&amp;amp; $isMultiple&lt;/b&gt; will never be true, regardless of &lt;tt&gt;$append&lt;/tt&gt; value.&lt;/p&gt;

&lt;p&gt;I can offer a patch on Github to fix this bug, if necessary.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14298">DDC-2191</key>
            <summary>Bug in QueryBuilder::add() method, param $append has no effect for where/having DQL parts</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="1">Fixed</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="relo_san">Mykola Zyk</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Dec 2012 20:13:48 +0000</created>
                <updated>Sun, 6 Jan 2013 09:37:25 +0000</updated>
                    <resolved>Sun, 6 Jan 2013 09:37:25 +0000</resolved>
                            <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19224" author="beberlei" created="Sun, 6 Jan 2013 09:37:25 +0000"  >&lt;p&gt;This was and will never be allowed, i introduced an exception to show a way out, you need to look at QueryBuilder#andWhere for example to see a solution to append to where clauses.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>