<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Mon May 20 06:58:54 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/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+DC+AND+fixVersion+%3D+%221.2.0-RC1%22&tempMax=1000&field=key&field=summary
-->
<!-- If you wish to do custom client-side styling of RSS, uncomment this:
<?xml-stylesheet href="http://www.doctrine-project.org/jira/styles/jiraxml2html.xsl" type="text/xsl"?>
-->
<rss version="0.92">
    <channel>
        <title>Doctrine Project</title>
        <link>http://www.doctrine-project.org/jira/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=project+%3D+DC+AND+fixVersion+%3D+%221.2.0-RC1%22</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="30" total="30"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DC-279] Code Corrections For MsSql modifyLimitQuery</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-279</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Below are some code corrections for the modifyLimitQuery. These fixes should also fix &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-37&quot; title=&quot;Performing JOIN and ORDERBY and using the PAGER in MSSQL results in bad query&quot;&gt;&lt;del&gt;DC-37&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code details:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Fixed case on sorting orders to match all other syntax.&lt;/li&gt;
	&lt;li&gt;Added additional explode to ensure we only get fieldname and not tablename.fieldname.&lt;/li&gt;
	&lt;li&gt;Added code to determine primary key for use in select statement. There may be a better way of doing this, but not with the input sent to the function I don&apos;t think.&lt;/li&gt;
	&lt;li&gt;Removed the outer table (not sure how this could have ever worked) and switched inner table to return only primary key and not all fields.&lt;/li&gt;
	&lt;li&gt;Removed outer table order by logic.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Diff - Old To New:&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;160c160
&amp;lt;                     $sorts[$i] = (stripos($orders[$i], &apos; desc&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) ? &apos;desc&apos; : &apos;asc&apos;;
---
&amp;gt;                     $sorts[$i] = (stripos($orders[$i], &apos; desc&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) ? &apos;DESC&apos; : &apos;ASC&apos;;
171a172
&amp;gt;                     $aux2 = explode(&apos;.&apos;, end($aux2));
185a187,191
&amp;gt;             $fields_string = substr($query, strlen($selectReplace), strpos($query, &apos; FROM &apos;) - strlen($selectReplace));
&amp;gt;             $field_array = explode(&apos;,&apos;, $fields_string);
&amp;gt;             $aux2 = explode(&apos;.&apos;, $field_array[0]);
&amp;gt;             $key_field = trim(end($aux2));
&amp;gt; 
187c193
&amp;lt;             $query = &apos;SELECT * FROM (SELECT TOP &apos; . $count . &apos; * FROM (&apos; . $query . &apos;) AS &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;);
---
&amp;gt;             $query = &apos;SELECT TOP &apos; . $count . &apos; &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;) . &apos;.&apos; . $key_field . &apos; FROM (&apos; . $query . &apos;) AS &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;);
199,212d204
&amp;lt;                 }
&amp;lt;             }
&amp;lt; 
&amp;lt;             $query .= &apos;) AS &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;outer_tbl&apos;);
&amp;lt; 
&amp;lt;             &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderby !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
&amp;lt;                 $query .= &apos; ORDER BY &apos;; 
&amp;lt; 
&amp;lt;                 &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ($i = 0, $l = count($orders); $i &amp;lt; $l; $i++) { 
&amp;lt;                     &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($i &amp;gt; 0) { &lt;span class=&quot;code-comment&quot;&gt;// not first order clause 
&lt;/span&gt;&amp;lt;                         $query .= &apos;, &apos;; 
&amp;lt;                     } 
&amp;lt; 
&amp;lt;                     $query .= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;outer_tbl&apos;) . &apos;.&apos; . $aliases[$i] . &apos; &apos; . $sorts[$i];
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Entire New Function:&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;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function modifyLimitQuery($query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($limit &amp;gt; 0) {
            $count = intval($limit);
            $offset = intval($offset);

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset &amp;lt; 0) {
                &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Connection_Exception(&lt;span class=&quot;code-quote&quot;&gt;&quot;LIMIT argument offset=$offset is not valid&quot;&lt;/span&gt;);
            }

            $orderby = stristr($query, &apos;ORDER BY&apos;);

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderby !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
                &lt;span class=&quot;code-comment&quot;&gt;// Ticket #1835: Fix &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ORDER BY alias
&lt;/span&gt;                &lt;span class=&quot;code-comment&quot;&gt;// Ticket #2050: Fix &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; multiple ORDER BY clause
&lt;/span&gt;                $order = str_ireplace(&apos;ORDER BY&apos;, &apos;&apos;, $orderby);
                $orders = explode(&apos;,&apos;, $order);

                &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ($i = 0; $i &amp;lt; count($orders); $i++) {
                    $sorts[$i] = (stripos($orders[$i], &apos; desc&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) ? &apos;DESC&apos; : &apos;ASC&apos;;
                    $orders[$i] = trim(preg_replace(&apos;/\s+(ASC|DESC)$/i&apos;, &apos;&apos;, $orders[$i]));

                    &lt;span class=&quot;code-comment&quot;&gt;// find alias in query string
&lt;/span&gt;                    $helper_string = stristr($query, $orders[$i]);

                    $from_clause_pos = strpos($helper_string, &apos; FROM &apos;);
                    $fields_string = substr($helper_string, 0, $from_clause_pos + 1);

                    $field_array = explode(&apos;,&apos;, $fields_string);
                    $field_array = array_shift($field_array);
                    $aux2 = spliti(&apos; as &apos;, $field_array);
                    $aux2 = explode(&apos;.&apos;, end($aux2));

                    $aliases[$i] = trim(end($aux2));
                }
            }

            &lt;span class=&quot;code-comment&quot;&gt;// Ticket #1259: Fix &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; limit-subquery in MSSQL
&lt;/span&gt;            $selectRegExp = &apos;SELECT\s+&apos;;
            $selectReplace = &apos;SELECT &apos;;

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (preg_match(&apos;/^SELECT(\s+)DISTINCT/i&apos;, $query)) {
                $selectRegExp .= &apos;DISTINCT\s+&apos;;
                $selectReplace .= &apos;DISTINCT &apos;;
            }

            $fields_string = substr($query, strlen($selectReplace), strpos($query, &apos; FROM &apos;) - strlen($selectReplace));
            $field_array = explode(&apos;,&apos;, $fields_string);
            $aux2 = explode(&apos;.&apos;, $field_array[0]);
            $key_field = trim(end($aux2));

            $query = preg_replace(&apos;/^&apos;.$selectRegExp.&apos;/i&apos;, $selectReplace . &apos;TOP &apos; . ($count + $offset) . &apos; &apos;, $query);
            $query = &apos;SELECT TOP &apos; . $count . &apos; &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;) . &apos;.&apos; . $key_field . &apos; FROM (&apos; . $query . &apos;) AS &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;);

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderby !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
                $query .= &apos; ORDER BY &apos;; 

                &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ($i = 0, $l = count($orders); $i &amp;lt; $l; $i++) { 
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($i &amp;gt; 0) { &lt;span class=&quot;code-comment&quot;&gt;// not first order clause 
&lt;/span&gt;                        $query .= &apos;, &apos;; 
                    } 

                    $query .= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;inner_tbl&apos;) . &apos;.&apos; . $aliases[$i] . &apos; &apos;; 
                    $query .= (stripos($sorts[$i], &apos;asc&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) ? &apos;DESC&apos; : &apos;ASC&apos;;
                }
            }
        }

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $query;
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="10493">DC-279</key>
            <summary>Code Corrections For MsSql modifyLimitQuery</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="gensisns">Michael Card</reporter>
                        <labels>
                    </labels>
                <created>Mon, 23 Nov 2009 19:09:21 +0000</created>
                <updated>Mon, 23 Nov 2009 23:25:38 +0000</updated>
                    <resolved>Mon, 23 Nov 2009 23:25:38 +0000</resolved>
                            <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10826" author="jwage" created="Mon, 23 Nov 2009 23:25:38 +0000"  >&lt;p&gt;Thanks for the ticket and changes to the function.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-276] HAVING does not parse column aliases</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-276</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;h4&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h4&gt;
&lt;p&gt;$query-&amp;gt;having(&apos;&amp;lt;aggregate_alias&amp;gt; &amp;lt;operator&amp;gt; &amp;lt;column_alias&amp;gt;&apos;). &lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;ExpectedSQL%3A&quot;&gt;&lt;/a&gt;Expected SQL:&lt;/h4&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;HAVING&lt;/span&gt; &amp;lt;internal_aggregate_alias&amp;gt; &amp;lt;operator&amp;gt; a&amp;lt;N&amp;gt;__&amp;lt;column_name&amp;gt;...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;ProducedSQL&quot;&gt;&lt;/a&gt;Produced SQL&lt;/h4&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;HAVING&lt;/span&gt; &amp;lt;internal_aggregate_alias&amp;gt; &amp;lt;operator&amp;gt; &amp;lt;column_alias&amp;gt; ... /* yes, the same &amp;lt;column_alias&amp;gt; as in -&amp;gt;&lt;span class=&quot;code-keyword&quot;&gt;having&lt;/span&gt;() call! */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ve prepared this &lt;a href=&quot;http://gist.github.com/240326&quot; class=&quot;external-link&quot;&gt;&quot;real-world example&quot;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please fix it someone since I&apos;m forced to invent weird workarounds to emulate this behaviour.&lt;/p&gt;

&lt;p&gt;Thanks in advance.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10489">DC-276</key>
            <summary>HAVING does not parse column aliases</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="develop7">Andrei Dziahel</reporter>
                        <labels>
                    </labels>
                <created>Sat, 21 Nov 2009 23:17:50 +0000</created>
                <updated>Fri, 8 Jan 2010 16:52:19 +0000</updated>
                    <resolved>Mon, 23 Nov 2009 22:27:34 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11355" author="thaberkern" created="Fri, 8 Jan 2010 16:39:34 +0000"  >&lt;p&gt;Doesn&apos;t work for me in Symfony 1.3.1, Doctrine 1.2.1&lt;/p&gt;

&lt;p&gt;using this DQL:&lt;/p&gt;

&lt;p&gt;Doctrine_Query::create()&lt;br/&gt;
                    -&amp;gt;select(&apos;COUNT(s.status) as cn MIN(s.status) as minstat&apos;)&lt;br/&gt;
                    -&amp;gt;from(&apos;LogisticOrder o&apos;)&lt;br/&gt;
                    -&amp;gt;innerJoin(&apos;o.Status os&apos;)&lt;br/&gt;
                    -&amp;gt;innerJoin(&apos;o.PickingRequests r&apos;)&lt;br/&gt;
                    -&amp;gt;innerJoin(&apos;r.Status s&apos;)&lt;br/&gt;
                    -&amp;gt;where(&apos;os.status=?&apos;, OrderStatusLog::$STATUS_PICKING)&lt;br/&gt;
                    -&amp;gt;groupBy(&apos;r.order_id&apos;)&lt;br/&gt;
                    -&amp;gt;having(&apos;minstat=? AND cn=1&apos;, array(512))&lt;br/&gt;
                    -&amp;gt;getSqlQuery();&lt;/p&gt;

&lt;p&gt;I get &lt;/p&gt;

&lt;p&gt;SELECT COUNT(s4.status) AS s4__0 FROM sd_logisticorder s INNER JOIN sd_order_status_log s2 ON s.status_id = s2.id INNER JOIN sd_picking_request s3 ON s.id = s3.order_id INNER JOIN sd_picking_request_status s4 ON s3.id = s4.request_id WHERE (s2.status = ?) GROUP BY s3.order_id HAVING (minstat=? AND cn=1 )&lt;/p&gt;</comment>
                    <comment id="11356" author="thaberkern" created="Fri, 8 Jan 2010 16:52:19 +0000"  >&lt;p&gt;Just to inform you: The problem is the missing space at the having operators&lt;/p&gt;

&lt;p&gt;Doesn&apos;t work:&lt;br/&gt;
-&amp;gt;having(&apos;minstat=? AND cn=1&apos;, array(512))&lt;/p&gt;

&lt;p&gt;Works:&lt;br/&gt;
-&amp;gt;having(&apos;minstat = ? AND cn = 1&apos;, array(512))&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-274] Doctrine_Parser_Yml: hardcoded require calls for sfYaml</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-274</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In Doctrine_Parser_Yml the requires calls to sfYaml are hardcoded:&lt;br/&gt;
if ( ! class_exists(&apos;sfYaml&apos;, false)) {&lt;br/&gt;
    require_once dirname(_&lt;em&gt;FILE&lt;/em&gt;_) . &apos;/../../vendor/sfYaml/sfYaml.php&apos;;&lt;br/&gt;
    require_once dirname(_&lt;em&gt;FILE&lt;/em&gt;_) . &apos;/../../vendor/sfYaml/sfYamlDumper.php&apos;;&lt;br/&gt;
    require_once dirname(_&lt;em&gt;FILE&lt;/em&gt;_) . &apos;/../../vendor/sfYaml/sfYamlInline.php&apos;;&lt;br/&gt;
    require_once dirname(_&lt;em&gt;FILE&lt;/em&gt;_) . &apos;/../../vendor/sfYaml/sfYamlParser.php&apos;;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;This causes issues when one has already included sfYaml elsewhere. Either one needs to include the code for sfYaml twice or one needs to always load sfYaml before Doctrine parses any yaml files.&lt;/p&gt;

&lt;p&gt;A better approach to handling the fact that sfYaml does not adhere to the standard naming convention is to do these require calls inside the autoloader, but only using &quot;include&quot; in order to allow a fallback autoloader to also be able to load the code.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10485">DC-274</key>
            <summary>Doctrine_Parser_Yml: hardcoded require calls for sfYaml</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="lsmith">Lukas Kahwe</reporter>
                        <labels>
                    </labels>
                <created>Sat, 21 Nov 2009 11:32:27 +0000</created>
                <updated>Mon, 23 Nov 2009 22:58:39 +0000</updated>
                    <resolved>Mon, 23 Nov 2009 22:58:39 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10824" author="jwage" created="Mon, 23 Nov 2009 22:58:39 +0000"  >&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-267] Strange behaviour with HYDRATE_ARRAY</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-267</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Some values of a join can be found in root component some in the relations - even for the same value&lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt; select (&apos;a.id, b.code, b.code as also_b_code&apos;)&lt;br/&gt;
-&amp;gt; from(&apos;Foo a&apos;)&lt;br/&gt;
-&amp;gt; innerJoin(&apos;a.Bar b&apos;)&lt;br/&gt;
-&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY);&lt;/p&gt;

&lt;p&gt;$res = $q-&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;id is primary key of table Foo and code is primary key of table Bar&lt;/p&gt;

&lt;p&gt;The result will contain id AND also_b_code as $res&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;id&amp;#39;&amp;#93;&lt;/span&gt; and $res&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;also_b_code&amp;#39;&amp;#93;&lt;/span&gt; but code is under $res&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;Bar&amp;#39;&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;code&amp;#39;&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Is there any way to get Doctrine::HYDRATE_ARRAY to work as under 1.1?&lt;/p&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10471">DC-267</key>
            <summary>Strange behaviour with HYDRATE_ARRAY</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Thu, 19 Nov 2009 18:36:35 +0000</created>
                <updated>Thu, 19 Nov 2009 19:30:32 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 19:30:32 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-266] I18n - PostgreSQL - translation table name </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-266</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Tables, which are translated, do not use table name from classes of tables with translations, but it seems that Doctrine just transforms&lt;br/&gt;
class name from camel case to underscore and appends translation. We use different class names, because of the problem with schemas described in&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-264&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-264&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Is it possible to fix this behavior - get table name from class?&lt;br/&gt;
Or at least write in documentation, that we can use atribute tableName in section I18n?&lt;/p&gt;</description>
                <environment>PostgreSQL</environment>
            <key id="10470">DC-266</key>
            <summary>I18n - PostgreSQL - translation table name </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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jakub.novotny">Jakub Novotny</reporter>
                        <labels>
                    </labels>
                <created>Thu, 19 Nov 2009 16:27:27 +0000</created>
                <updated>Thu, 19 Nov 2009 19:02:46 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 19:02:46 +0000</resolved>
                            <version>1.0.12</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>I18n</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-263] Incorrect type in PGSQL import.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-263</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;in &lt;a href=&quot;http://trac.doctrine-project.org/browser/branches/1.1/lib/Doctrine/Import/Pgsql.php&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/browser/branches/1.1/lib/Doctrine/Import/Pgsql.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;line 172 &lt;/p&gt;

&lt;p&gt;used if (strtolower($val&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;type&amp;#39;&amp;#93;&lt;/span&gt;) === &apos;varchar&apos;) {&lt;/p&gt;

&lt;p&gt;but in postgres varchar does not exist so you must compare with character varying like that :&lt;/p&gt;

&lt;p&gt;if (strtolower($val&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;type&amp;#39;&amp;#93;&lt;/span&gt;) === &apos;character varying&apos;) {&lt;/p&gt;</description>
                <environment>no matter</environment>
            <key id="10465">DC-263</key>
            <summary>Incorrect type in PGSQL import.</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tripollite">Pierre</reporter>
                        <labels>
                    </labels>
                <created>Thu, 19 Nov 2009 14:28:11 +0000</created>
                <updated>Thu, 19 Nov 2009 19:39:08 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 19:39:08 +0000</resolved>
                                            <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-261] Query overrwtires explicitly passed connection with bound one</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-261</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;&lt;tt&gt;Doctrine_Query::loadRoot()&lt;/tt&gt; and &lt;tt&gt;Doctrine_Query::buildInheritanceJoinSql()&lt;/tt&gt; have the following snippet of code:&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;span class=&quot;code-comment&quot;&gt;// get the connection &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the component
&lt;/span&gt;        $manager = Doctrine_Manager::getInstance();
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($manager-&amp;gt;hasConnectionForComponent($name)) {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_conn = $manager-&amp;gt;getConnectionForComponent($name);
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Seems clear that here we would like to use the connection bound to the given component instead of default one. But if we explicitly pass a connection in (like &lt;tt&gt;Doctrine_Query::create($conn)&lt;/tt&gt;), then this code will also overwrite it with bound connection, although passed connection should have higher priority than bound one.&lt;/p&gt;

&lt;p&gt;I would like to prepare a patch, but I&apos;m not absolutely sure, why we check for bound connection only inside &lt;tt&gt;loadRoot()&lt;/tt&gt; and &lt;tt&gt;buildInheritanceJoinSql()&lt;/tt&gt;?&lt;/p&gt;</description>
                <environment></environment>
            <key id="10460">DC-261</key>
            <summary>Query overrwtires explicitly passed connection with bound one</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="esycat">Eugene Janusov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 19 Nov 2009 05:41:21 +0000</created>
                <updated>Thu, 19 Nov 2009 19:51:20 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 19:51:20 +0000</resolved>
                            <version>1.2.0-ALPHA1</version>
                <version>1.2.0-ALPHA2</version>
                <version>1.2.0-ALPHA3</version>
                <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Connection</component>
                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-260] Improper translation of data types</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-260</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine translates the datatype integer to oracle datatype number.&lt;br/&gt;
Doctrine generates number(8) for id&apos;s, numer(4) for left/right values&lt;br/&gt;
in nested sets and number(2) for the level column in nested sets.&lt;/p&gt;

&lt;p&gt;This will result in corrupted trees or unexpected behavior if a tree&lt;br/&gt;
does contain more than 9.999 records or has more than 99 levels.&lt;/p&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10459">DC-260</key>
            <summary>Improper translation of data types</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 22:53:35 +0000</created>
                <updated>Mon, 23 Nov 2009 22:46:16 +0000</updated>
                    <resolved>Mon, 23 Nov 2009 22:46:16 +0000</resolved>
                            <version>1.0.13</version>
                <version>1.1.4</version>
                <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10788" author="jwage" created="Thu, 19 Nov 2009 19:53:44 +0000"  >&lt;p&gt;Should it just be using INTEGER instead of NUMBER? It seems INTEGER is an alias for NUMBER(38) ?&lt;/p&gt;</comment>
                    <comment id="10791" author="tom808" created="Thu, 19 Nov 2009 20:03:54 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;an 8 byte integer has a range from -9.223.372.036.854.775.808 to  9.223.372.036.854.775.807&lt;/p&gt;

&lt;p&gt;As far as i know there is no column type integer with oracle. I dont know if any database support unsigned 8 byte integer. NUMBER(20,0) would be the best substitution for INTEGER in my opinion.&lt;/p&gt;</comment>
                    <comment id="10793" author="jwage" created="Thu, 19 Nov 2009 20:12:51 +0000"  >&lt;p&gt;I read here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://ss64.com/ora/syntax-datatypes.html&quot; class=&quot;external-link&quot;&gt;http://ss64.com/ora/syntax-datatypes.html&lt;/a&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;INTEGER
This ANSI datatype will be accepted by Oracle - it is actually a synonym &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; NUMBER(38)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is code that maps integer to NUMBER currently. What do you think we should change this to?&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;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; &apos;&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;&apos;:
                $length = (!empty($field[&apos;length&apos;])) ? $field[&apos;length&apos;] : &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( $length &amp;amp;&amp;amp; $length &amp;lt;= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;number_max_precision)  {
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($length &amp;lt;= 1) {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(3)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// TINYINT
&lt;/span&gt;                    } elseif ($length == 2) {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(5)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// SMALLINT
&lt;/span&gt;                    } elseif ($length == 3) {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(8)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// MEDIUMINT
&lt;/span&gt;                    } elseif ($length == 4) {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(10)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// INTEGER
&lt;/span&gt;                    } elseif ($length &amp;lt;= 8) {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(20)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// BIGINT
&lt;/span&gt;                    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(&apos;.$length.&apos;)&apos;;
                    }
                }
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;INT&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="10794" author="tom808" created="Thu, 19 Nov 2009 20:30:24 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;never seen before but i works:&lt;/p&gt;

&lt;p&gt;CREATE TABLE Foo (Bar INTEGER);&lt;/p&gt;

&lt;p&gt;table created successfuly&lt;/p&gt;

&lt;p&gt;Displaying oracle sql statement for the table:&lt;/p&gt;

&lt;p&gt;CREATE TABLE  &quot;FOO&quot; &lt;br/&gt;
   (	&quot;BAR&quot; NUMBER(*,0)&lt;br/&gt;
   )&lt;br/&gt;
/&lt;/p&gt;

&lt;p&gt;If oracle says NUMBER(38,0) is the subtype of INTEGER and SMALLINT then i would use these subtypes.&lt;/p&gt;

&lt;p&gt;From oracle standard package:&lt;/p&gt;

&lt;p&gt;  type NUMBER is NUMBER_BASE;&lt;br/&gt;
  subtype FLOAT is NUMBER; &amp;#8211; NUMBER(126)&lt;br/&gt;
  subtype REAL is FLOAT; &amp;#8211; FLOAT(63)&lt;br/&gt;
  subtype &quot;DOUBLE PRECISION&quot; is FLOAT;&lt;br/&gt;
  subtype INTEGER is NUMBER(38,0);&lt;br/&gt;
  subtype INT is INTEGER;&lt;br/&gt;
  subtype SMALLINT is NUMBER(38,0);&lt;br/&gt;
  subtype DECIMAL is NUMBER(38,0);&lt;br/&gt;
  subtype NUMERIC is DECIMAL;&lt;br/&gt;
  subtype DEC is DECIMAL;&lt;/p&gt;

&lt;p&gt;  subtype BINARY_INTEGER is INTEGER range &apos;-2147483647&apos;..2147483647;&lt;br/&gt;
  subtype NATURAL is BINARY_INTEGER range 0..2147483647;&lt;br/&gt;
  subtype NATURALN is NATURAL not null;&lt;br/&gt;
  subtype POSITIVE is BINARY_INTEGER range 1..2147483647;&lt;br/&gt;
  subtype POSITIVEN is POSITIVE not null;&lt;br/&gt;
  subtype SIGNTYPE is BINARY_INTEGER range &apos;-1&apos;..1;&lt;/p&gt;</comment>
                    <comment id="10795" author="jwage" created="Thu, 19 Nov 2009 20:38:50 +0000"  >&lt;p&gt;Can you help me out with the code &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; In Doctrine_DataDict_Oracle::getNativeDeclaration(), can you help me come up with are the best native types to translate the portable Doctrine types to.&lt;/p&gt;</comment>
                    <comment id="10799" author="tom808" created="Thu, 19 Nov 2009 21:11:16 +0000"  > &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;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; &apos;integer&apos;:
&lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; &apos;&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;&apos;:
	$length = (!empty($field[&apos;length&apos;])) ? $field[&apos;length&apos;] : &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( $length &amp;amp;&amp;amp; $length &amp;lt;= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;number_max_precision)  {
		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($length &amp;lt;= 1) {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(3)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// TINYINT, unsigned max. 256
&lt;/span&gt;		} elseif ($length == 2) {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(5)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// SMALLINT, unsigend max. 65.536
&lt;/span&gt;		} elseif ($length == 3) {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(8)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// MEDIUMINT, unsigned max. 16.777.216
&lt;/span&gt;		} elseif ($length == 4) {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(10)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// INTEGER, unsigend max. 4.294.967.296
&lt;/span&gt;		} elseif ($length &amp;lt;= 8) {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;NUMBER(20)&apos;; &lt;span class=&quot;code-comment&quot;&gt;// BIGINT, unsigend max. 18.446.744.073.709.551.616
&lt;/span&gt;		} &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;INTEGER&apos;;
		}
	}
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;INTEGER&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="10823" author="jwage" created="Mon, 23 Nov 2009 22:46:16 +0000"  >&lt;p&gt;Thanks! &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-257] Missing identifier quoting in Doctrine_Connection_Oracle</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-257</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If identifier quoting is enabled doctrine does not perform quoting in some subqueries.&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;quoteIdentifier has to be added as below in Doctrine_Connection_Oracle oracle.php at line 106&lt;/p&gt;

&lt;p&gt;                    $query = &apos;SELECT &apos; . $this-&amp;gt;quoteIdentifier(&apos;b&apos;) . &apos;.&apos; .$column. &apos; FROM (&apos;.&lt;br/&gt;
                                 &apos;SELECT a.*, ROWNUM AS doctrine_rownum FROM (&apos;&lt;br/&gt;
                                   . $query . &apos;) a &apos;.&lt;br/&gt;
                              &apos;) &apos; . $this-&amp;gt;quoteIdentifier(&apos;b&apos;) .&apos; &apos;.&lt;br/&gt;
                              &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;&lt;/p&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10456">DC-257</key>
            <summary>Missing identifier quoting in Doctrine_Connection_Oracle</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 21:28:47 +0000</created>
                <updated>Wed, 18 Nov 2009 21:38:54 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 21:38:54 +0000</resolved>
                            <version>1.0.12</version>
                <version>1.0.13</version>
                <version>1.1.4</version>
                <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-256] Identifier Quoting not made in generated subquery</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-256</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If identifier quoting is enabled doctrine does not perform quoting in some subqueries.&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;_conn-&amp;gt;quoteIdentifier has to be added twice as below in query.php line 1426:&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;$subquery = &apos;SELECT doctrine_subquery_alias.&apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_conn-&amp;gt;quoteIdentifier($table-&amp;gt;getColumnName($table-&amp;gt;getIdentifier()))

    . &apos; FROM (&apos; . $subquery . &apos;) doctrine_subquery_alias&apos;
    . &apos; GROUP BY doctrine_subquery_alias.&apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_conn-&amp;gt;quoteIdentifier($table-&amp;gt;getColumnName($table-&amp;gt;getIdentifier()))
    . &apos; ORDER BY MIN(ROWNUM)&apos;; 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10455">DC-256</key>
            <summary>Identifier Quoting not made in generated subquery</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 21:23:05 +0000</created>
                <updated>Thu, 19 Nov 2009 20:00:35 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 20:00:35 +0000</resolved>
                            <version>1.0.12</version>
                <version>1.1.4</version>
                <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10784" author="tom808" created="Thu, 19 Nov 2009 18:22:48 +0000"  >&lt;p&gt;In 1.2 Beta 3 the quoting is not fixed&lt;/p&gt;

&lt;p&gt;Identifier Quoting need to be done in Doctrine_Query line 1462 and line 1464 to $table-&amp;gt;getColumnName($table-&amp;gt;getIdentifier&lt;/p&gt;

&lt;p&gt;            $subquery = &apos;SELECT doctrine_subquery_alias.&apos; . $table-&amp;gt;getColumnName($table-&amp;gt;getIdentifier())&lt;br/&gt;
                    . &apos; FROM (&apos; . $subquery . &apos;) doctrine_subquery_alias&apos;&lt;br/&gt;
                    . &apos; GROUP BY doctrine_subquery_alias.&apos; . $table-&amp;gt;getColumnName($table-&amp;gt;getIdentifier())&lt;br/&gt;
                    . &apos; ORDER BY MIN(ROWNUM)&apos;;&lt;/p&gt;

&lt;p&gt;The above code creates incorrect statements if identifier quoting is enabled&lt;/p&gt;</comment>
                    <comment id="10790" author="jwage" created="Thu, 19 Nov 2009 20:00:35 +0000"  >&lt;p&gt;This is fixed in SVN and will be in 1.2.0-RC1&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-255] XML Export not in UTF-8</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-255</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I&apos;m testing doctrine 1.2.0-B3 connected to mssql 2000 for XML based exports.&lt;/p&gt;

&lt;p&gt;We use latin1 (ISO-8859-1) as collation for the mssql server. When i now create an XML export in Doctrine, Doctrine uses SimpleXML which requires the strings encoded in UTF-8, but our mssql collation is latin1. This results in a invalid, non UTF-8 XML file.&lt;br/&gt;
It&apos;s required to add the ability to convert the strings from the database encoding to the &apos;export&apos; encoding.&lt;br/&gt;
(similar to &lt;a href=&quot;http://trac.doctrine-project.org/ticket/1887&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/ticket/1887&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I have added a simple patch to add this possibility, then we can do something 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-java&quot;&gt;Doctrine_Parser::dump($data-&amp;gt;toArray(&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;), &apos;xml&apos;, &apos;testExport.xml&apos;, &apos;ISO-8859-1&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>W2003 Server&lt;br/&gt;
MSSQL 2000 (Collation: Latin1_General_CI_AS)&lt;br/&gt;
PHP 5.2.5 (cli) (built: Nov  8 2007 23:18:51)&lt;br/&gt;
Copyright (c) 1997-2007 The PHP Group&lt;br/&gt;
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies</environment>
            <key id="10453">DC-255</key>
            <summary>XML Export not in UTF-8</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="benno">Benno</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 16:46:36 +0000</created>
                <updated>Thu, 19 Nov 2009 19:58:11 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 19:58:11 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10769" author="benno" created="Thu, 19 Nov 2009 11:07:41 +0000"  >&lt;p&gt;Because arrayToXml is a recursive method, add the encoding parameter to the recursive method call.&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;81c81
&amp;lt;                 self::arrayToXml($value, $rootNodeName, $node, $charset);
---
&amp;gt;                 self::arrayToXml($value, $rootNodeName, $node);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I think the use of htmlentities is not recommended, because the method doesn&apos;t create XML compliant strings.&lt;/p&gt;

&lt;p&gt;If you want to use the function, use it with encoding.&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;$value = htmlentities($value, ENT_COMPAT, &apos;UTF-8&apos;);
OR
$value = htmlspecialchars($value, ENT_COMPAT, &apos;UTF-8&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="10789" author="jwage" created="Thu, 19 Nov 2009 19:58:11 +0000"  >&lt;p&gt;Thanks for letting me know I missed that &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10171" name="parser_encoding_parser.diff" size="612" author="benno" created="Wed, 18 Nov 2009 16:46:36 +0000" />
                    <attachment id="10170" name="parser_encoding_xml.diff" size="645" author="benno" created="Wed, 18 Nov 2009 16:46:36 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-254] getLimitSubquery Not Including All Order By Parts</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-254</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The getLimitSubquery function is only including the first orderby field and ignoring all remaining parts. The function also needs to be changed to include mssql and odbc.&lt;/p&gt;

&lt;p&gt;The diff&apos;s below provide corrections.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;Mike&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;diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
1367c1367
&amp;lt;         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($driverName == &apos;pgsql&apos; || $driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos;) {
---
&amp;gt;         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($driverName == &apos;pgsql&apos; || $driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos; || $driverName == &apos;mssql&apos; || $driverName == &apos;odbc&apos;) {
1371,1387c1371,1392
&amp;lt;                 $part_original = trim($e[0]);
&amp;lt;                 $callback = create_function(&apos;$e&apos;, &apos;&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; trim($e, \&apos;[]`&quot;\&apos;);&apos;);
&amp;lt;                 $part = trim(implode(&apos;.&apos;, array_map($callback, explode(&apos;.&apos;, $part_original))));
&amp;lt; 
&amp;lt;                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (strpos($part, &apos;.&apos;) === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
&amp;lt;                     &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&amp;lt;                 }
&amp;lt; 
&amp;lt;                 &lt;span class=&quot;code-comment&quot;&gt;// don&apos;t add functions
&lt;/span&gt;&amp;lt;                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (strpos($part, &apos;(&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
&amp;lt;                     &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&amp;lt;                 }
&amp;lt; 
&amp;lt;                 &lt;span class=&quot;code-comment&quot;&gt;// don&apos;t add primarykey column (its already in the select clause)
&lt;/span&gt;&amp;lt;                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($part !== $primaryKey) {
&amp;lt;                     $subquery .= &apos;, &apos; . $part_original;
&amp;lt;                 }
---
&amp;gt; 
&amp;gt;                 foreach ($e as $f) {
&amp;gt;                     &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($f == 0 || $f % 2 == 0) {
&amp;gt;                         $part_original = trim($f);
&amp;gt;                         $callback = create_function(&apos;$e&apos;, &apos;&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; trim($e, \&apos;[]`&quot;\&apos;);&apos;);
&amp;gt;                         $part = trim(implode(&apos;.&apos;, array_map($callback, explode(&apos;.&apos;, $part_original))));
&amp;gt; 
&amp;gt;                         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (strpos($part, &apos;.&apos;) === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
&amp;gt;                             &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&amp;gt;                         }
&amp;gt; 
&amp;gt;                         &lt;span class=&quot;code-comment&quot;&gt;// don&apos;t add functions
&lt;/span&gt;&amp;gt;                         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (strpos($part, &apos;(&apos;) !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
&amp;gt;                             &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&amp;gt;                         }
&amp;gt; 
&amp;gt;                         &lt;span class=&quot;code-comment&quot;&gt;// don&apos;t add primarykey column (its already in the select clause)
&lt;/span&gt;&amp;gt;                         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($part !== $primaryKey) {
&amp;gt;                             $subquery .= &apos;, &apos; . $part_original;
&amp;gt;                         }
&amp;gt;                     }
&amp;gt;                 }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="10450">DC-254</key>
            <summary>getLimitSubquery Not Including All Order By 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="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="gensisns">Michael Card</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 15:58:12 +0000</created>
                <updated>Sun, 27 Feb 2011 18:39:08 +0000</updated>
                                    <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11276" author="gensisns" created="Tue, 22 Dec 2009 20:41:01 +0000"  >&lt;p&gt;Additonal fix for this issue, was missing dblib originally.&lt;/p&gt;

&lt;p&gt;Mike&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;
diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
1367c1367
&amp;lt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($driverName == &apos;pgsql&apos; || $driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos; || $driverName == &apos;mssql&apos; || $driverName == &apos;odbc&apos;) {
&#8212;
&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($driverName == &apos;pgsql&apos; || $driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos; || $driverName == &apos;mssql&apos; || $driverName == &apos;odbc&apos; || $driverName == &apos;dblib&apos;) {

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="15403" author="andrej.pavlovic" created="Sun, 27 Feb 2011 18:39:08 +0000"  >&lt;p&gt;Come on guys, please include this fix into 1.2.4...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-253] Missing Data Types In DataDict For MsSql</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-253</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;There are some missing data types in the getPortableDeclaration function for MsSql. The following diff adds the types I found missing so far.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Mike&lt;/p&gt;

&lt;p&gt;diff -r doctrine\lib\Doctrine\DataDict\Mssql.php Doctrine-1.1.2\lib\Doctrine\DataDict\Mssql.php&lt;br/&gt;
193,202d192&lt;br/&gt;
&amp;lt;             case &apos;uniqueidentifier&apos;:&lt;br/&gt;
&amp;lt;                 $type[] = &apos;string&apos;;&lt;br/&gt;
&amp;lt;                 $length = 36;&lt;br/&gt;
&amp;lt;             break;&lt;br/&gt;
&amp;lt;             case &apos;sql_variant&apos;:&lt;br/&gt;
&amp;lt;             case &apos;sysname&apos;:&lt;br/&gt;
&amp;lt;             case &apos;binary&apos;:&lt;br/&gt;
&amp;lt;                 $type[] = &apos;string&apos;;&lt;br/&gt;
&amp;lt;                 $length = null;&lt;br/&gt;
&amp;lt;             break;&lt;/p&gt;</description>
                <environment></environment>
            <key id="10447">DC-253</key>
            <summary>Missing Data Types In DataDict For MsSql</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="gensisns">Michael Card</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 15:40:33 +0000</created>
                <updated>Wed, 18 Nov 2009 17:24:36 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 17:24:36 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-252] Doctrine ignores UNIQUE:true on int</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-252</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Consider this schema.yml:&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;Orden:
  tableName: ordenes    
  options:
    type: InnoDB  
  columns:
    id:
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      type: integer(4)
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    numero: 
      type: integer(4)
      unique: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;sql:&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;CREATE TABLE ordenes (id INT AUTO_INCREMENT, numero INT, PRIMARY KEY(id)) COLLATE utf8_unicode_ci ENGINE = InnoDB; 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;unique constraint don&apos;t appear.&lt;/p&gt;</description>
                <environment>Gentoo 2.6.21.5, PHP Version 5.2.8</environment>
            <key id="10446">DC-252</key>
            <summary>Doctrine ignores UNIQUE:true on int</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="imefisto">Ignacio El Kadre</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 14:45:13 +0000</created>
                <updated>Wed, 18 Nov 2009 17:25:05 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 17:25:05 +0000</resolved>
                            <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10734" author="imefisto" created="Wed, 18 Nov 2009 14:46:24 +0000"  >&lt;p&gt;spliting problem and solution&lt;/p&gt;</comment>
                    <comment id="10735" author="imefisto" created="Wed, 18 Nov 2009 14:46:44 +0000"  >&lt;p&gt;Editing Doctrine/DataDict/Mysql.php, getIntegerDeclaration method, adding:&lt;/p&gt;

&lt;p&gt;$unique = (isset($field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;unique&amp;#39;&amp;#93;&lt;/span&gt;)  &amp;amp;&amp;amp; $field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;unique&amp;#39;&amp;#93;&lt;/span&gt;)  ? &apos; UNIQUE&apos; : &apos;&apos;; //line 490&lt;/p&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;return $name . &apos; &apos; . $this-&amp;gt;getNativeDeclaration($field) . $unsigned &lt;br/&gt;
            . $default . $unique . $notnull . $autoinc . $comment; //adding unique field&lt;/p&gt;

&lt;p&gt;the problem was solved.&lt;/p&gt;

&lt;p&gt;Sorry by my english and sorry if this post is in wrong place.&lt;br/&gt;
Cheers&lt;br/&gt;
Ignacio&lt;/p&gt;</comment>
                    <comment id="10738" author="imefisto" created="Wed, 18 Nov 2009 17:21:26 +0000"  >&lt;p&gt;Don&apos;t forget add $unique to return sentence:&lt;/p&gt;

&lt;p&gt;return $name . &apos; &apos; . $this-&amp;gt;getNativeDeclaration($field) . $unsigned &lt;br/&gt;
            . $default . $unique . $notnull . $autoinc . $comment;&lt;/p&gt;
</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-249] Doctrine_Manager::closeConnection() always changes current connection</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-249</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;&lt;tt&gt;Doctrine_Manager::closeConnection()&lt;/tt&gt; should try to change current connection only if the just closed one was the current connection.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10442">DC-249</key>
            <summary>Doctrine_Manager::closeConnection() always changes current connection</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="esycat">Eugene Janusov</reporter>
                        <labels>
                    </labels>
                <created>Wed, 18 Nov 2009 04:51:43 +0000</created>
                <updated>Wed, 18 Nov 2009 20:36:27 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 20:36:27 +0000</resolved>
                            <version>1.2.0-ALPHA1</version>
                <version>1.2.0-ALPHA2</version>
                <version>1.2.0-ALPHA3</version>
                <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10730" author="esycat" created="Wed, 18 Nov 2009 04:55:54 +0000"  >&lt;p&gt;Proposed patch attached.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10169" name="DC-249.patch" size="820" author="esycat" created="Wed, 18 Nov 2009 04:55:54 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-245] Table name prefix for table migration_version</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-245</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The doctrine migration class sets a default table name for storing its version information, which bypasses any formatting rules, e.g. a table name prefix. Calling the function setTableName() does apply the format defined, but one cannot call _createMigrationTable() afterwards. This results in a situation, where on one hand I can have the table automatically created with the &quot;wrong&quot; name and on the other hand have the class use the correct table name but not create it at first.&lt;/p&gt;

&lt;p&gt;The attached patch is a simple solution to this dilemma, it added a call from the contructor to set the table name by the function call.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10437">DC-245</key>
            <summary>Table name prefix for table migration_version</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="eman">Erik Wegner</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 10:55:44 +0000</created>
                <updated>Fri, 28 May 2010 06:19:49 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 20:09:46 +0000</resolved>
                            <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Migrations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10719" author="jwage" created="Tue, 17 Nov 2009 20:09:46 +0000"  >&lt;p&gt;This is fixed properly in Doctrine 1.2&lt;/p&gt;</comment>
                    <comment id="13076" author="eman" created="Fri, 28 May 2010 06:19:49 +0000"  >&lt;p&gt;For Doctrine 1.2 see &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-383&quot; title=&quot;Migrations not respecting ATTR_TBLNAME_FORMAT&quot;&gt;DC-383&lt;/a&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10168" name="migration_table_prefix.patch" size="393" author="eman" created="Tue, 17 Nov 2009 10:55:44 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-244] Missing savepoint methods on Doctrine_EventListener_Chain</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-244</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;A couple of methods are missing to use savepoint argument in transaction methods from Doctrine_Transaction object.&lt;/p&gt;

&lt;p&gt;If you want to process the bug, start a transaction, start a savepoint, and you will see a fatal error.&lt;/p&gt;

&lt;p&gt;Below, you will find a piece of code with missing methods to add to Doctrine_EventListener_Chain class:&lt;/p&gt;

&lt;p&gt;    // @edit: Missing methods &amp;#8211; loops&lt;br/&gt;
    // @start&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; postSavepointCommit&lt;br/&gt;
     &amp;#42; an event invoked after a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; is committed&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function postSavepointCommit(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;postSavepointCommit($event);
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; preSavepointCommit&lt;br/&gt;
     &amp;#42; an event invoked before a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; is committed&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function preSavepointCommit(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;preSavepointCommit($event);
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; postSavepointRollback&lt;br/&gt;
     &amp;#42; an event invoked after a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; is being rolled back&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function postSavepointRollback(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;postSavepointRollback($event);
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; preSavepointRollback&lt;br/&gt;
     &amp;#42; an event invoked before a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; is being rolled back&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function preSavepointRollback(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;preSavepointRollback($event);
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; postSavepointCreate&lt;br/&gt;
     &amp;#42; an event invoked after a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; has been started&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function postSavepointCreate(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;postSavepointCreate($event);
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    /**&lt;br/&gt;
     &amp;#42; preSavepointCreate&lt;br/&gt;
     &amp;#42; an event invoked before a Doctrine_Connection transaction with savepoint&lt;br/&gt;
     &amp;#42; is being started&lt;br/&gt;
     &amp;#42;&lt;br/&gt;
     &amp;#42; @param Doctrine_Event $event&lt;br/&gt;
     &amp;#42; @return void&lt;br/&gt;
     &amp;#42;/&lt;br/&gt;
    public function preSavepointCreate(Doctrine_Event $event)&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;_listeners as $listener) &lt;/p&gt;
{
            $listener-&amp;gt;preSavepointCreate($event);
        }
&lt;p&gt;    }&lt;br/&gt;
    // @end&lt;/p&gt;


&lt;p&gt;Please update.&lt;/p&gt;

&lt;p&gt;Loops&lt;/p&gt;</description>
                <environment>symfony 1.4</environment>
            <key id="10436">DC-244</key>
            <summary>Missing savepoint methods on Doctrine_EventListener_Chain</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="loops">Pierrot Evrard</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 10:03:16 +0000</created>
                <updated>Tue, 17 Nov 2009 20:12:58 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 20:12:58 +0000</resolved>
                            <version>1.2.0-BETA2</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10720" author="jwage" created="Tue, 17 Nov 2009 20:12:58 +0000"  >&lt;p&gt;Thanks for the ticket and patch. It is fixed in Doctrine 1.2 in svn now.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10167" name="Chain.php" size="13591" author="loops" created="Tue, 17 Nov 2009 10:03:16 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-243] Passing $options to Doctrine_Core::generateModelsFromDb() From Doctrine_Cli()</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-243</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Here the issue when I create models from existing database.&lt;br/&gt;
I use doctrine-cli to do that, and make some configuration like this&lt;/p&gt;

&lt;p&gt;Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;connection_string&amp;#93;&lt;/span&gt; =&amp;gt; mysql://user:password@localhost/db&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;data_fixtures_path&amp;#93;&lt;/span&gt; =&amp;gt; /data/fixtures/path&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;models_path&amp;#93;&lt;/span&gt; =&amp;gt; /models/path&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;migrations_path&amp;#93;&lt;/span&gt; =&amp;gt; /migrations/path&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;sql_path&amp;#93;&lt;/span&gt; =&amp;gt; /sql/path&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;yaml_schema_path&amp;#93;&lt;/span&gt; =&amp;gt; /yaml/schema/path&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;generate_models_options&amp;#93;&lt;/span&gt; =&amp;gt; Array&lt;br/&gt;
        (&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;generateBaseClasses&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;classPrefixFiles&amp;#93;&lt;/span&gt; =&amp;gt; Model&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;classPrefix&amp;#93;&lt;/span&gt; =&amp;gt; Model&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;baseClassPrefix&amp;#93;&lt;/span&gt; =&amp;gt; Base_&lt;br/&gt;
        )&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;But, when I run the command with like this&lt;br/&gt;
php doctrine-cli.php generate-models-db&lt;/p&gt;

&lt;p&gt;All models is created, but not follow the configuration.&lt;br/&gt;
I have look the code and find the real problem is options argument didn&apos;t pass when call Doctrine_Core::generateModelsFromDb()&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;Dolly&lt;/p&gt;</description>
                <environment>Doctrine 1.2-BETA2</environment>
            <key id="10434">DC-243</key>
            <summary>Passing $options to Doctrine_Core::generateModelsFromDb() From Doctrine_Cli()</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dollyaswin">Dolly Aswin Harahap</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 03:58:06 +0000</created>
                <updated>Tue, 17 Nov 2009 20:19:02 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 20:19:02 +0000</resolved>
                            <version>1.2.0-BETA2</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Cli</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10699" author="dollyaswin" created="Tue, 17 Nov 2009 04:09:15 +0000"  >&lt;p&gt;Here I attach a patch for this issue. This patch is created from branches 1.2&lt;br/&gt;
Please check the patch.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10164" name="DC-243.patch" size="788" author="dollyaswin" created="Tue, 17 Nov 2009 04:09:15 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-242] Linking (re-linking) o/m2m relations with array of ids in Doctrine_Record fromArray stopped working</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-242</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&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;class User &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;username&apos;, &apos;string&apos;, 64, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;password&apos;, &apos;string&apos;, 128, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Role as Roles&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_user&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_role&apos;, &apos;refClass&apos; =&amp;gt; &apos;UserRole&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;actAs(&apos;SoftDelete&apos;);
	}
}

class Role &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;name&apos;, &apos;string&apos;, 64);
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;User as Users&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_user&apos;, &apos;refClass&apos; =&amp;gt; &apos;UserRole&apos;));
	}
}

class UserRole &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_user&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_role&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;User&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_user&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Role&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
	}
}


$role = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Role();
$role-&amp;gt;name = &apos;publisher&apos;;
$role-&amp;gt;save();

$role = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Role();
$role-&amp;gt;name = &apos;reviewer&apos;;
$role-&amp;gt;save();

$role = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Role();
$role-&amp;gt;name = &apos;mod&apos;;
$role-&amp;gt;save();

$user = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
$user-&amp;gt;fromArray(array(
	&apos;username&apos; =&amp;gt; &apos;test&apos;,
	&apos;password&apos; =&amp;gt; &apos;test&apos;,
	&apos;Roles&apos; =&amp;gt; array(1, 2, 3),
));
$user-&amp;gt;save();

&lt;span class=&quot;code-comment&quot;&gt;//--------------------- here goes the failure
&lt;/span&gt;$user-&amp;gt;fromArray(array(
	&apos;Roles&apos; =&amp;gt; array(1, 3),
));
$user-&amp;gt;save();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After a User is saved once with some roles, it cannot be saved here with another combination of roles, consisting of some roles which was saved to the User before.&lt;br/&gt;
In short, -&amp;gt;unlink() in fromArray method does not schedule a deletion of old relations before adding new ones on save, like it was in previous versions of Doctrine.&lt;br/&gt;
Hence the primary key constraint is violated and the exception is thrown:&lt;/p&gt;

&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;2-1&apos; for key 1&lt;br/&gt;
#0 D:\projekty\cms-trunk\cms\library\Doctrine\Doctrine\Connection\Statement.php(269): Doctrine_Connection-&amp;gt;rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement))&lt;br/&gt;
#1 (...)\library\Doctrine\Doctrine\Connection.php(1032): Doctrine_Connection_Statement-&amp;gt;execute(Array)&lt;br/&gt;
#2 (...)\library\Doctrine\Doctrine\Connection.php(677): Doctrine_Connection-&amp;gt;exec(&apos;INSERT INTO `us...&apos;, Array)&lt;br/&gt;
#3 (...)\library\Doctrine\Doctrine\Connection\UnitOfWork.php(631): Doctrine_Connection-&amp;gt;insert(Object(Doctrine_Table), Array)&lt;br/&gt;
#4 (...)\library\Doctrine\Doctrine\Connection\UnitOfWork.php(562): Doctrine_Connection_UnitOfWork-&amp;gt;processSingleInsert(Object(UserRole))&lt;br/&gt;
#5 (...)\library\Doctrine\Doctrine\Connection\UnitOfWork.php(81): Doctrine_Connection_UnitOfWork-&amp;gt;insert(Object(UserRole))&lt;br/&gt;
#6 (...)\library\Doctrine\Doctrine\Connection\UnitOfWork.php(452): Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph(Object(UserRole))&lt;br/&gt;
#7 (...)\library\Doctrine\Doctrine\Connection\UnitOfWork.php(137): Doctrine_Connection_UnitOfWork-&amp;gt;saveAssociations(Object(User))&lt;br/&gt;
#8 (...)\library\Doctrine\Doctrine\Record.php(1690): Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph(Object(User))&lt;br/&gt;
#9 (...)\test3.php(124): Doctrine_Record-&amp;gt;save()&lt;br/&gt;
#10 &lt;/p&gt;
{main}</description>
                <environment>1.2 svn</environment>
            <key id="10433">DC-242</key>
            <summary>Linking (re-linking) o/m2m relations with array of ids in Doctrine_Record fromArray stopped working</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mh">Maciej Ho&#322;yszko</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 02:00:38 +0000</created>
                <updated>Tue, 17 Nov 2009 21:20:10 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 21:20:10 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10696" author="mh" created="Tue, 17 Nov 2009 02:06:11 +0000"  >&lt;p&gt;Now I see I duplicated the following ticket: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-228&quot; title=&quot;Doctrine_Record::fromArray() may fail when input contains related component IDs.&quot;&gt;&lt;del&gt;DC-228&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Please fix this issue.&lt;/p&gt;</comment>
                    <comment id="10697" author="mh" created="Tue, 17 Nov 2009 02:09:33 +0000"  >&lt;p&gt;Aaand &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-189&quot; title=&quot;When applying changes to n:n relations that contain partially same data DELET is not fired&quot;&gt;&lt;del&gt;DC-189&lt;/del&gt;&lt;/a&gt; is also related.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-241] Count query with join o2m + limit + where throws an exception</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-241</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&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;class Poll &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;module_polls&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_category&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;question&apos;, &apos;string&apos;, 256);
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;PollAnswer as Answers&apos;, array(&apos;local&apos; =&amp;gt; &apos;id&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_poll&apos;, &apos;orderBy&apos; =&amp;gt; &apos;position&apos;));
	}
}

class PollAnswer &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;module_polls_answers&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_poll&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;answer&apos;, &apos;string&apos;, 256);
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;votes&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, &apos;&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;&apos; =&amp;gt; 0));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;position&apos;, &apos;integer&apos;);
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Poll&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_poll&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
	}
}

$query = Doctrine_Query::create()
	-&amp;gt;from(&apos;Poll p&apos;)
	-&amp;gt;leftJoin(&apos;p.Answers pa&apos;)
	-&amp;gt;where(&apos;id_category = ?&apos;, 1)
	-&amp;gt;limit(10);

print_r($query-&amp;gt;count());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This fails with the following exception being thrown:&lt;/p&gt;

&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1064 Something is wrong in your syntax obok &apos;? LIMIT 10&apos; w linii 1. Failing Query: &quot;SELECT DISTINCT `m3`.`id` FROM `module_polls` `m3` LEFT JOIN `module_polls_answers` `m4` ON `m3`.`id` = `m4`.`id_poll` WHERE `m3`.`id_category` = ? LIMIT 10&quot;&lt;br/&gt;
#0 (...)\library\Doctrine\Doctrine\Connection.php(1015): Doctrine_Connection-&amp;gt;rethrowException(Object(PDOException), Object(Doctrine_Connection_Mysql), &apos;SELECT DISTINCT...&apos;)&lt;br/&gt;
#1 (...)\library\Doctrine\Doctrine\Query.php(1246): Doctrine_Connection-&amp;gt;execute(&apos;SELECT DISTINCT...&apos;, Array)&lt;br/&gt;
#2 (...)\library\Doctrine\Doctrine\Query.php(1106): Doctrine_Query-&amp;gt;buildSqlQuery()&lt;br/&gt;
#3 (...)\library\Doctrine\Doctrine\Query\Abstract.php(1126): Doctrine_Query-&amp;gt;getSqlQuery(Array)&lt;br/&gt;
#4 (...)\library\Doctrine\Doctrine\Query\Abstract.php(1088): Doctrine_Query_Abstract-&amp;gt;_getDqlCallbackComponents(Array)&lt;br/&gt;
#5 (...)\library\Doctrine\Doctrine\Query.php(1126): Doctrine_Query_Abstract-&amp;gt;_preQuery()&lt;br/&gt;
#6 (...)\library\Doctrine\Doctrine\Query.php(1106): Doctrine_Query-&amp;gt;buildSqlQuery()&lt;br/&gt;
#7 (...)\library\Doctrine\Doctrine\Query.php(1995): Doctrine_Query-&amp;gt;getSqlQuery()&lt;br/&gt;
#8 (...)\library\Doctrine\Doctrine\Query.php(2091): Doctrine_Query-&amp;gt;getCountSqlQuery()&lt;br/&gt;
#9 (...)\test2.php(123): Doctrine_Query-&amp;gt;count()&lt;br/&gt;
#10 &lt;/p&gt;
{main}

&lt;p&gt;You can see the generated query which is wrong, moreover it is passed with an empty params array().&lt;br/&gt;
Without either where condition or limit removed, it works. With a combo of both of them it fails.&lt;/p&gt;

&lt;p&gt;E.g. without where condition the following query is generated:&lt;br/&gt;
SELECT COUNT&lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/star_yellow.gif&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; AS `num_results` FROM (SELECT `m`.`id` FROM `module_polls` `m` LEFT JOIN `module_polls_answers` `m2` ON `m`.`id` = `m2`.`id_poll` GROUP BY `m`.`id`) `dctrn_count_query`&lt;/p&gt;</description>
                <environment>1.2 svn</environment>
            <key id="10432">DC-241</key>
            <summary>Count query with join o2m + limit + where throws an exception</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mh">Maciej Ho&#322;yszko</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 01:14:03 +0000</created>
                <updated>Tue, 17 Nov 2009 23:08:51 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 23:08:51 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Record</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10695" author="mh" created="Tue, 17 Nov 2009 01:18:35 +0000"  >&lt;p&gt;This is related to recently closed, but not fixed due to unability to reproduce, &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-138&quot; title=&quot;WHERE LIKE doesn&amp;#39;t work on JOIN SELECTs.&quot;&gt;&lt;del&gt;DC-138&lt;/del&gt;&lt;/a&gt; - seems like the same problem. In that ticket it was not clearly stated that -&amp;gt;count() method is used on the query. It fails when a &apos;where&apos; condition is added to the query, no matter if it&apos;s simple =? condition or LIKE one.&lt;/p&gt;</comment>
                    <comment id="10713" author="jwage" created="Tue, 17 Nov 2009 18:27:37 +0000"  >&lt;p&gt;I am not sure that these are the same issues. Can you test this patch though?&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;Index: lib/Doctrine/Query.php
===================================================================
--- lib/Doctrine/Query.php	(revision 6739)
+++ lib/Doctrine/Query.php	(working copy)
@@ -1334,15 +1334,6 @@
             array_pop($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;where&apos;]);
         }
 
-        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($needsSubQuery) {
-            &lt;span class=&quot;code-comment&quot;&gt;// We need to &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; shift &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; &amp;gt; 2
&lt;/span&gt;-            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (count($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;where&apos;]) &amp;gt; 2) {
-                array_shift($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;where&apos;]);
-            }
-
-            array_shift($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;where&apos;]);
-        }
-
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sql = $q;
 
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;clear();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I think this should fix the issue. I am not sure what that block of code is supposed to be doing, but I think it is there incorrectly.&lt;/p&gt;</comment>
                    <comment id="10715" author="mh" created="Tue, 17 Nov 2009 18:42:52 +0000"  >&lt;p&gt;Unfortunately this patch does not fix the problem. The result is the same exception being thrown.&lt;br/&gt;
I think that part of code is there for some purpose, are you sure that removing will not break anything else? It is steered by $needsSubQuery variable which is set to true or false in few conditions above it.&lt;/p&gt;</comment>
                    <comment id="10717" author="jwage" created="Tue, 17 Nov 2009 18:47:29 +0000"  >&lt;p&gt;No after talking with the team we realized that the code is not needed and should have been removed. It was there to &quot;fix&quot; a problem but at some point the real problem was fixed so this is no longer needed.&lt;/p&gt;</comment>
                    <comment id="10718" author="jwage" created="Tue, 17 Nov 2009 18:50:30 +0000"  >&lt;p&gt;I committed some changes, can you test those? Also, can you get on IRC or something where we can chat so we can get this issue fixed today?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-240] Automatic ordering through orderBy in many-to-many relation definition issue</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-240</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I would like to utilize new nice feature in Doctrine 1.2, namely automatic ordering of relations using orderBy property in relation definition. However I see small flaw with m2m relations:&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;class User &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;core_users&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;username&apos;, &apos;string&apos;, 64, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;password&apos;, &apos;string&apos;, 128, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Role as Roles&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_user&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_role&apos;, &apos;refClass&apos; =&amp;gt; &apos;UserRole&apos;, &apos;orderBy&apos; =&amp;gt; &apos;position&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;actAs(&apos;SoftDelete&apos;);
	}
}

class Role &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;core_roles&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;name&apos;, &apos;string&apos;, 64);
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;User as Users&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_user&apos;, &apos;refClass&apos; =&amp;gt; &apos;UserRole&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Role as Parents&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role_child&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_role_parent&apos;, &apos;refClass&apos; =&amp;gt; &apos;RoleReference&apos;, &apos;orderBy&apos; =&amp;gt; &apos;position&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Role as Children&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role_parent&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_role_child&apos;, &apos;refClass&apos; =&amp;gt; &apos;RoleReference&apos;));
	}
}

class UserRole &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;core_users_roles&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_user&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_role&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;position&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;User&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_user&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Role&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
	}
}

class RoleReference &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;core_roles_reference&apos;);
		
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_role_parent&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id_role_child&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;position&apos;, &apos;integer&apos;, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, array(&apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;));
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
	{
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Role as Parent&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role_parent&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Role as Child&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_role_child&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
	}
}

$query = Doctrine_Query::create()
	-&amp;gt;from(&apos;User u&apos;)
	-&amp;gt;leftJoin(&apos;u.Roles r&apos;)
	-&amp;gt;orderBy(&apos;username ASC&apos;)
	-&amp;gt;execute();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Results in following query being generated:&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;SELECT `c`.`id` AS `c__id`, `c`.`username` AS `c__username`, `c`.`password` AS `c__password`, `c`.`deleted_at` AS `c__deleted_at`, `c2`.`id` AS `c2__id`, `c2`.`name` AS `c2__name` FROM `core_users` `c` LEFT JOIN `core_users_roles` `c3` ON (`c`.`id` = `c3`.`id_user`) LEFT JOIN `core_roles` `c2` ON `c2`.`id` = `c3`.`id_role` WHERE (`c`.`deleted_at` IS NULL) ORDER BY `c`.`username` ASC, position
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As you can see, &apos;position&apos; column at the end is not prefixed by an alias (should be `c3` here), which may arise problems when there are more than one column of that name used within tables used in the query.&lt;/p&gt;

&lt;p&gt;Same with lazy-loading:&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;$query = Doctrine_Query::create()
	-&amp;gt;from(&apos;User u&apos;)
	-&amp;gt;orderBy(&apos;username ASC&apos;);
	
$result = $query-&amp;gt;execute();
foreach($result as $item)
{
	echo count($item-&amp;gt;Roles);
}

SELECT `c`.`id` AS `c__id`, `c`.`name` AS `c__name`, `c2`.`id_user` AS `c2__id_user`, `c2`.`id_role` AS `c2__id_role`, `c2`.`position` AS `c2__position` FROM `core_roles` `c` LEFT JOIN `core_users_roles` `c2` ON `c`.`id` = `c2`.`id_role` WHERE (`c2`.`id_user` IN (?)) ORDER BY position
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>1.2 svn</environment>
            <key id="10431">DC-240</key>
            <summary>Automatic ordering through orderBy in many-to-many relation definition issue</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mh">Maciej Ho&#322;yszko</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Nov 2009 00:47:06 +0000</created>
                <updated>Tue, 17 Nov 2009 20:08:07 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 20:08:07 +0000</resolved>
                            <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Record</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-239] Doctrine_Query::getCountQuery() produces subquery if the query contains joins</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-239</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Is there a reason why Doctrine_Query::getCountQuery() produces subquery only if there is joins or having clause. &lt;/p&gt;

&lt;p&gt;Its not good for high performance environment like ours: it makes the temp file disk full and could kill the server performance. &lt;/p&gt;

&lt;p&gt;Let&apos;s the developer the freedom to decide what the count method should return: I prefer it as option like that: &lt;/p&gt;

&lt;p&gt;public function count($withSubquery = false) &lt;/p&gt;
{&#160;... }

&lt;p&gt;But I want to know the reason why subquery. &lt;/p&gt;</description>
                <environment></environment>
            <key id="10430">DC-239</key>
            <summary>Doctrine_Query::getCountQuery() produces subquery if the query contains joins</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dreamcocoa">Fabian Spillner</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Nov 2009 21:46:17 +0000</created>
                <updated>Wed, 18 Nov 2009 01:46:20 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 01:45:57 +0000</resolved>
                            <version>1.2.0-ALPHA1</version>
                <version>1.2.0-ALPHA2</version>
                <version>1.2.0-ALPHA3</version>
                <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                <version>1.2.0-BETA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10728" author="jwage" created="Wed, 18 Nov 2009 01:45:57 +0000"  >&lt;p&gt;This is fixed in Doctrine 1.2.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-238] Doctrine_Query::count() doesn&apos;t follow useResultCache</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-238</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The count method of Doctrine_Query doesn&apos;t follow useResultCache option, so I have to make loop away with fetchOne or something like that use &quot;execute()&quot;. &lt;/p&gt;

&lt;p&gt;So I fixed this issue, see the attachment for details! &lt;/p&gt;</description>
                <environment></environment>
            <key id="10429">DC-238</key>
            <summary>Doctrine_Query::count() doesn&apos;t follow useResultCache</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="dreamcocoa">Fabian Spillner</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Nov 2009 21:29:28 +0000</created>
                <updated>Tue, 17 Nov 2009 21:38:16 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 21:38:16 +0000</resolved>
                            <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10721" author="jwage" created="Tue, 17 Nov 2009 21:38:16 +0000"  >&lt;p&gt;I decided to fix this in Doctrine 1.2 before it really is too late.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10163" name="doctrine-query-count-cache.diff" size="1368" author="dreamcocoa" created="Mon, 16 Nov 2009 21:29:28 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-228] Doctrine_Record::fromArray() may fail when input contains related component IDs.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-228</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I try to explain through an example.&lt;/p&gt;

&lt;p&gt;Data model:&lt;br/&gt;
===========&lt;/p&gt;

&lt;p&gt;User &amp;#8212; UserGroup &amp;#8212; Group // many-to-many relation&lt;/p&gt;

&lt;p&gt;Example code:&lt;br/&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;$user = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User;
$user-&amp;gt;name = &apos;user1&apos;;
$user-&amp;gt;Group[0]-&amp;gt;name = &apos;group1&apos;; &lt;span class=&quot;code-comment&quot;&gt;// id =&amp;gt; 1
&lt;/span&gt;$user-&amp;gt;Group[1]-&amp;gt;name = &apos;group2&apos;; &lt;span class=&quot;code-comment&quot;&gt;// id =&amp;gt; 2
&lt;/span&gt;$user-&amp;gt;save();

$group3 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Group;
$group3-&amp;gt;name = &apos;group3&apos;;
$group3-&amp;gt;save(); &lt;span class=&quot;code-comment&quot;&gt;// id =&amp;gt; 3
&lt;/span&gt;
&lt;span class=&quot;code-comment&quot;&gt;// edit user in an HTML form, and select all groups with checkboxes
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// $_POST = array(&apos;name&apos; =&amp;gt; &apos;user1&apos;, &apos;Group&apos; =&amp;gt; array(1, 2, 3))
&lt;/span&gt;$user-&amp;gt;fromArray($_POST);
$user-&amp;gt;save(); &lt;span class=&quot;code-comment&quot;&gt;// fail, unique constraint violation
&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Reason:&lt;br/&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;
Doctrine_Record::fromArray() calls unlink() in line 1948:

$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;unlink($key, array(), &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);

unlink() fills _pendingUnlinks variable with User&apos;s Group relation IDs in line 2418:

&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $ids) {
    $ids = $allIds;
}
foreach ($ids as $id) {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_pendingUnlinks[$alias][$id] = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;So _pendingUnlinks&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; will be an array.&lt;/p&gt;

&lt;p&gt;Then fromArray() calls link() in line 1949:&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 ($value as $id) {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;link($key, $id, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;link() remove new IDs (1, 2 and 3) from _pendingUnlinks&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; in line 2496:&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 ($ids as $id) {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_pendingUnlinks[$alias][$id])) {
        unset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_pendingUnlinks[$alias][$id]);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So _pendingUnlinks&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; will be an empty array.&lt;/p&gt;

&lt;p&gt;When we save user, this code is executed in Doctrine_Connection_UnitOfWork::saveGraph() (in line 103):&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 ($record-&amp;gt;getPendingUnlinks() as $alias =&amp;gt; $ids) {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($ids === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
        $record-&amp;gt;unlinkInDb($alias, array());
    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($ids) {
        $record-&amp;gt;unlinkInDb($alias, array_keys($ids));
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;BUT&lt;/p&gt;

&lt;p&gt;Because _pendingUnlinks&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; is an empty array, neither IF branch will be executed, so relations won&apos;t be deleted.&lt;/p&gt;

&lt;p&gt;And then Doctrine try to insert new relations, but it will fail because it will violate existed primary keys in UserGroup.&lt;/p&gt;

&lt;p&gt;In an earlier version of Doctrine-1.2, the unlink() method set _pendingUnlinks&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; to false if $ids attribute was an empty array, so in saveGraph() all relations were deleted before new relations inserted.&lt;/p&gt;

&lt;p&gt;/Sorry for my poor English/&lt;/p&gt;</description>
                <environment></environment>
            <key id="10408">DC-228</key>
            <summary>Doctrine_Record::fromArray() may fail when input contains related component IDs.</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="kovi">Zoltan Kovago</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Nov 2009 12:31:25 +0000</created>
                <updated>Tue, 17 Nov 2009 21:20:16 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 21:20:16 +0000</resolved>
                            <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-198] refreshRelated inserts records when One-to-One relationships are used and a related record is deleted</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-198</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When one-to-one relationship is used and a refreshRelated is performed after a delete a new record is inserted with NULL values.&lt;/p&gt;

&lt;p&gt;schema.yml&lt;/p&gt;

&lt;p&gt;Email:&lt;br/&gt;
  columns:&lt;br/&gt;
   user_id: integer&lt;br/&gt;
   address: string(150)&lt;br/&gt;
  relations:&lt;br/&gt;
   User:&lt;br/&gt;
    local: user_id&lt;br/&gt;
    foreign: id&lt;br/&gt;
    type: one&lt;br/&gt;
    foreignType: one&lt;br/&gt;
    foreignAlias: email&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  columns:&lt;br/&gt;
   name: string(150)&lt;/p&gt;

&lt;p&gt;Sample code&lt;/p&gt;

&lt;p&gt;Create.php - create the user/email&lt;/p&gt;

&lt;p&gt;$u = new User();&lt;br/&gt;
$u-&amp;gt;name = &apos;Test&apos;;&lt;br/&gt;
$u-&amp;gt;email-&amp;gt;address = &apos;foo@bar.com&apos;;&lt;br/&gt;
$u-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;Delete.php - remove the email&lt;/p&gt;

&lt;p&gt;$u = Doctrine_Query::create()&lt;del&gt;&amp;gt;from(&apos;User&apos;)&lt;/del&gt;&amp;gt;fetchOne();&lt;br/&gt;
$u-&amp;gt;name = &apos;Test2&apos; ;&lt;br/&gt;
$u-&amp;gt;email-&amp;gt;delete();&lt;br/&gt;
$u-&amp;gt;refreshRelated(&apos;email&apos;);&lt;br/&gt;
$u-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;The profile (of Delete.php)&lt;/p&gt;

&lt;p&gt;connect 0.005211&lt;/p&gt;

&lt;p&gt;query 0.000493&lt;br/&gt;
SELECT u.id AS u_&lt;em&gt;id, u.name AS u&lt;/em&gt;_name FROM user u&lt;br/&gt;
prepare 0.000028&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
execute 0.001086&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
)&lt;br/&gt;
Total time: 0.00681829452515&lt;br/&gt;
fetch 0.000024&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
fetch 0.000016&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
begin 0.000147&lt;/p&gt;

&lt;p&gt;prepare 0.000019&lt;br/&gt;
DELETE FROM email WHERE id = ?&lt;br/&gt;
execute 0.000253&lt;br/&gt;
DELETE FROM email WHERE id = ?&lt;br/&gt;
Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
)&lt;br/&gt;
Total time: 0.00727772712708&lt;br/&gt;
commit 0.001120&lt;/p&gt;

&lt;p&gt;prepare 0.000021&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
execute 0.000333&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
)&lt;br/&gt;
Total time: 0.0087513923645&lt;br/&gt;
fetch 0.000017&lt;br/&gt;
SELECT e.id AS e_&lt;em&gt;id, e.user_id AS e&lt;/em&gt;&lt;em&gt;user_id, e.address AS e&lt;/em&gt;_address FROM email e WHERE e.user_id = ?&lt;br/&gt;
begin 0.000104&lt;/p&gt;

&lt;p&gt;prepare 0.000020&lt;br/&gt;
UPDATE user SET name = ? WHERE id = ?&lt;br/&gt;
execute 0.000291&lt;br/&gt;
UPDATE user SET name = ? WHERE id = ?&lt;br/&gt;
Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; =&amp;gt; Test2&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
)&lt;br/&gt;
Total time: 0.00918316841125&lt;br/&gt;
prepare 0.000021&lt;br/&gt;
INSERT INTO email (id, user_id, address) VALUES (?, ?, ?)&lt;br/&gt;
execute 0.000193&lt;br/&gt;
INSERT INTO email (id, user_id, address) VALUES (?, ?, ?)&lt;br/&gt;
Array&lt;br/&gt;
(&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; =&amp;gt; &lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; =&amp;gt; &lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt; =&amp;gt; &lt;br/&gt;
)&lt;br/&gt;
Total time: 0.00939726829529&lt;br/&gt;
commit 0.000823&lt;/p&gt;

&lt;p&gt;a var_dump of $u-&amp;gt;toArray() after refreshRelated shows&lt;/p&gt;

&lt;p&gt;array(3) {&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;id&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(1) &quot;1&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;name&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(7) &quot;Test2&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;email&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(3) &lt;/p&gt;
{
    [&quot;id&quot;]=&amp;gt;
    string(1) &quot;1&quot;
    [&quot;user_id&quot;]=&amp;gt;
    string(1) &quot;1&quot;
    [&quot;address&quot;]=&amp;gt;
    string(8) &quot;foo@bar.com&quot;
  }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;And in the database I have null values for the email record.&lt;/p&gt;

&lt;p&gt;This does not happen if I change the relationship to hasMany&lt;/p&gt;




</description>
                <environment>Mac OS X, PHP 5.2.11, MySQL 5.1.37</environment>
            <key id="10364">DC-198</key>
            <summary>refreshRelated inserts records when One-to-One relationships are used and a related record is deleted</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bicatu">Mario Bittencourt</reporter>
                        <labels>
                    </labels>
                <created>Sun, 8 Nov 2009 02:44:43 +0000</created>
                <updated>Thu, 19 Nov 2009 20:11:00 +0000</updated>
                    <resolved>Thu, 19 Nov 2009 20:11:00 +0000</resolved>
                            <version>1.1.5</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10569" author="jwage" created="Tue, 10 Nov 2009 17:48:23 +0000"  >&lt;p&gt;This should be fixed in 1.2 now. Can you test 1.2?&lt;/p&gt;</comment>
                    <comment id="10582" author="bicatu" created="Wed, 11 Nov 2009 11:58:42 +0000"  >&lt;p&gt;Sorry. At least in my tests this is still not solved.&lt;/p&gt;

&lt;p&gt;After I delete and call refreshRelated the object still contains the old values and if I do a save it adds a new item with NULL values to the related table.&lt;/p&gt;

&lt;p&gt;My code &lt;/p&gt;

&lt;p&gt;$f = Doctrine_Query::create()&lt;del&gt;&amp;gt;from(&apos;User&apos;)&lt;/del&gt;&amp;gt;fetchOne();&lt;br/&gt;
$f-&amp;gt;name = &apos;Test2&apos; ;&lt;br/&gt;
$f-&amp;gt;email-&amp;gt;delete();&lt;br/&gt;
$f-&amp;gt;refreshRelated(&apos;email&apos;);&lt;br/&gt;
var_dump($f-&amp;gt;toArray());   // first var_dump&lt;/p&gt;

&lt;p&gt;$f-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;var_dump($f-&amp;gt;toArray()); // second var_dump&lt;/p&gt;

&lt;p&gt;// first var_dump&lt;br/&gt;
array(3) {&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;id&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(1) &quot;1&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;name&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(7) &quot;Test2&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;email&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(3) &lt;/p&gt;
{
    [&quot;id&quot;]=&amp;gt;
    string(1) &quot;1&quot;
    [&quot;user_id&quot;]=&amp;gt;
    string(1) &quot;1&quot;
    [&quot;address&quot;]=&amp;gt;
    string(8) &quot;foo@bar.com&quot;
  }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// second var_dump&lt;br/&gt;
array(3) {&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;id&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(1) &quot;1&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;name&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(7) &quot;Test2&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;email&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(3) &lt;/p&gt;
{
    [&quot;id&quot;]=&amp;gt;
    string(1) &quot;2&quot;
    [&quot;user_id&quot;]=&amp;gt;
    string(1) &quot;1&quot;
    [&quot;address&quot;]=&amp;gt;
    string(8) &quot;foo@bar.com&quot;
  }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;In the database the email table contains&lt;/p&gt;

&lt;p&gt;id = 2&lt;br/&gt;
user_id = NULL&lt;br/&gt;
address = NULL&lt;/p&gt;</comment>
                    <comment id="10614" author="jwage" created="Thu, 12 Nov 2009 20:15:59 +0000"  >&lt;p&gt;When I test the code you&apos;re providing, against 1.2. I don&apos;t get the results you explain. Can you make a Doctrine test case to show the problem? Because I can&apos;t seem to reproduce it after my changes to fix the issue.&lt;/p&gt;</comment>
                    <comment id="10642" author="bicatu" created="Sun, 15 Nov 2009 15:18:21 +0000"  >&lt;p&gt;Hi,  &lt;br/&gt;
Sure I can make a test case as soon as I find out how to do that.&lt;/p&gt;

&lt;p&gt;Any urls of how to create a test case?&lt;/p&gt;</comment>
                    <comment id="10688" author="jwage" created="Mon, 16 Nov 2009 20:46:45 +0000"  >&lt;p&gt;In the documentation: &lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_2/en/unit-testing&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_2/en/unit-testing&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="10727" author="jwage" created="Wed, 18 Nov 2009 01:45:01 +0000"  >&lt;p&gt;Any update on this? I am still trying to produce the problem but everything is working for me in my tests. I want to get this fixed in RC1 by this friday if a issue really exists.&lt;/p&gt;</comment>
                    <comment id="10731" author="bicatu" created="Wed, 18 Nov 2009 11:54:04 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;I&apos;ll be able to take another look today (at night) so I&apos;d probably will have an update by tomorrow.&lt;/p&gt;

&lt;p&gt;Regards.&lt;/p&gt;</comment>
                    <comment id="10759" author="jwage" created="Wed, 18 Nov 2009 22:14:54 +0000"  >&lt;p&gt;Any update? Can we chat in IRC or something to help try and find the problem?&lt;/p&gt;</comment>
                    <comment id="10764" author="bicatu" created="Thu, 19 Nov 2009 02:12:48 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I&apos;ve attached the test file you&apos;ve requested. I hope this helps.&lt;/p&gt;

&lt;p&gt;Tested: 419 test cases.&lt;br/&gt;
Successes: 4333 passes.&lt;br/&gt;
Failures: 2 fails.&lt;br/&gt;
Number of new Failures: 0 &lt;/p&gt;

&lt;p&gt;Doctrine_Ticket_DC198_TestCase..................................................failed&lt;/p&gt;


&lt;p&gt;Doctrine_Ticket_DC198_TestCase : method testRemoveEmail failed on line 32 &lt;br/&gt;
 Value1: 0 &lt;br/&gt;
 != &lt;br/&gt;
 Value2: 3 &lt;/p&gt;


&lt;p&gt;Doctrine_Ticket_DC198_TestCase : method testRemoveEmail failed on line 36 &lt;/p&gt;
</comment>
                    <comment id="10792" author="jwage" created="Thu, 19 Nov 2009 20:11:00 +0000"  >&lt;p&gt;Thanks. As soon as I ran the test case I saw the problem and could fix it much much faster &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; Thanks a lot!!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10173" name="DC198TestCase.php" size="2079" author="bicatu" created="Thu, 19 Nov 2009 02:12:48 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-189] When applying changes to n:n relations that contain partially same data DELET is not fired</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-189</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When changing n:n relations in a way that the new dataset contains relations that were present in the previous state (as in adding a relation to existing ones) DELETE is not fired before insert is done. In the example below I simply reapply an existing relation. This is done by Record::synchronizeWithArray().&lt;/p&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;p&gt;Doctrine_Connection_Mysql_Exception: SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;4-14&apos; for key &apos;PRIMARY&apos;&lt;/p&gt;

&lt;p&gt;SQL Query pre r6611:&lt;br/&gt;
		    6 Query	START TRANSACTION&lt;br/&gt;
		    6 Query	UPDATE `structure` SET `user_create_id` = NULL, `user_modify_id` = NULL, `updated_at` = &apos;2009-11-04 23:38:02&apos; WHERE `id` = &apos;4&apos;&lt;br/&gt;
		    6 Query	DELETE FROM `structure_category` WHERE (`structure_id` = &apos;4&apos;)&lt;br/&gt;
		    6 Query	INSERT INTO `structure_category` (`category_id`, `structure_id`) VALUES (&apos;5&apos;, &apos;4&apos;)&lt;br/&gt;
		    6 Query	COMMIT&lt;/p&gt;

&lt;p&gt;SQL QUERY with r6611:&lt;br/&gt;
		    5 Query	START TRANSACTION&lt;br/&gt;
		    5 Query	UPDATE `structure` SET `user_create_id` = NULL, `user_modify_id` = NULL, `updated_at` = &apos;2009-11-04 23:36:33&apos; WHERE `id` = &apos;4&apos;&lt;br/&gt;
		    5 Query	INSERT INTO `structure_category` (`category_id`, `structure_id`) VALUES (&apos;5&apos;, &apos;4&apos;)&lt;br/&gt;
		    5 Query	ROLLBACK&lt;/p&gt;</description>
                <environment>Error introduced in revision 6611</environment>
            <key id="10341">DC-189</key>
            <summary>When applying changes to n:n relations that contain partially same data DELET is not fired</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="squashee">Jaanus Heeringson</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Nov 2009 22:42:07 +0000</created>
                <updated>Tue, 17 Nov 2009 21:20:26 +0000</updated>
                    <resolved>Tue, 17 Nov 2009 21:20:26 +0000</resolved>
                            <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10503" author="squashee" created="Wed, 4 Nov 2009 22:46:11 +0000"  >&lt;p&gt;Added 1.2.0-BETA2&lt;/p&gt;</comment>
                    <comment id="10676" author="jwage" created="Mon, 16 Nov 2009 18:30:44 +0000"  >&lt;p&gt;Can you show the code you&apos;re using? a test case of some sort. It is really hard to fix the problem with so little information &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/sad.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="10692" author="squashee" created="Mon, 16 Nov 2009 22:54:52 +0000"  >&lt;p&gt;&lt;b&gt;This is quite a complex project so I&apos;ll try as best as I can.&lt;/b&gt;&lt;br/&gt;
What is happening here is that I&apos;m adding another category (id:28) to the object (in this case an entry) that allready has one existing category (id: 10). The primary Id&apos;s are named - id!&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;The Code&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setJsonData($query,$data){
		$_query=$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;primaryQuery($query,self::RELATIONS_FULL); &lt;span class=&quot;code-comment&quot;&gt;//generates DQL query - not relevant
&lt;/span&gt;		$_record=$_query-&amp;gt;getOne(array(),2); &lt;span class=&quot;code-comment&quot;&gt;//Fetches the existing record from DQL query
&lt;/span&gt;		$data=$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;fromJsonData($data,$query); &lt;span class=&quot;code-comment&quot;&gt;//Cleans up the recieved JSON data and returns an array
&lt;/span&gt;		ss_error::log($data,&apos;In data&apos;); &lt;span class=&quot;code-comment&quot;&gt;//Data output 1 - incoming data
&lt;/span&gt;		ss_error::log($_record-&amp;gt;toArray(),&apos;Existing data&apos;); &lt;span class=&quot;code-comment&quot;&gt;//Data output 2 - record contents
&lt;/span&gt;		$_record-&amp;gt;synchronizeWithArray($data,&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);&lt;span class=&quot;code-comment&quot;&gt;//Synchronize
&lt;/span&gt;		ss_error::log($_record-&amp;gt;toArray(),&apos;Merged data&apos;); &lt;span class=&quot;code-comment&quot;&gt;//Data output 3 - resulting datac
&lt;/span&gt;		$_record-&amp;gt;save(); &lt;span class=&quot;code-comment&quot;&gt;//#ERROR#
&lt;/span&gt;		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $_record-&amp;gt;toArray(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
	}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Data output 1 - incoming, cleaned up data&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;array (
  &apos;id&apos; =&amp;gt; &apos;5&apos;,
  &apos;active&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;timedpub&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;slug&apos; =&amp;gt; &apos;how_we_work&apos;,
  &apos;date_pub&apos; =&amp;gt; NULL,
  &apos;date_rej&apos; =&amp;gt; NULL,
  &apos;UserCreate&apos; =&amp;gt; NULL,
  &apos;UserModify&apos; =&amp;gt; NULL,
  &apos;Category&apos; =&amp;gt; 
  array (
    0 =&amp;gt; &apos;10&apos;,
    1 =&amp;gt; &apos;28&apos;,
  ),
  &apos;User&apos; =&amp;gt; 
  array (
  ),
  &apos;Translation&apos; =&amp;gt; 
  array (
    &apos;en&apos; =&amp;gt; 
    array (
      &apos;headline&apos; =&amp;gt; &apos;How we work&apos;,
      &apos;name&apos; =&amp;gt; &apos;how we work&apos;,
      &apos;teaser&apos; =&amp;gt; NULL,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;en&apos;,
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
    ),
    &apos;sv&apos; =&amp;gt; 
    array (
      &apos;headline&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;name&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;teaser&apos; =&amp;gt; &apos;&amp;lt;br /&amp;gt;&apos;,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;sv&apos;,
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
    ),
  ),
  &apos;user_create_id&apos; =&amp;gt; NULL,
  &apos;user_modify_id&apos; =&amp;gt; NULL,
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Data output 2 - record contents&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;array (
  &apos;id&apos; =&amp;gt; &apos;5&apos;,
  &apos;active&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;timedpub&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;slug&apos; =&amp;gt; &apos;how_we_work&apos;,
  &apos;date_pub&apos; =&amp;gt; NULL,
  &apos;date_rej&apos; =&amp;gt; NULL,
  &apos;user_create_id&apos; =&amp;gt; NULL,
  &apos;user_modify_id&apos; =&amp;gt; NULL,
  &apos;created_at&apos; =&amp;gt; &apos;2009-11-12 01:41:36&apos;,
  &apos;updated_at&apos; =&amp;gt; &apos;2009-11-12 01:41:36&apos;,
  &apos;Category&apos; =&amp;gt; 
  array (
    0 =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;10&apos;,
      &apos;slug&apos; =&amp;gt; &apos;arbetsmetod&apos;,
      &apos;path&apos; =&amp;gt; &apos;/om_hamilton/arbetsmetod&apos;,
      &apos;parent_id&apos; =&amp;gt; NULL,
      &apos;owner_id&apos; =&amp;gt; &apos;8&apos;,
      &apos;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
      &apos;created_at&apos; =&amp;gt; &apos;2009-11-12 01:41:38&apos;,
      &apos;updated_at&apos; =&amp;gt; &apos;2009-11-12 01:41:38&apos;,
      &apos;Translation&apos; =&amp;gt; 
      array (
        &apos;sv&apos; =&amp;gt; 
        array (
          &apos;id&apos; =&amp;gt; &apos;10&apos;,
          &apos;name&apos; =&amp;gt; &apos;arbetsmetod&apos;,
          &apos;headline&apos; =&amp;gt; &apos;V&#229;r arbetsmetod&apos;,
          &apos;lang&apos; =&amp;gt; &apos;sv&apos;,
        ),
      ),
    ),
  ),
  &apos;User&apos; =&amp;gt; 
  array (
  ),
  &apos;Translation&apos; =&amp;gt; 
  array (
    &apos;en&apos; =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
      &apos;headline&apos; =&amp;gt; &apos;How we work&apos;,
      &apos;name&apos; =&amp;gt; &apos;how we work&apos;,
      &apos;teaser&apos; =&amp;gt; NULL,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;en&apos;,
    ),
    &apos;sv&apos; =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
      &apos;headline&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;name&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;teaser&apos; =&amp;gt; &apos;&amp;lt;br /&amp;gt;&apos;,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;sv&apos;,
    ),
  ),
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Data output 3 - result after Synchronize&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;array (
  &apos;id&apos; =&amp;gt; &apos;5&apos;,
  &apos;active&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;timedpub&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
  &apos;slug&apos; =&amp;gt; &apos;how_we_work&apos;,
  &apos;date_pub&apos; =&amp;gt; NULL,
  &apos;date_rej&apos; =&amp;gt; NULL,
  &apos;user_create_id&apos; =&amp;gt; NULL,
  &apos;user_modify_id&apos; =&amp;gt; NULL,
  &apos;created_at&apos; =&amp;gt; &apos;2009-11-12 01:41:36&apos;,
  &apos;updated_at&apos; =&amp;gt; &apos;2009-11-12 01:41:36&apos;,
  &apos;Category&apos; =&amp;gt; 
  array (
    0 =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;10&apos;,
      &apos;slug&apos; =&amp;gt; &apos;arbetsmetod&apos;,
      &apos;path&apos; =&amp;gt; &apos;/om_hamilton/arbetsmetod&apos;,
      &apos;parent_id&apos; =&amp;gt; NULL,
      &apos;owner_id&apos; =&amp;gt; &apos;8&apos;,
      &apos;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
      &apos;created_at&apos; =&amp;gt; &apos;2009-11-12 01:41:38&apos;,
      &apos;updated_at&apos; =&amp;gt; &apos;2009-11-12 01:41:38&apos;,
      &apos;Translation&apos; =&amp;gt; 
      array (
        &apos;sv&apos; =&amp;gt; 
        array (
          &apos;id&apos; =&amp;gt; &apos;10&apos;,
          &apos;name&apos; =&amp;gt; &apos;arbetsmetod&apos;,
          &apos;headline&apos; =&amp;gt; &apos;V&#229;r arbetsmetod&apos;,
          &apos;lang&apos; =&amp;gt; &apos;sv&apos;,
        ),
      ),
    ),
    1 =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;28&apos;,
      &apos;slug&apos; =&amp;gt; &apos;att_arbeta_hos_oss&apos;,
      &apos;path&apos; =&amp;gt; &apos;/karriar/arbeta_hos_oss&apos;,
      &apos;parent_id&apos; =&amp;gt; NULL,
      &apos;owner_id&apos; =&amp;gt; &apos;21&apos;,
      &apos;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
      &apos;created_at&apos; =&amp;gt; &apos;2009-11-12 01:41:39&apos;,
      &apos;updated_at&apos; =&amp;gt; &apos;2009-11-12 01:41:39&apos;,
    ),
  ),
  &apos;User&apos; =&amp;gt; 
  array (
  ),
  &apos;Translation&apos; =&amp;gt; 
  array (
    &apos;en&apos; =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
      &apos;headline&apos; =&amp;gt; &apos;How we work&apos;,
      &apos;name&apos; =&amp;gt; &apos;how we work&apos;,
      &apos;teaser&apos; =&amp;gt; NULL,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;en&apos;,
    ),
    &apos;sv&apos; =&amp;gt; 
    array (
      &apos;id&apos; =&amp;gt; &apos;5&apos;,
      &apos;headline&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;name&apos; =&amp;gt; &apos;S&#229; arbetar vi&apos;,
      &apos;teaser&apos; =&amp;gt; &apos;&amp;lt;br /&amp;gt;&apos;,
      &apos;text&apos; =&amp;gt; &apos;...&apos;,
      &apos;lang&apos; =&amp;gt; &apos;sv&apos;,
    ),
  ),
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;The error&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&apos;SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry &apos;5-10&apos; &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; key &apos;PRIMARY&apos;&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="10693" author="jwage" created="Mon, 16 Nov 2009 23:10:08 +0000"  >&lt;p&gt;Is it possible for you to make an actual test case? That way I can just execute it and troubleshoot the problem very fast.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-140] _createLimitSubquery generates a query with error ORA-00904</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-140</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If I create a limited query with Oracle sometimes it generates an invalid query, giving ORA-00904 errror.&lt;/p&gt;

&lt;p&gt;A simple DQL query like this: &lt;br/&gt;
$q = Doctrine_Query::create()&lt;br/&gt;
            -&amp;gt;select(&quot;$i.nome, $s.denominazione&quot;)&lt;br/&gt;
            -&amp;gt;from(&quot;Istituto $i&quot;)&lt;br/&gt;
            -&amp;gt;leftJoin(&quot;$i.Sedi $s&quot;);&lt;/p&gt;

&lt;p&gt;creates this intermediate sql: &lt;br/&gt;
SELECT&lt;br/&gt;
 &quot;i&quot;.&quot;id&quot; AS &quot;i__id&quot;,&lt;br/&gt;
 &quot;i&quot;.&quot;nome&quot; AS &quot;i__nome&quot;,&lt;br/&gt;
 &quot;s&quot;.&quot;id&quot; AS &quot;s__id&quot;, &lt;br/&gt;
&quot;s&quot;.&quot;denominazione&quot; AS &quot;s__denominazione&quot; &lt;br/&gt;
FROM &quot;istituto&quot; &quot;i&quot; &lt;br/&gt;
LEFT JOIN &quot;sede&quot; &quot;s&quot; ON &quot;i&quot;.&quot;id&quot; = &quot;s&quot;.&quot;id_istituto&quot;&lt;/p&gt;

&lt;p&gt;that passed to Doctrine_Pager generates this query:&lt;br/&gt;
SELECT &quot;i&quot;.&quot;id&quot; AS &quot;i__id&quot;, &lt;br/&gt;
&quot;i&quot;.&quot;nome&quot; AS &quot;i__nome&quot;, &lt;br/&gt;
&quot;s&quot;.&quot;id&quot; AS &quot;s__id&quot;, &lt;br/&gt;
&quot;s&quot;.&quot;denominazione&quot; AS &quot;s__denominazione&quot; &lt;br/&gt;
FROM &quot;istituto&quot; &quot;i&quot; &lt;br/&gt;
LEFT JOIN &quot;sede&quot;&lt;br/&gt;
 &quot;s&quot; ON &quot;i&quot;.&quot;id&quot; = &quot;s&quot;.&quot;id_istituto&quot; &lt;/p&gt;

&lt;p&gt;WHERE &quot;i&quot;.&quot;id&quot; IN (SELECT a.&quot;id&quot; FROM (SELECT DISTINCT &quot;i2&quot;.&quot;id&quot; FROM &quot;istituto&quot; &quot;i&quot;) a WHERE ROWNUM &amp;lt;= 10)&lt;/p&gt;

&lt;p&gt;The problem is in &quot;i2&quot; referenced in the inner SELECT statement. This inner query hasn&apos;t been correctly parsed, while the column has been aliased,  the table name has an incorrect alias.&lt;/p&gt;

&lt;p&gt;The problem is that the injected sql code necessary to pagination has some space missing inside the parenthesis, thus the tokenizer misses to alias the table name.&lt;br/&gt;
Here it follows a simple patch:&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;--- Oracle.php  2009-10-26 17:04:17.000000000 +0100
+++ Oracle-orig.php     2009-09-25 19:12:10.000000000 +0200
@@ -103,13 +103,13 @@
                 $column = $column === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ? &apos;*&apos; : $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier($column);
                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset &amp;gt; 0) {
                     $min = $offset + 1;
+                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM ( &apos;.
+                                 &apos;SELECT a.*, ROWNUM AS doctrine_rownum FROM ( &apos;
+                                   . $query . &apos; ) a &apos;.
+                              &apos; ) b &apos;.
-                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM (&apos;.
-                                 &apos;SELECT a.*, ROWNUM AS doctrine_rownum FROM (&apos;
-                                   . $query . &apos;) a &apos;.
-                              &apos;) b &apos;.
                               &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;
                 } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
+                    $query = &apos;SELECT a.&apos;.$column.&apos; FROM ( &apos; . $query .&apos; ) a WHERE ROWNUM &amp;lt;= &apos; . $max;
-                    $query = &apos;SELECT a.&apos;.$column.&apos; FROM (&apos; . $query .&apos;) a WHERE ROWNUM &amp;lt;= &apos; . $max;
                 }
             }
         }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Oracle database 10 or higher</environment>
            <key id="10235">DC-140</key>
            <summary>_createLimitSubquery generates a query with error ORA-00904</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dusty_it">Igor D&apos;Astolfo</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Oct 2009 16:07:17 +0000</created>
                <updated>Wed, 18 Nov 2009 01:44:06 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 01:44:06 +0000</resolved>
                            <version>1.1.4</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10425" author="jwage" created="Mon, 2 Nov 2009 23:02:55 +0000"  >&lt;p&gt;This is already fixed in all versions. 1.0, 1.1 and 1.2&lt;/p&gt;</comment>
                    <comment id="10447" author="dusty_it" created="Tue, 3 Nov 2009 09:02:56 +0000"  >&lt;p&gt;Sorry, maybe I didn&apos;t explain well the bug, but it still exist in version 1.1.4 and I think also in 1.2.0&lt;br/&gt;
Maybe you were thinking to a previous bug that gave ORA-00904, but this is a different one.&lt;/p&gt;

&lt;p&gt;It shows up only when using _createLimitSubquery, the same query without limit works fine. In the first post I described the problem, I traced the Doctrine_Query::parseSelect function, when it parses a query modified by the _createLimitSubquery it aliases the field name but not the table name in the inner subquery:&lt;/p&gt;

&lt;p&gt;SELECT &quot;i&quot;.&quot;id&quot; AS &quot;i__id&quot;, &lt;br/&gt;
&quot;i&quot;.&quot;nome&quot; AS &quot;i__nome&quot;, &lt;br/&gt;
&quot;s&quot;.&quot;id&quot; AS &quot;s__id&quot;, &lt;br/&gt;
&quot;s&quot;.&quot;denominazione&quot; AS &quot;s__denominazione&quot; &lt;br/&gt;
FROM &quot;istituto&quot; &quot;i&quot; &lt;br/&gt;
LEFT JOIN &quot;sede&quot;&lt;br/&gt;
 &quot;s&quot; ON &quot;i&quot;.&quot;id&quot; = &quot;s&quot;.&quot;id_istituto&quot; &lt;br/&gt;
WHERE &quot;i&quot;.&quot;id&quot; IN (SELECT a.&quot;id&quot; FROM (SELECT DISTINCT &lt;font color=&quot;red&quot;&gt; &quot;i2&quot;.&quot;id&quot;&lt;/font&gt;  FROM &lt;font color=&quot;red&quot;&gt; &quot;istituto&quot; &quot;i&quot;&lt;/font&gt; ) a WHERE ROWNUM &amp;lt;= 10)&lt;/p&gt;

&lt;p&gt;if you look in the subuery (the last line), you&apos;ll see that the field name is &quot;i2&quot;.&quot;id&quot;, but the table name is &quot;i&quot; (FROM &quot;istituto&quot; &quot;i&quot; means FROM &quot;istituto&quot; AS &quot;i&quot;), so Oracle gives error since the query references an &quot;i2&quot; table that isn&apos;t defined anywhere.&lt;/p&gt;

&lt;p&gt;I also found why Doctrine_Query::parseSelect doesn&apos;t parse correctly the table alias, it&apos;s because the tokenization does not split the parenthesis after the table name, so the table name pass unchanged. My patch adds a blank after the end of the subquery in the Doctrine_Connection_Oracle::_createLimitSubquery, so the parenthesis does not interfere anymore with the parseSelect.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;</comment>
                    <comment id="10458" author="jwage" created="Tue, 3 Nov 2009 17:06:56 +0000"  >&lt;p&gt;I understand, but what I am telling you is that your patch is already applied. When I look at the code in 1.0, 1.1, and 1.2. The changes you&apos;ve made in your patch already exist. So someone must have fixed this bug already. Please make sure your Doctrine libs are up to date.&lt;/p&gt;</comment>
                    <comment id="10526" author="dusty_it" created="Fri, 6 Nov 2009 14:03:25 +0000"  >&lt;p&gt;Sorry... I made a mistake with the diff, inverted the original and the patched version :|&lt;br/&gt;
I updated the patch, now you could apply it correctly.&lt;/p&gt;</comment>
                    <comment id="10725" author="jwage" created="Wed, 18 Nov 2009 01:24:49 +0000"  >&lt;p&gt;Ok. Now I see the patch, but I don&apos;t understand. This is the SQL that is being passed to Oracle. Oracle has a problem without the extra spacing that you&apos;ve added?&lt;/p&gt;</comment>
                    <comment id="10726" author="jwage" created="Wed, 18 Nov 2009 01:26:50 +0000"  >&lt;p&gt;Ok. I understand now.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-138] WHERE LIKE doesn&apos;t work on JOIN SELECTs.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-138</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;WHERE LIKE doesn&apos;t work on JOIN SELECTs.&lt;br/&gt;
Params are not passed to the query.&lt;/p&gt;

&lt;p&gt;Reproduce code:&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;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function addSearchTerm(Doctrine_Query $query, array $fields)
	{
		$phrase = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getRequest()-&amp;gt;getPost(&apos;query&apos;);
		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;(!empty($phrase) &amp;amp;&amp;amp; !empty($fields))
		{
			$phrase = &apos;%&apos;. $phrase .&apos;%&apos;;
			$searchString = array();
			$searchParams = array();
			foreach($fields As $field)
			{
				$searchString[] = &lt;span class=&quot;code-quote&quot;&gt;&quot;$field LIKE ?&quot;&lt;/span&gt;;
				$searchParams[] = $phrase;
			} 
			$searchString = implode(&apos; OR &apos;, $searchString);
			
			$query-&amp;gt;andWhere($searchString, $searchParams);
		}	
	}

$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;addSearchTerm($query, array(
			&apos;username&apos;,
			&apos;email&apos;,
			&apos;last_login_ip&apos;,
			&apos;Data.title&apos;,
			&apos;Data.first_name&apos;,
			&apos;Data.last_name&apos;,
			&apos;Data.company&apos;,
			&apos;Roles.name&apos;
		));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Result attached as screenshot.&lt;/p&gt;

&lt;p&gt;Query produced is correct, however &apos;?&apos; are not replaced with params from the array.&lt;/p&gt;

&lt;p&gt;Error message is:&lt;br/&gt;
Doctrine_Connection_Mysql_Exception: SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &apos;? OR `c8`.`email` LIKE ? OR `c8`.`last_login_ip` LIKE ? OR `c9`.`title` LIKE ? O&apos; at line 1&lt;/p&gt;

&lt;p&gt;Query passed to MySQL by Doctrine:&lt;br/&gt;
SELECT DISTINCT `c8`.`id` FROM `core_users` `c8` LEFT JOIN `core_users_data` `c9` ON `c8`.`id` = `c9`.`id_user` LEFT JOIN `core_users_roles` `c11` ON (`c8`.`id` = `c11`.`id_user`) LEFT JOIN `core_roles` `c10` ON `c10`.`id` = `c11`.`id_role` LEFT JOIN `core_users_roles` `c13` ON (`c8`.`id` = `c13`.`id_user`) LEFT JOIN `core_roles` `c12` ON `c12`.`id` = `c13`.`id_role` LEFT JOIN `core_users_roles` `c14` ON `c12`.`id` = `c14`.`id_role` WHERE (`c8`.`username` LIKE ? OR `c8`.`email` LIKE ? OR `c8`.`last_login_ip` LIKE ? OR `c9`.`title` LIKE ? OR `c9`.`first_name` LIKE ? OR `c9`.`last_name` LIKE ? OR `c9`.`company` LIKE ? OR `c10`.`name` LIKE ?) ORDER BY `c8`.`username` ASC, `c14`.`position` LIMIT 20&lt;/p&gt;</description>
                <environment>SVN 1.2 branch</environment>
            <key id="10232">DC-138</key>
            <summary>WHERE LIKE doesn&apos;t work on JOIN SELECTs.</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mg">Marcin Gil</reporter>
                        <labels>
                    </labels>
                <created>Sat, 24 Oct 2009 10:33:55 +0000</created>
                <updated>Wed, 18 Nov 2009 22:07:55 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 22:07:55 +0000</resolved>
                            <version>1.2.0-ALPHA3</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10689" author="jwage" created="Mon, 16 Nov 2009 20:49:13 +0000"  >&lt;p&gt;Something else is wrong, this is not a bug in Doctrine. The params are not replaced by Doctrine, they are simply passed to PDO and PDO replaces the values internally. If you have more information, i.e. a failing test case you can re-open the issue.&lt;/p&gt;</comment>
                    <comment id="10702" author="mg" created="Tue, 17 Nov 2009 08:25:45 +0000"  >&lt;p&gt;More information:&lt;/p&gt;

&lt;p&gt;Last working revision was 6394 - after this the functionality is broken.&lt;/p&gt;</comment>
                    <comment id="10703" author="mg" created="Tue, 17 Nov 2009 08:26:39 +0000"  >&lt;p&gt;Last working revision was 6394 - after this the functionality is broken.&lt;/p&gt;</comment>
                    <comment id="10706" author="mg" created="Tue, 17 Nov 2009 08:37:10 +0000"  >&lt;p&gt;I attach test case later.&lt;/p&gt;</comment>
                    <comment id="10707" author="mg" created="Tue, 17 Nov 2009 08:51:24 +0000"  >&lt;p&gt;It seems this is the same problem as brought up here:&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-241&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-241&lt;/a&gt;&lt;/p&gt;
</comment>
                    <comment id="10712" author="jwage" created="Tue, 17 Nov 2009 18:25:19 +0000"  >&lt;p&gt;Are you sure that revision is right?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://trac.doctrine-project.org/changeset/6394&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/changeset/6394&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://trac.doctrine-project.org/changeset/6395&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/changeset/6395&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those two revisions are unrelated to the code that is in question here. Take a look.&lt;/p&gt;</comment>
                    <comment id="10714" author="jwage" created="Tue, 17 Nov 2009 18:27:59 +0000"  >&lt;p&gt;Can you try the patch in the comments here?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-241&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-241&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="10716" author="mh" created="Tue, 17 Nov 2009 18:43:28 +0000"  >&lt;p&gt;Actually, the revision with changed a lot in Doctrine_Query was that one: &lt;a href=&quot;http://trac.doctrine-project.org/changeset/6396&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/changeset/6396&lt;/a&gt;&lt;br/&gt;
But seems like that wasn&apos;t the one which causes the problem, sorry.&lt;br/&gt;
I will investigate further.&lt;/p&gt;</comment>
                    <comment id="10756" author="jwage" created="Wed, 18 Nov 2009 22:07:55 +0000"  >&lt;p&gt;I think this should be fixed now &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10097" name="screen.png" size="22873" author="mg" created="Sat, 24 Oct 2009 10:33:56 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-62] decimal fields are rounded to 6 decimal places on save()</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-62</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Decimal fields with high precision are rounded down to 6 decimal places prior to inserting into database on Doctrine_Record-&amp;gt;save()&lt;/p&gt;

&lt;p&gt;For example,&lt;br/&gt;
if you define a column to represent decimal numbers with 12 digits following the decimal:&lt;/p&gt;

&lt;p&gt;MySet:&lt;br/&gt;
  columns:&lt;br/&gt;
    p_value: &lt;/p&gt;
{ type: decimal(18), scale: 12 }


&lt;p&gt;Then create a new doctrine record object and save:&lt;/p&gt;

&lt;p&gt;$record = new MySet();&lt;br/&gt;
$record&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;p_value&amp;#39;&amp;#93;&lt;/span&gt; = 5.012345678912;&lt;br/&gt;
$record-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;The value in the database at this point has been rounded down to 6 decimal places:&lt;br/&gt;
value = 5.012346000000&lt;/p&gt;


&lt;p&gt;print_r($record-&amp;gt;toArray()) shows the correct value to 12 decimal places&lt;/p&gt;</description>
                <environment>db engine: MySQL 5.0.75 and SQLite&lt;br/&gt;
php ini: precision = 12&lt;br/&gt;
</environment>
            <key id="10111">DC-62</key>
            <summary>decimal fields are rounded to 6 decimal places on save()</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bradyo">brady</reporter>
                        <labels>
                    </labels>
                <created>Fri, 25 Sep 2009 01:04:37 +0000</created>
                <updated>Wed, 14 Apr 2010 17:03:42 +0000</updated>
                    <resolved>Wed, 18 Nov 2009 01:15:52 +0000</resolved>
                            <version>1.0.13</version>
                <version>1.1.4</version>
                <version>1.2.0-BETA2</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10609" author="bradyo" created="Thu, 12 Nov 2009 19:37:06 +0000"  >&lt;p&gt;I found that retrieving from the database gives the correct precision, so the rounding problem only occurs on saving. I&apos;ve tested doctrine versions 1.0.13 (through symfony), 1.1.4, and 1.2 alpha2 - all have this problem.&lt;/p&gt;


&lt;p&gt;//require_once(&apos;lib/vendor/Doctrine-1.2.0/lib/Doctrine.php&apos;);&lt;br/&gt;
require_once(&apos;lib/vendor/Doctrine-1.1.4/Doctrine.php&apos;);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));&lt;/p&gt;

&lt;p&gt;class TestRecord extends Doctrine_Record&lt;br/&gt;
{&lt;br/&gt;
    public function setTableDefinition()&lt;/p&gt;
    {
        $this-&amp;gt;setTableName(&apos;test&apos;);
        $this-&amp;gt;hasColumn(&apos;id&apos;, &apos;integer&apos;, null, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;notnull&apos; =&amp;gt; false,
             &apos;primary&apos; =&amp;gt; true,
             &apos;autoincrement&apos; =&amp;gt; true,
             ));
				$this-&amp;gt;hasColumn(&apos;test_field&apos;, &apos;decimal&apos;, 18, array(
             &apos;scale&apos; =&amp;gt; 12,
             ));
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;$pdo = new PDO(&apos;sqlite:testdb.db&apos;);&lt;br/&gt;
//$pdo = new PDO(&apos;mysql:host=localhost;dbname=testdb&apos;, &apos;root&apos;, &apos;pass&apos;);&lt;br/&gt;
$conn = Doctrine_Manager::connection($pdo);&lt;/p&gt;

&lt;p&gt;// test retreival of value (first row has 12.891841075016 inserted manually)&lt;br/&gt;
$q = Doctrine_Query::create()-&amp;gt;from(&apos;TestRecord&apos;)&lt;br/&gt;
	-&amp;gt;where(&apos;id = ?&apos;, 1);&lt;br/&gt;
$record = $q-&amp;gt;fetchOne();&lt;br/&gt;
echo &apos;retrieved value = &apos;, $record&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;test_field&amp;#39;&amp;#93;&lt;/span&gt;, &quot;\n&quot;;&lt;br/&gt;
// outputs 12.891841075016 (OK)&lt;/p&gt;

&lt;p&gt;// test save of high precision decimal&lt;br/&gt;
$test = new TestRecord();&lt;br/&gt;
$test&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;test_field&amp;#39;&amp;#93;&lt;/span&gt; = 12.891841075016;&lt;br/&gt;
$test-&amp;gt;save();&lt;br/&gt;
// database shows 12.891841000000 (rounded incorrectly)&lt;/p&gt;</comment>
                    <comment id="10723" author="jwage" created="Wed, 18 Nov 2009 01:15:52 +0000"  >&lt;p&gt;This is a problem with mysql. In Doctrine decimal won&apos;t store that value properly. If you change it to float, it works properly. I had to make a change in Doctrine so that Doctrine float maps to mysql float, double to double and decimal to decimal. Update Doctrine 1.2 from SVN and change your schema type to be &apos;float&apos; instead of &apos;decimal&apos;. It should work properly then.&lt;/p&gt;</comment>
                    <comment id="12668" author="jek" created="Wed, 14 Apr 2010 17:03:42 +0000"  >&lt;p&gt;Seems another issue is generated by the fix to this ticket. For a schema like:&lt;/p&gt;

&lt;p&gt;Data:&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type:        integer(5)&lt;br/&gt;
      primary:  true&lt;br/&gt;
    value:&lt;br/&gt;
      type:        double&lt;/p&gt;

&lt;p&gt;and a MySQL database the generated column type for value is DOUBLE(18,2), which obviously isn&apos;t what was intended. Actually it means that storing values like &quot;1.234567&quot; or &quot;12 345 678 901 234 567 890&quot; doesn&apos;t work like one expects when working with double precision floats.&lt;/p&gt;

&lt;p&gt;Maybe I oversee something but I think there isn&apos;t a way to just use plain doubles.&lt;/p&gt;

&lt;p&gt;A possible fix could be to check for a explicitly set scale or length (line 233 and 237 of DataDict/Mysql.php):&lt;/p&gt;

&lt;p&gt;if (!empty($field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;length&amp;#39;&amp;#93;&lt;/span&gt;) || !empty($field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;scale&amp;#39;&amp;#93;&lt;/span&gt;)) {&lt;br/&gt;
  $length = !empty($field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;length&amp;#39;&amp;#93;&lt;/span&gt;) ? $field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;length&amp;#39;&amp;#93;&lt;/span&gt; : 18; &lt;br/&gt;
  $scale = !empty($field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;scale&amp;#39;&amp;#93;&lt;/span&gt;) ? $field&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;scale&amp;#39;&amp;#93;&lt;/span&gt; : $this-&amp;gt;conn-&amp;gt;getAttribute(Doctrine_Core::ATTR_DECIMAL_PLACES); &lt;br/&gt;
  return &apos;DOUBLE(&apos;.$length.&apos;, &apos;.$scale.&apos;)&apos;; &lt;br/&gt;
} else {&lt;br/&gt;
  return &apos;DOUBLE&apos;;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;This way there is a fallback to the version before rev 6750.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-37] Performing JOIN and ORDERBY and using the PAGER in MSSQL results in bad query</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-37</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When adding an ORDER BY and a JOIN to a query when using MSSQL as the back end, an incomplete query is produced with duplicated ORDER BY sections.&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;$query = Doctrine_Query::create()
            -&amp;gt;from(&apos;User u&apos;)
            -&amp;gt;leftJoin(&apos;u.Roles&apos;)
            -&amp;gt;addOrderBy(&apos;u.lastname, u.firstname&apos;);

$pager = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Pager($query, $page, $per_page);

&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; array(
    &apos;pager&apos; =&amp;gt; $pager,
    &apos;results&apos; =&amp;gt; $pager-&amp;gt;execute(),
);

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

&lt;p&gt;Produces&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; 
	[u].[id] AS [u__id], 
	[u].[username] AS [u__username], 
	[u].[password] AS [u__password], 
	[u].[firstname] AS [u__firstname], 
	[u].[lastname] AS [u__lastname], 
	[u].[email] AS [u__email], 
	[u].[phone] AS [u__phone], 
	[u].[data] AS [u__data], 
	[u].[created_at] AS [u__created_at], 
	[u].[updated_at] AS [u__updated_at], 
	[u].[deleted_at] AS [u__deleted_at], 
	[r].[id] AS [r__id], 
	[r].[name] AS [r__name] 
&lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; 
	[users] [u] 
	LEFT JOIN [user_has_role] [u2] ON ([u].[id] = [u2].[user_id]) 
	LEFT JOIN [role] [r] ON [r].[id] = [u2].[role_id] 
&lt;span class=&quot;code-keyword&quot;&gt;WHERE&lt;/span&gt; 
	[u].[id] IN (
		&lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; * &lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; (
			&lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; TOP 1 * &lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; (
				&lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; 
					DISTINCT TOP 1 [u].[id] 
				&lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; 
					[users] [u] 
					LEFT JOIN [user_has_role] [u2] ON ([u].[id] = [u2].[user_id]
			) 
			LEFT JOIN [role] [r] ON [r].[id] = [u2].[role_id] 
			ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; 
				[u].[lastname], [u].[firstname]
		) AS [inner_tbl] 
		ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; 
			[inner_tbl].[ DESC, [inner_tbl].[ DESC
	) AS [outer_tbl] 
ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; 
	[outer_tbl].[ asc, [outer_tbl].[ asc) 
ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; 
	[u].[lastname], [u].[firstname]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Particularly, notice in the first ORDER BY blocks the incomplete clauses (e.g. &lt;tt&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;outer_tbl&amp;#93;&lt;/span&gt;.[&lt;/tt&gt; )&lt;/p&gt;

&lt;p&gt;*&lt;b&gt;SCHEMA&lt;/b&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;Role:
  columns:
    id:
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      type: integer
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    name:
      type: string(100)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    Users:
      foreignAlias: Roles
      class: User
      refClass: UserHasRole

UserHasRole:
  columns:
    user_id:
      type: integer
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    role_id:
      type: integer
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    User:
      local: user_id
      foreign: id
    Role:
      local: role_id
      foreign: id

User:
  tableName: users
  actAs: [Timestampable, Softdelete]
  columns:
    id:
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      type: integer
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    username:
      type: string(255)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    password:
      type: string(255)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    firstname:
      type: string(255)
    lastname:
      type: string(255)
    email:
      type: string(255)
      email: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    phone:
      type: string(20)
    data:
      type: string
  indexes:
    user_index:
      fields: [username]
      type: unique
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;I will be digging around to find out what the problem is later, and start playing with the 1.2 branch to see if the problem exists there. If someone could help me and point me in a good direction to start looking that would be great&lt;/em&gt;&lt;/p&gt;</description>
                <environment>PHP 5.2.9-2, Apache, Microsoft SQL Server 2005, Windows XP SP 3</environment>
            <key id="10082">DC-37</key>
            <summary>Performing JOIN and ORDERBY and using the PAGER in MSSQL results in bad query</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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="dcousineau">Daniel Cousineau</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Sep 2009 18:47:14 +0000</created>
                <updated>Mon, 23 Nov 2009 23:25:49 +0000</updated>
                    <resolved>Mon, 23 Nov 2009 23:25:49 +0000</resolved>
                            <version>1.1.4</version>
                                <fixVersion>1.2.0-RC1</fixVersion>
                                <component>Pager</component>
                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10057" author="dcousineau" created="Thu, 17 Sep 2009 18:51:01 +0000"  >&lt;p&gt;CORRECTION: Notice it was only when using the pager.&lt;/p&gt;</comment>
                    <comment id="10059" author="dcousineau" created="Thu, 17 Sep 2009 18:53:09 +0000"  >&lt;p&gt;Possibly related to &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-36&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-36&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="10072" author="jwage" created="Thu, 17 Sep 2009 23:33:18 +0000"  >&lt;p&gt;Are you using the latest 1.1.3?&lt;/p&gt;</comment>
                    <comment id="10094" author="felixjendrusch" created="Sun, 20 Sep 2009 12:50:40 +0000"  >&lt;p&gt;Seems like I&apos;m having the same issue using MSSQL, (Doctrine 1.1.3, Doctrine 1.2-ALPHA1), &lt;tt&gt;Zend_Paginator_Adapter_Doctrine&lt;/tt&gt; and &lt;tt&gt;Doctrine::LIMIT_RECORDS&lt;/tt&gt; (works with &lt;tt&gt;Doctrine::LIMIT_ROWS&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;SELECT
	[c].[clientarchivefileid] AS [c__clientarchivefileid],
	[c].[filename] AS [c__filename],
	[c].[thumbnailimagename] AS [c__thumbnailimagename],
	[c].[archivedate] AS [c__archivedate],
	[c2].[identifier] AS [c2__identifier],
	[c2].[archive] AS [c2__archive],
	[c2].[trash] AS [c2__trash],
	[c2].[name] AS [c2__name],
	[f].[filetypeid] AS [f__filetypeid],
	[f].[fileextension] AS [f__fileextension],
	[c3].[clientarchivevideoserverid] AS [c3__clientarchivevideoserverid],
	[c4].[identifier] AS [c4__identifier],
	[c4].[url] AS [c4__url],
	[c5].[videoserverid] AS [c5__videoserverid],
	[c5].[videoservername] AS [c5__videoservername],
	[l].[identifier] AS [l__identifier],
	[l].[name] AS [l__name],
	[t].[identifier] AS [t__identifier],
	[t].[name] AS [t__name]
FROM [ClientArchiveFile] [c]
LEFT JOIN [ClientArchiveFileExtension] [c2]
	ON [c].[clientarchivefileid] = [c2].[identifier]
LEFT JOIN [FileType] [f]
	ON [c].[filetypeid] = [f].[filetypeid]
LEFT JOIN [ClientArchiveVideoServer] [c3]
	ON [c].[clientarchivevideoserverid] = [c3].[clientarchivevideoserverid]
LEFT JOIN [ClientArchiveVideoServerExtension] [c4]
	ON [c3].[clientarchivevideoserverid] = [c4].[identifier]
LEFT JOIN [ClientVideoServer] [c5]
	ON [c3].[videoserverid] = [c5].[videoserverid]
LEFT JOIN [ClientArchiveFileLabel] [c6]
	ON ([c].[clientarchivefileid] = [c6].[fileidentifier])
LEFT JOIN [Label] [l]
	ON [l].[identifier] = [c6].[labelidentifier]
LEFT JOIN [TerminalFile] [t2]
	ON ([c].[clientarchivefileid] = [t2].[fileidentifier])
LEFT JOIN [Terminal] [t]
	ON [t].[identifier] = [t2].[terminalidentifier]
WHERE
	[c].[clientarchivefileid] IN (
		SELECT
			*
		FROM (
			SELECT TOP 10
				*
			FROM (
				SELECT DISTINCT TOP 10
					[c].[clientarchivefileid]
				FROM [ClientArchiveFile] [c]
				LEFT JOIN [ClientArchiveFileExtension] [c2]
					ON [c].[clientarchivefileid] = [c2].[identifier]
				LEFT JOIN [FileType] [f]
					ON [c].[filetypeid] = [f].[filetypeid]
				LEFT JOIN [ClientArchiveVideoServer] [c3]
					ON [c].[clientarchivevideoserverid] = [c3].[clientarchivevideoserverid]
				LEFT JOIN [ClientArchiveVideoServerExtension] [c4]
					ON [c3].[clientarchivevideoserverid] = [c4].[identifier]
				LEFT JOIN [ClientVideoServer] [c5]
					ON [c3].[videoserverid] = [c5].[videoserverid]
				LEFT JOIN [ClientArchiveFileLabel] [c6]
					ON ([c].[clientarchivefileid] = [c6].[fileidentifier])
				LEFT JOIN [Label] [l]
					ON [l].[identifier] = [c6].[labelidentifier]
				LEFT JOIN [TerminalFile] [t2]
					ON ([c].[clientarchivefileid] = [t2].[fileidentifier])
				LEFT JOIN [Terminal] [t]
					ON [t].[identifier] = [t2].[terminalidentifier]
				WHERE
					[c].[filetypeid] = 1
					AND (
						[c2].[identifier] = NULL
						OR (
							[c2].[archive] = 0
							AND [c2].[trash] = 0
						)
					)
				ORDER BY
					[c].[archivedate] DESC,
					[l].[name] ASC
			) AS [inner_tbl]
			ORDER BY
				[inner_tbl].[ ASC,
				[inner_tbl].[ DESC
		) AS [outer_tbl]
		ORDER BY
			[outer_tbl].[ desc,
			[outer_tbl].[ asc
	)
	AND [c].[filetypeid] = 1
	AND (
		[c2].[identifier] = NULL 
		OR (
			[c2].[archive] = 0
			AND [c2].[trash] = 0
		)
	)
ORDER BY
	[c].[archivedate] DESC,
	[l].[name] ASC&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Probably a bug in &lt;tt&gt;Doctrine_Connection_Mssql::modifyLimitQuery()&lt;/tt&gt;?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>