<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu May 23 00:54:57 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+DC+AND+resolution+%3D+Unresolved+ORDER+BY+due+ASC%2C+priority+DESC%2C+created+ASC&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+resolution+%3D+Unresolved+ORDER+BY+due+ASC%2C+priority+DESC%2C+created+ASC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="464" total="464"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DC-313] Ordering m2m relationship with column from related table (with orderBy option)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-313</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I find no way to define automatic orderBy in m2m relations with column not from reference table, but actual related table.&lt;/p&gt;

&lt;p&gt;E.g. BlogPost &amp;lt;= m2m through BlogPostCategory =&amp;gt; BlogCategory&lt;br/&gt;
I need BlogPost-&amp;gt;Categories ordered by BlogCategory.name&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 BlogPost &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;title&apos;, &apos;string&apos;, 128);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;content&apos;, &apos;string&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;hasMany(&apos;BlogCategory as BlogCategories&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_blog_post&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_blog_category&apos;, &apos;refClass&apos; =&amp;gt; &apos;BlogPostCategory&apos;, &apos;orderBy&apos; =&amp;gt; &apos;name&apos;));        
    }
}

class BlogCategory &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;, 128);
    }
    
    &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;BlogPost as BlogPosts&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_blog_category&apos;, &apos;foreign&apos; =&amp;gt; &apos;id_blog_post&apos;, &apos;refClass&apos; =&amp;gt; &apos;BlogPostCategory&apos;));
    }
}

class BlogPostCategory &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_blog_post&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_blog_category&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;BlogPost&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_blog_post&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;BlogCategory&apos;, array(&apos;local&apos; =&amp;gt; &apos;id_blog_category&apos;, &apos;foreign&apos; =&amp;gt; &apos;id&apos;, &apos;onDelete&apos; =&amp;gt; &apos;CASCADE&apos;));
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The resulting query contains doubled &apos;name&apos; column in ORDER BY clause, both from reference table and related table, e.g. ORDER BY t2.name, t3.name&lt;/p&gt;

&lt;p&gt;I tried putting the following code in BlogCategory::setTableDefinition() instead of attribute in relation definition in BlogPost record:&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;this&lt;/span&gt;-&amp;gt;option(&apos;orderBy&apos;, &apos;name&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;but the result was the same.&lt;/p&gt;

&lt;p&gt;Maybe I&apos;m doing something wrong? Is there a possibility to define an alias, where to get column name from - in orderBy attribute?&lt;/p&gt;

&lt;p&gt;Thanks in advance.&lt;/p&gt;</description>
                <environment>php 5.3/win, doctrine 1.2 svn, ATTR_QUOTE_IDENTIFIER = true, ATTR_USE_DQL_CALLBACKS = true</environment>
            <key id="10546">DC-313</key>
            <summary>Ordering m2m relationship with column from related table (with orderBy option)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mh">Maciej Ho&#322;yszko</reporter>
                        <labels>
                    </labels>
                <created>Wed, 2 Dec 2009 12:53:05 +0000</created>
                <updated>Fri, 18 Feb 2011 03:32:42 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Record</component>
                <component>Relations</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="10969" author="mh" created="Wed, 2 Dec 2009 12:53:49 +0000"  >&lt;p&gt;Attached test case.&lt;/p&gt;</comment>
                    <comment id="11080" author="mh" created="Tue, 8 Dec 2009 12:59:05 +0000"  >&lt;p&gt;I find this issue as critical one now, because when I use e.g.&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;this&lt;/span&gt;-&amp;gt;option(&apos;orderBy&apos;, &apos;name&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;in a model&apos;s definition (not ref class), then when other model is related m2m with it, a query loading both of them with relations will fail because of name column duplicated in ref table.&lt;/p&gt;</comment>
                    <comment id="12740" author="suhock" created="Fri, 23 Apr 2010 05:18:13 +0000"  >&lt;p&gt;I am having the same issue with an equivalent test case. For some reason, the &lt;tt&gt;&apos;orderBy&apos;&lt;/tt&gt; option on the target of the join (set by calling the &lt;tt&gt;option()&lt;/tt&gt; function inside the &lt;tt&gt;setUp()&lt;/tt&gt; method of the model class, not the ref class) is being applied to the relation table. After digging through the 1.2.2 tag a bit, I found altering line 1319 of Query.php as follows seems to fix the problem (at least against my test cases):&lt;/p&gt;

&lt;p&gt;&lt;del&gt;&lt;tt&gt;if (isset($map&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;relation&amp;#39;&amp;#93;&lt;/span&gt;)) {&lt;/tt&gt;&lt;/del&gt;&lt;br/&gt;
&lt;ins&gt;&lt;tt&gt;if (isset($map&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;relation&amp;#39;&amp;#93;&lt;/span&gt;) &amp;amp;&amp;amp; $map&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;relation&amp;#39;&amp;#93;&lt;/span&gt;-&amp;gt;getTable() === $map&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;table&amp;#39;&amp;#93;&lt;/span&gt;) {&lt;/tt&gt;&lt;/ins&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ll do some more thorough testing and submit a patch if I find time.&lt;/p&gt;</comment>
                    <comment id="15332" author="bwegrzyn" created="Thu, 17 Feb 2011 09:45:31 +0000"  >&lt;p&gt;I had this issue as well. suhock&apos;s solution fixed it for me. It would be nice if this was merged in to a bug fix release of Doctrine 1.x.&lt;/p&gt;</comment>
                    <comment id="15336" author="suhock" created="Fri, 18 Feb 2011 03:32:42 +0000"  >&lt;p&gt;I ended up creating a new ticket, &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-651&quot; class=&quot;external-link&quot;&gt;DC-651&lt;/a&gt;, which addresses a more general problem with the orderBy feature. You should use the attached Ticket_DC651.patch instead, as I found the solution I provided here is not completely correct and does not pass all test cases.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10202" name="DC313TestCase.php" size="3659" author="mh" created="Wed, 2 Dec 2009 12:53:49 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-627] Work on link-table and leftJoin</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-627</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Looking at the attachment to see the little schema.&lt;br/&gt;
Tree table : items, items_children and children.&lt;/p&gt;

&lt;p&gt;The link-table items_children is here to create a many-to-many relationships between Items and Children.&lt;/p&gt;

&lt;p&gt;So, after configure the YAML and generated Models.&lt;br/&gt;
We can do something like that :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$query	= Doctrine_Query::create ()&lt;br/&gt;
    		-&amp;gt;select (&quot;items.title, children.title&quot;)&lt;br/&gt;
    		-&amp;gt;from (&quot;Item items&quot;)&lt;br/&gt;
    		-&amp;gt;leftJoin (&quot;item.children children&quot;);&lt;br/&gt;
$items = $query-&amp;gt;execute ();&lt;/p&gt;

&lt;p&gt;$items //An array of items&lt;br/&gt;
$items&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;title //A string&lt;br/&gt;
$items&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;children //An array of children&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The SQL Output of the query is :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT `i`.`id_item` AS `i_&lt;em&gt;id_item`, `i`.`title` AS `i&lt;/em&gt;&lt;em&gt;title`, `c`.`id_child` AS `c&lt;/em&gt;&lt;em&gt;id_child`, `c`.`title` AS `c&lt;/em&gt;_title` FROM `items` `i` LEFT JOIN `items_children` `i2` ON (`i`.`id_item` = `i2`.`id_item`) LEFT JOIN `children` `c` ON `i2`.`id_child` = `c`.`id_child` &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;All array are order by something, in this case it&apos;s a natural order which come from the items_children order into database.&lt;/p&gt;

&lt;p&gt;Now, I want to apply a condition, or a filter on the items_children table.&lt;br/&gt;
If I translate my demand to SQL Query :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT `i`.`id_item` AS `i_&lt;em&gt;id_item`, `i`.`title` AS `i&lt;/em&gt;&lt;em&gt;title`, `c`.`id_child` AS `c&lt;/em&gt;&lt;em&gt;id_child`, `c`.`title` AS `c&lt;/em&gt;_title` FROM `items` `i` LEFT JOIN `items_children` `i2` ON (`i`.`id_item` = `i2`.`id_item`) LEFT JOIN `children` `c` ON `i2`.`id_child` = `c`.`id_child` ORDER BY `c1`.`index`&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Or something crazy :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT `i`.`id_item` AS `i_&lt;em&gt;id_item`, `i`.`title` AS `i&lt;/em&gt;&lt;em&gt;title`, `c`.`id_child` AS `c&lt;/em&gt;&lt;em&gt;id_child`, `c`.`title` AS `c&lt;/em&gt;_title` FROM `items` `i` LEFT JOIN `items_children` `i2` ON (`i`.`id_item` = `i2`.`id_item`) LEFT JOIN `children` `c` ON `i2`.`id_child` = `c`.`id_child` WHERE `c1`.`index` &amp;gt; 2&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;But how can I do that with DQL ? Because I have no access to the Link-table.&lt;/p&gt;

&lt;p&gt;Link-Table are use to create many-to-many, that could be OOP array. So we have to be allowed to add &quot;index&quot; to order the result. Also, we have to be allowed to add condition on this tables, like &quot;datePromote&quot; or simply &quot;enabled&quot;.&lt;/p&gt;

&lt;p&gt;The solution should be on the following DQL Query :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$query	= Doctrine_Query::create ()&lt;br/&gt;
    		-&amp;gt;select (&quot;items.title, children.title&quot;)&lt;br/&gt;
    		-&amp;gt;from (&quot;Item items&quot;)&lt;br/&gt;
    		-&amp;gt;leftJoin (&quot;item.children children&quot;)&lt;br/&gt;
    		-&amp;gt;leftJoin (&quot;ItemsChildren link_table&quot;)&lt;br/&gt;
    		-&amp;gt;orderBy (&quot;link_table.index&quot;)&lt;br/&gt;
$items = $query-&amp;gt;execute ();&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;But the SQL Output is :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT `i`.`id_item` AS `i_&lt;em&gt;id_item`, `i`.`title` AS `i&lt;/em&gt;&lt;em&gt;title`, `c`.`id_child` AS `c&lt;/em&gt;&lt;em&gt;id_child`, `c`.`title` AS `c&lt;/em&gt;_title` FROM `items` `i` LEFT JOIN `items_children` `i2` ON (`i`.`id_item` = `i2`.`id_item`) LEFT JOIN `children` `c` ON `i2`.`id_child` = `c`.`id_child`, `items_children` `i3` ORDER BY `i3`.`index` &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;To conclude, it&apos;s a blocker problem. Because I can&apos;t use a standard DB schema.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Armetiz.&lt;/p&gt;</description>
                <environment>Windows Seven - WAMP 2.0i</environment>
            <key id="11215">DC-627</key>
            <summary>Work on link-table and leftJoin</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Apr 2010 04:56:01 +0000</created>
                <updated>Tue, 13 Apr 2010 05:07:32 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10568" name="composition.png" size="14915" author="armetiz" created="Tue, 13 Apr 2010 04:56:01 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-665] Named parameters doesn&apos;t work on MSSQL anymore</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-665</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;After upgrading to Doctrine 1.2.2 queries with named arguments doesn&apos;t work anymore.&lt;br/&gt;
Whenever querying like&lt;br/&gt;
                    $query = Doctrine_Query::create();&lt;br/&gt;
                    $customer = $query-&amp;gt;from(&apos;Customers&apos;)&lt;br/&gt;
                                      -&amp;gt;where(&quot;id = :id&quot;&lt;br/&gt;
                                            , array(&apos;id&apos;=&amp;gt;$user&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;customer_id&amp;#39;&amp;#93;&lt;/span&gt;))&lt;br/&gt;
                                      -&amp;gt;fetchOne(array(), Doctrine::HYDRATE_ARRAY);&lt;/p&gt;

&lt;p&gt;I get the error &lt;br/&gt;
SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;HY000&amp;#93;&lt;/span&gt;: General error: 10007 Incorrect syntax near &apos;:&apos;. &lt;span class=&quot;error&quot;&gt;&amp;#91;10007&amp;#93;&lt;/span&gt; (severity 5) &lt;/p&gt;

&lt;p&gt;If changing the query to &lt;br/&gt;
                    $query = Doctrine_Query::create();&lt;br/&gt;
                    $customer = $query-&amp;gt;from(&apos;Customers&apos;)&lt;br/&gt;
                                      -&amp;gt;where(&quot;id = ?&quot;&lt;br/&gt;
                                            , array($user&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;customer_id&amp;#39;&amp;#93;&lt;/span&gt;))&lt;br/&gt;
                                      -&amp;gt;fetchOne(array(), Doctrine::HYDRATE_ARRAY);&lt;br/&gt;
it works fine.&lt;br/&gt;
Testing with MySQL works fine, so it seems contained to MSSQL&lt;/p&gt;
</description>
                <environment>Windows Server 2003. PHP 5.2.12. MS SQL Server 2008</environment>
            <key id="11319">DC-665</key>
            <summary>Named parameters doesn&apos;t work on MSSQL anymore</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="denpet">Dennis Pettersson</reporter>
                        <labels>
                    </labels>
                <created>Wed, 5 May 2010 10:43:34 +0000</created>
                <updated>Wed, 22 Sep 2010 00:55:15 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12842" author="denpet" created="Thu, 6 May 2010 03:07:13 +0000"  >&lt;p&gt;Should mention I upgraded from 1.1.6 to 1.2.2, so the problem might be present in earlier 1.2.x versions as well.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-701] Aggregates functions do not return proper values when using many relationships and limits</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-701</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi All&lt;/p&gt;

&lt;p&gt;I have encountered a problem that seems very core to the way that doctrine works &amp;#8211; if you apply an aggregate function to a column in a table and then join to another table via a many relationship while also using a limit, like so:&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;$q = Doctrine_Query::create();
$q-&amp;gt;from(&apos;Customer Customer&apos;); 
$q-&amp;gt;addSelect(&apos;COUNT(Customer.id) as COUNT_customer_id&apos;);
$q-&amp;gt;addSelect(&apos;Customer_Order.id as order_id&apos;); 
$q-&amp;gt;leftJoin(&apos;Customer.Order Customer_Order&apos;); &lt;span class=&quot;code-comment&quot;&gt;// Many relationship here
&lt;/span&gt;$q-&amp;gt;limit(20);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It produces this correct DQL:&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 COUNT(Customer.id) as COUNT_customer_id, Customer_Order.id as order_id 
FROM Customer Customer 
  LEFT JOIN Customer.Order Customer_Order 
LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However the SQL it produces will not return an accurate count &amp;#8211; the count is restricted by the limit:&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 COUNT(p.id) AS p__0, p2.id AS p2__1 
FROM product_customers p 
  LEFT JOIN product_orders p2 ON p.id = p2.customer_id 
WHERE p.id IN (&apos;1&apos;, &apos;2&apos;, &apos;3&apos;, &apos;4&apos;, &apos;5&apos;, &apos;6&apos;, &apos;7&apos;, &apos;8&apos;, &apos;9&apos;, &apos;10&apos;, &apos;11&apos;, &apos;12&apos;, &apos;13&apos;, &apos;14&apos;, &apos;15&apos;, &apos;16&apos;, &apos;17&apos;, &apos;18&apos;, &apos;19&apos;, &apos;20&apos;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This produces a count of 21 instead of what it should be (1000).&lt;/p&gt;

&lt;p&gt;The reason for this is because Doctrine&apos;s internal functionality does an intermediary query where it gets gets the ids needed from the customer table in order to use them as the IN portion of the constraints on the final query &amp;#8211; like so:&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 DISTINCT p3.id FROM product_customers p3 LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It may seem strange that I am applying a limit to a query which will aggregate to 1 to row . In the actual queries that alerted me to this problem I am using a group by. The reason I am not reporting this bug with a group by in my example however is that you can not use a group by with a many relationship and a limit in doctrine 1.2.2 as it works currently (see bug: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-594&quot; title=&quot;When using a combination of: a group by field referencing a table in a relation, a join to a different table via a many type relation and a limit clause, doctrine creates a broken query then throws an exception&quot;&gt;&lt;del&gt;DC-594&lt;/del&gt;&lt;/a&gt;). However I am personally able to use a limit with a group by and many relationship since I am using a version of the code I patched my self to repair bug &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-594&quot; title=&quot;When using a combination of: a group by field referencing a table in a relation, a join to a different table via a many type relation and a limit clause, doctrine creates a broken query then throws an exception&quot;&gt;&lt;del&gt;DC-594&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is my sample schema in case its helpful.&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;detect_relations: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;package&lt;/span&gt;: Example
options:
  type: INNODB
  charset: utf8
Order:
  tableName: orders
  columns:
    order_id:
      type: integer(4)
      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;
    customer_id:
      type: integer(4)
    order_date: timestamp
  relations:
    Customer:
      type: one
      local: customer_id
      foreign: customer_id
  options:
    type: InnoDB
Customer:
  tableName: customers
  columns:
    customer_id:
      type: integer(4)
      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;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    firstname:
      type: string(45)
    lastname:
      type: string(45)
    streetaddress:
      type: string(45)
    city:
      type: string(45)
    state:
      type: string(45)
    postalcode:
      type: string(45)
  relations:
    Order:
      type: many
      local: customer_id
      foreign: customer_id
  options:
    type: InnoDB
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thanks much.&lt;/p&gt;

&lt;p&gt;Will Ferrer&lt;/p&gt;

&lt;p&gt;&lt;sub&gt;edit: split SQL code to make the discussion readable without huge horizontal scrolling...&lt;/sub&gt;&lt;/p&gt;</description>
                <environment>XP Xamp</environment>
            <key id="11409">DC-701</key>
            <summary>Aggregates functions do not return proper values when using many relationships and limits</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="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="willf1976">will ferrer</reporter>
                        <labels>
                    </labels>
                <created>Mon, 24 May 2010 20:28:27 +0000</created>
                <updated>Mon, 1 Nov 2010 20:12:17 +0000</updated>
                                    <version>1.2.2</version>
                                <fixVersion>1.2.4</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13153" author="jwage" created="Tue, 8 Jun 2010 10:27:47 +0000"  >&lt;p&gt;Is this still a problem? I am not sure if this can be patched easily. The limit subquery algorithm is flawed deeply but also a core part of the current way Doctrine 1 works.&lt;/p&gt;</comment>
                    <comment id="13237" author="willf1976" created="Tue, 8 Jun 2010 19:06:56 +0000"  >&lt;p&gt;Hi Jon&lt;/p&gt;

&lt;p&gt;This bug is still an issue for me but I think it may be VERY hard to patch since it seems very core to the way Doctrine 1 works.&lt;/p&gt;

&lt;p&gt;The project I am working on at the moment is a visual query builder that is highly reliant on Doctrine. In order to prevent users from making queries that would trigger this bug I am currently giving an alert when ever a query that would trigger this bug is created.&lt;/p&gt;

&lt;p&gt;It would be great if this were patchable but if not I should be able to get by.&lt;/p&gt;

&lt;p&gt;Does Doctrine 2 fix this problem?&lt;/p&gt;

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

&lt;p&gt;Will Ferrer&lt;/p&gt;</comment>
                    <comment id="13240" author="jwage" created="Tue, 8 Jun 2010 20:34:37 +0000"  >&lt;p&gt;In Doctrine 2 the limit subquery algorithm does not exist. It is now up to the developer to write the query to handle the scenario instead of Doctrine &quot;trying&quot; to automate it for you. Since the situation where it is needed it is so rare, and each case can be slightly different it is better to let the developer handle it in those cases.&lt;/p&gt;</comment>
                    <comment id="13241" author="willf1976" created="Tue, 8 Jun 2010 21:07:17 +0000"  >&lt;p&gt;Hi Jon&lt;/p&gt;

&lt;p&gt;Does that mean that Doctrine 2 can no longer intelligently handle limits with many relationships, and doesn&apos;t have the ability to hydrate a return with sub arrays in it for many relationships?&lt;/p&gt;

&lt;p&gt;Thanks again for your help.&lt;/p&gt;

&lt;p&gt;Will Ferrer&lt;/p&gt;</comment>
                    <comment id="13256" author="jwage" created="Wed, 9 Jun 2010 13:06:48 +0000"  >&lt;p&gt;That is correct. We do not automatically try and limit the relationships with a &quot;limit subquery&quot; as it causes more problems then it helps.&lt;/p&gt;</comment>
                    <comment id="13265" author="willf1976" created="Thu, 10 Jun 2010 05:05:53 +0000"  >&lt;p&gt;Hi Jon&lt;/p&gt;

&lt;p&gt;I was thinking about what you said here &amp;#8211; that the &quot;limit subquery&quot; causes more harm than good. It occur to me that I really do like being able to use this method (it comes in very handy very often) but some times it would really help to be able to turn it off (the bug in this thread is a good example such a time). So I figured why not just make an option to turn it off and have the best of both worlds? I looked at the code and found it was really very easy to put in a property which can be set on the query object to enable or disable the use of the limit subquery.&lt;/p&gt;

&lt;p&gt;I made the change in my code base and found it very useful for several situations I was dealing with in my own project.&lt;/p&gt;

&lt;p&gt;The one thing I couldn&apos;t do is make a test case for this new feature &amp;#8211; I couldn&apos;t find an existing test case that was actually triggering the limit subquery as I understood it to work (I couldn&apos;t find a test case that would put an WHERE IN constraint with all the ids gathered in the limit subquery.  I tried some test cases that I THOUGHT would activate this feature but it didn&apos;t seem that they did).&lt;/p&gt;

&lt;p&gt;After adding this feature to my code base I also wanted a new hydrator &amp;#8211; one that worked like scalar but would put in array key names that were the same as the ones you would see in HYDRATE_ARRAY. I noticed that HYDRATE_SCALAR already had the ability to do this but it required that a value of false be passed into the $aliasPrefix argument of the _gatherRowData function. I made a custom hydrator I call HYDRATE_ARRAY_SHALLOW that passes in this false value. I then realized this might be handy to add to doctrine so I integrated it into my code base and made a few test cases for it.&lt;/p&gt;

&lt;p&gt;There are 2 patches I am now attaching this to thread:&lt;/p&gt;

&lt;p&gt;disableLimitSubquery_2010-06-10_Doctrine_1.2_SVN.patch &amp;#8211; this patch adds the disableLimitSubquery property to query objects so that users can turn off the use of the subquery for those times when they don&apos;t want to use that behavior (fixing the bug in this thread and probably others)&lt;/p&gt;

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

&lt;p&gt;disableLimitSubquery_and_HYDRATE_ARRAY_SHALLOW_2010-06-10_Doctrine_1.2_SVN.patch &amp;#8211; this is the same as the first patch but also contains the HYDRATE_ARRAY_SHALLOW hydration type I mentioned above (which tends to go well with disableLimitSubquery turned on).&lt;/p&gt;

&lt;p&gt;I put these in 2 patches incase you liked 1 feature but disliked the other.&lt;/p&gt;

&lt;p&gt;If you like either of this features I would be very happy to see them added to doctrine.&lt;/p&gt;

&lt;p&gt;Also if you have any advice on how to improve these features (or info on how to make a good test case for disableLimitSubquery) please let me know.&lt;/p&gt;

&lt;p&gt;Hope you are well.&lt;/p&gt;

&lt;p&gt;Will Ferrer&lt;/p&gt;</comment>
                    <comment id="13266" author="willf1976" created="Thu, 10 Jun 2010 05:07:31 +0000"  >&lt;p&gt;Reopened because I added a patch that I think in essence fixes the issues.&lt;/p&gt;</comment>
                    <comment id="14221" author="jwage" created="Wed, 1 Sep 2010 14:09:17 +0000"  >&lt;p&gt;Thanks for the issue and patches.&lt;/p&gt;

&lt;p&gt;Fixed here &lt;a href=&quot;http://github.com/doctrine/doctrine1/commit/2ad78e62e360133efc04bf6897bf679c7f3d833b&quot; class=&quot;external-link&quot;&gt;http://github.com/doctrine/doctrine1/commit/2ad78e62e360133efc04bf6897bf679c7f3d833b&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="14228" author="willf1976" created="Wed, 1 Sep 2010 19:24:16 +0000"  >&lt;p&gt;individual patch for this issue with out other features included&lt;/p&gt;</comment>
                    <comment id="14655" author="willf1976" created="Mon, 1 Nov 2010 20:11:40 +0000"  >&lt;p&gt;adding test cases for these features&lt;/p&gt;</comment>
                    <comment id="14656" author="willf1976" created="Mon, 1 Nov 2010 20:12:17 +0000"  >&lt;p&gt;reopened because I posted some test cases to add to doctrine along with the patchs previously posted&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10835" name="DC_701_adds_disbaleLimitSubquery_testcase.patch" size="2398" author="willf1976" created="Mon, 1 Nov 2010 20:11:40 +0000" />
                    <attachment id="10836" name="DC_701_adds_hydrateArrayShallow_testcase.patch" size="2117" author="willf1976" created="Mon, 1 Nov 2010 20:11:40 +0000" />
                    <attachment id="10767" name="DC_701_fix_adds_arrayShallow.patch" size="7909" author="willf1976" created="Wed, 1 Sep 2010 19:24:16 +0000" />
                    <attachment id="10766" name="DC_701_fix_adds_disableLimitSubQuery.patch" size="2267" author="willf1976" created="Wed, 1 Sep 2010 19:24:16 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-770] Result Cache</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-770</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine result cache isn&apos;t working properly.&lt;/p&gt;

&lt;p&gt;Here a simple example, when I&apos;m calling query-&amp;gt;execute (); parentProgram is related to a video.&lt;br/&gt;
Into the Doctrine_Query_Abstract.php file&lt;/p&gt;

&lt;p&gt;line 1014 : I have just add some code to output data.&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;code&amp;#93;&lt;/span&gt;&lt;br/&gt;
            if ($cached === false) &lt;/p&gt;
{
                // cache miss
                $stmt = $this-&amp;gt;_execute($params);
                $this-&amp;gt;_hydrator-&amp;gt;setQueryComponents($this-&amp;gt;_queryComponents);
                $result = $this-&amp;gt;_hydrator-&amp;gt;hydrateResultSet($stmt, $this-&amp;gt;_tableAliasMap);
                $oVideo = $result[0];
                echo &quot;not cached &quot;;
                var_dump (count ($oVideo-&amp;gt;parentProgram-&amp;gt;getReferences ()));
                $cached = $this-&amp;gt;getCachedForm($result);
                $cacheDriver-&amp;gt;save($hash, $cached, $this-&amp;gt;getResultCacheLifeSpan());
            }
&lt;p&gt; else &lt;/p&gt;
{
                $result = $this-&amp;gt;_constructQueryFromCache($cached);
                $oVideo = $result[0];
                echo &quot;cached &quot;;
                var_dump (count ($oVideo-&amp;gt;parentProgram-&amp;gt;getReferences ()));
                exit (0);
                
            }
&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;/code&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The output of a query execution (the first with an empty APC cache) with &quot;useResultCache&quot; is : &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;not cached int(1)&lt;/li&gt;
	&lt;li&gt;cached int(0)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The problem is coming from the serialize php function that can&apos;t serialize protected properties..&lt;br/&gt;
getReferences is a getter to a protected property.. So data result can&apos;t work properly.&lt;/p&gt;

&lt;p&gt;A solution could be use __sleep function, and a public property that contain all important protected data.&lt;/p&gt;
</description>
                <environment></environment>
            <key id="11566">DC-770</key>
            <summary>Result Cache</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Tue, 29 Jun 2010 05:50:36 +0000</created>
                <updated>Tue, 29 Jun 2010 05:50:36 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-791] [PostgreSQL] In case model is build from existing database sequence name is invalid and doctrine throw exception</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-791</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Firstly I created database directly in postgresql.&lt;br/&gt;
After that I generated schema from existsing database and after all i built model.&lt;/p&gt;

&lt;p&gt;When I try to insert new record to database I received following error:&lt;/p&gt;

&lt;p&gt;sequence &quot;Category_id_seq&quot; does not exist&lt;/p&gt;

&lt;p&gt;In schema file sequence name is defined like this:  sequence: &apos;&quot;Address_id_seq&quot;&apos;&lt;br/&gt;
There&apos;s are apostrophes and quotes.&lt;/p&gt;

&lt;p&gt;In Category model file is same like above, apostrophes and quotes.&lt;/p&gt;

&lt;p&gt;When I remove quotes from sequence in model files everything is ok and there&apos;re no problems with insert new row to database.&lt;/p&gt;</description>
                <environment>symfony 1.4.5, postgresql 8.4, debian lenny, nginx</environment>
            <key id="11633">DC-791</key>
            <summary>[PostgreSQL] In case model is build from existing database sequence name is invalid and doctrine throw 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="kacperix">Przemys&#322;aw Ci&#261;&#263;ka</reporter>
                        <labels>
                    </labels>
                <created>Fri, 16 Jul 2010 08:42:43 +0000</created>
                <updated>Wed, 25 Aug 2010 02:40:04 +0000</updated>
                                    <version>1.2.2</version>
                                <fixVersion>1.2.4</fixVersion>
                                <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13943" author="enrico" created="Fri, 13 Aug 2010 12:51:22 +0000"  >&lt;p&gt;There are 2 solutions to your problem. The first is to change the sequence name in the schema, the second is to change the doctrine configuration.&lt;/p&gt;

&lt;p&gt;The default behavior of doctrine is to add a &quot;_seq&quot; to each sequence name. If you remove this part from you sequence name then it sould work as expected. The second option is to change the behavior of doctrine with the following configuration parameter:&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_Manager::getInstance()-&amp;gt;setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, &apos;%s&apos;); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;default:&lt;/b&gt; Doctrine_Manager::getInstance()-&amp;gt;setAttribute(Doctrine_Core::ATTR_SEQNAME_FORMAT, &apos;%s_seq&apos;); &lt;/p&gt;</comment>
                    <comment id="14063" author="kacperix" created="Wed, 25 Aug 2010 02:40:04 +0000"  >&lt;p&gt;Problem are quotes in sequence name.&lt;br/&gt;
Sequence names in schema built from existing database have quotes in their names, e.g &apos; &quot;Address_seq&quot; &apos; and Doctrine try to execute sequence with quotes but in database names exist without quotes.&lt;/p&gt;

&lt;p&gt;Temporarly I fixed it by add str_replace() into importer from PostgreSQL - now in schema sequence names are without quotes.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10697" name="doctrine.png" size="40004" author="kacperix" created="Fri, 16 Jul 2010 08:42:43 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-839] Version classes not built for models using package attribute</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-839</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;For models using the &apos;package&apos; attribute in the schema definition, the version classes do not get created. However, the version table gets created.&lt;/p&gt;

&lt;p&gt;There is no problem during the build, but when loading fixtures, there is a fatal error: Class TaxCodeVersion not found&lt;/p&gt;

&lt;p&gt;TaxCode:&lt;br/&gt;
  package: Masters&lt;br/&gt;
  tableName: Fin_Tax_Codes&lt;br/&gt;
  actAs:&lt;br/&gt;
    Activateable: ~&lt;br/&gt;
    SoftDelete: ~&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Versionable:&lt;/li&gt;
	&lt;li&gt;tableName: fin_tax_codes_version
	&lt;ol&gt;
		&lt;li&gt;versionColumn: version&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;className: %CLASS%Version
	&lt;ol&gt;
		&lt;li&gt;auditLog: true&lt;br/&gt;
    Auditable: ~&lt;br/&gt;
    Timestampable: ~&lt;br/&gt;
.......&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment>PHP 5.2.3 / Symfony 1.4.6</environment>
            <key id="11819">DC-839</key>
            <summary>Version classes not built for models using package attribute</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="prasadgupte">Prasad Gupte</reporter>
                        <labels>
                    </labels>
                <created>Tue, 24 Aug 2010 08:51:41 +0000</created>
                <updated>Tue, 8 Mar 2011 11:06:47 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15475" author="hetsch" created="Tue, 8 Mar 2011 11:06:47 +0000"  >&lt;p&gt;Same here,&lt;/p&gt;

&lt;p&gt;If i use this yaml file:&lt;/p&gt;


&lt;p&gt;Page:&lt;br/&gt;
  actAs: &lt;br/&gt;
    NestedSet:&lt;br/&gt;
      hasManyRoots: true&lt;br/&gt;
      rootColumnName: root_id&lt;br/&gt;
    Versionable:&lt;br/&gt;
      versionColumn: version&lt;br/&gt;
      className: %CLASS%Version&lt;br/&gt;
      auditLog: true&lt;br/&gt;
    Timestampable:&lt;br/&gt;
      created:&lt;br/&gt;
        name: created_at&lt;br/&gt;
        type: timestamp&lt;br/&gt;
        format: Y-m-d H&lt;br/&gt;
      updated:&lt;br/&gt;
        name: updated_at&lt;br/&gt;
        type: timestamp&lt;br/&gt;
        format: Y-m-d H&lt;br/&gt;
    I18n:&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;name&amp;#93;&lt;/span&gt;  &lt;br/&gt;
  columns:&lt;br/&gt;
    name: string(255)&lt;/p&gt;

&lt;p&gt;PageVersion and PageTranslation Models don&apos;t get generated if i use &apos;build-models-yaml&apos;. Have to create the Models manually then it works fine.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-860]  0  down vote  favorite    In some circumstances Doctrine_Core::getTable(&apos;%Name%&apos;) returns Doctrine_Table instance instead of %Name%Table one.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-860</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In some circumstances Doctrine_Core::getTable(&apos;%Name%&apos;) returns Doctrine_Table instance instead of %Name%Table one.&lt;br/&gt;
So custom %Name%Table&apos;s methods become unavailable. &lt;/p&gt;

&lt;p&gt;In order to give a demonstration of this improper behavior : here is a schema of small issue tracking system&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  actAs: &lt;span class=&quot;error&quot;&gt;&amp;#91;Timestampable&amp;#93;&lt;/span&gt;&lt;br/&gt;
  tableName: issue_user&lt;br/&gt;
  columns:&lt;br/&gt;
    user_id:        &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    user_name:      &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    user_role:      &lt;/p&gt;
{ type: enum, values: [worker, dispatcher, manager] }
&lt;p&gt;    managed_by:     &lt;/p&gt;
{ type: integer }
&lt;p&gt;    password:       &lt;/p&gt;
{ type: string(32) }
&lt;p&gt;    salt:           &lt;/p&gt;
{ type: string(32) }
&lt;p&gt;  relations:&lt;br/&gt;
    Manager:&lt;br/&gt;
      foreignAlias: Workers&lt;br/&gt;
      class: User&lt;br/&gt;
      local: managed_by&lt;br/&gt;
      foreign: user_id&lt;br/&gt;
      type: one&lt;br/&gt;
      foreignType: many&lt;/p&gt;

&lt;p&gt;Issue:&lt;br/&gt;
  actAs: &lt;span class=&quot;error&quot;&gt;&amp;#91;Timestampable&amp;#93;&lt;/span&gt;&lt;br/&gt;
  columns:&lt;br/&gt;
    issue_id:        &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    from_ceh:        &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    from_name:       &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    from_phone:      &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    from_location:   &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    comp_name:       &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    comp_serial:     &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    comp_os:         &lt;/p&gt;
{ type: enum, values: [Win95, Win98, WinNT, WinME, Win2000, WinXP, Vista, Win7] }
&lt;p&gt;    issue_title:     &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    comment:         &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    owner_id:        &lt;/p&gt;
{ type: integer }
&lt;p&gt;    is_executed:     &lt;/p&gt;
{ type: bool }
&lt;p&gt;  relations:&lt;br/&gt;
    Owner:&lt;br/&gt;
      onDelete: CASCADE&lt;br/&gt;
      foreignAlias: Issues&lt;br/&gt;
      class: User&lt;br/&gt;
      local: owner_id&lt;br/&gt;
      foreign: user_id&lt;br/&gt;
      type: one&lt;br/&gt;
      foreignType: many&lt;/p&gt;

&lt;p&gt;When I just call Doctrine_Core::getTable(&apos;User&apos;) it returns UserTable instance, but if I call it after such a query:&lt;/p&gt;

&lt;p&gt;Doctrine_Query::create()&lt;br/&gt;
        -&amp;gt;select(&apos;u.user_id, ws.user_id, i.*&apos;)&lt;br/&gt;
        -&amp;gt;from(&apos;User u, u.Workers ws, ws.Issues i&apos;)&lt;br/&gt;
        -&amp;gt;where(&apos;u.user_id=&apos;, $manager_id)&lt;br/&gt;
        -&amp;gt;fetchArray();&lt;/p&gt;

&lt;p&gt;calling Doctrine_Core::getTable(&apos;User&apos;) returns Doctrine_Table instance&lt;/p&gt;</description>
                <environment>WinXP, Apache, PHP 5.2.14</environment>
            <key id="11888">DC-860</key>
            <summary> 0  down vote  favorite    In some circumstances Doctrine_Core::getTable(&apos;%Name%&apos;) returns Doctrine_Table instance instead of %Name%Table one.</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="hongkildong">Hong Kil Dong</reporter>
                        <labels>
                    </labels>
                <created>Mon, 6 Sep 2010 11:49:01 +0000</created>
                <updated>Mon, 6 Sep 2010 12:13:35 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-918] Causing ORA-01791 when try to sort on relation field and use limit in query to Oracle DB</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-918</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;&lt;b&gt;Schema in yml format&lt;/b&gt;&lt;br/&gt;
&lt;em&gt;in Symfony it looks more simple, but i&apos;m going to show relation in detail&lt;/em&gt;
&lt;br class=&quot;atl-forced-newline&quot; /&gt;
&lt;br class=&quot;atl-forced-newline&quot; /&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-javascript&quot;&gt;PrType:
  columns:   
    name:                   { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }                          

PrTypeTranslation:
  columns:   
    id:                     { type: integer, notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    name:                   { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    lang:                   { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
  relations:
    PrType:                 { onDelete: CASCADE, local: id_id, foreign: id, foreignAlias: Translation }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When i try to execute this 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-javascript&quot;&gt;   $q = Doctrine_Query::create()
            -&amp;gt;from(&apos;PrType tp&apos;)
            -&amp;gt;leftJoin(&apos;tp.Translation t WITH t.lang = ?&apos;, &apos;ru&apos;)
            -&amp;gt;orderBy(&apos;t.name&apos;)
            -&amp;gt;limit(10);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;doctrine executes next statement:&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; &lt;span class=&quot;code-quote&quot;&gt;&quot;p&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt; AS &lt;span class=&quot;code-quote&quot;&gt;&quot;p2__name&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;lang&quot;&lt;/span&gt; AS &lt;span class=&quot;code-quote&quot;&gt;&quot;p2__lang&quot;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;pr_type&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p&quot;&lt;/span&gt;
LEFT JOIN &lt;span class=&quot;code-quote&quot;&gt;&quot;pr_type_translation&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt; ON &lt;span class=&quot;code-quote&quot;&gt;&quot;p&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; AND (&lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;lang&quot;&lt;/span&gt; = :oci_b_var_1)
&lt;span class=&quot;code-keyword&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; IN (
              &lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; a.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&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; DISTINCT &lt;span class=&quot;code-quote&quot;&gt;&quot;p3&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;
                          &lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;pr_type&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p3&quot;&lt;/span&gt;
                          INNER JOIN &lt;span class=&quot;code-quote&quot;&gt;&quot;pr_type_translation&quot;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p4&quot;&lt;/span&gt; ON &lt;span class=&quot;code-quote&quot;&gt;&quot;p3&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;p4&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; AND (&lt;span class=&quot;code-quote&quot;&gt;&quot;p4&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;lang&quot;&lt;/span&gt; = &apos;ru&apos;) 
                          ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p4&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt; ) a 
                          &lt;span class=&quot;code-keyword&quot;&gt;WHERE&lt;/span&gt; ROWNUM &amp;lt;= 10) 
ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;p2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;This sql code produces next error&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;ORA-01791: not a SELECTed expression
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Error occures, because (from ORACODE)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There is an incorrect ORDER BY item. The query is a SELECT DISTINCT query with an ORDER BY clause. In this context, all ORDER BY items must be constants, SELECT list expressions, or expressions whose operands are constants or SELECT list expressions&lt;/p&gt;&lt;/blockquote&gt;
</description>
                <environment>Windows 2003 Server, Oracle 10g, Symfony 1.4.8</environment>
            <key id="12072">DC-918</key>
            <summary>Causing ORA-01791 when try to sort on relation field and use limit in query to Oracle DB</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dmishh">Dmitriy</reporter>
                        <labels>
                    </labels>
                <created>Sat, 6 Nov 2010 07:02:53 +0000</created>
                <updated>Sat, 6 Nov 2010 08:48:17 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14676" author="dmishh" created="Sat, 6 Nov 2010 07:04:10 +0000"  >&lt;p&gt;Some very similar issue were reported and resolved here &lt;a href=&quot;http://trac.doctrine-project.org/ticket/1038&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/ticket/1038&lt;/a&gt;.&lt;/p&gt;</comment>
                    <comment id="14678" author="dmishh" created="Sat, 6 Nov 2010 08:46:45 +0000"  >&lt;p&gt;Reason of issue was founded. It appears because i&apos;m using oci8 driver, and this drivername not be listed in &lt;em&gt;if&lt;/em&gt; statement on line 1401 in &lt;b&gt;Doctrine/Query.php&lt;/b&gt;:
&lt;br class=&quot;atl-forced-newline&quot; /&gt;
&lt;br class=&quot;atl-forced-newline&quot; /&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;LINE 1401: &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;) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I changed 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;LINE 1401: &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;oci8&apos; || $driverName == &apos;mssql&apos; || $driverName == &apos;odbc&apos;) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sorry, but i don&apos;t know how to create patch diff file.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-926] Doctrine ignored PORTABILITY_FIX_CASE and ATTR_FIELD_CASE settings when building query</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-926</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Setting:&lt;br/&gt;
$conn-&amp;gt;setAttribute(Doctrine_Core::ATTR_PORTABILITY, Doctrine_Core::PORTABILITY_FIX_CASE)&lt;br/&gt;
$conn-&amp;gt;setAttribute(Doctrine_Core::ATTR_FIELD_CASE, CASE_UPPER)&lt;/p&gt;

&lt;p&gt;I expect column names in built queries to be uppercase, but they remain to be lowercase.&lt;/p&gt;</description>
                <environment>Tested on CentOS 5, Ubuntu 10.4, MYSQL and MSSQL databases</environment>
            <key id="12101">DC-926</key>
            <summary>Doctrine ignored PORTABILITY_FIX_CASE and ATTR_FIELD_CASE settings when building query</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="dziamid">Dziamid Zayankouski</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Nov 2010 17:27:10 +0000</created>
                <updated>Fri, 12 Nov 2010 17:29:13 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-952] Non-Equal Nest Relations Not Working - from &quot;Children&quot; side</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-952</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I&apos;ve copy &amp;amp; pasted example from &lt;a href=&quot;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/1_0#relationships:join-table-associations:self-referencing-nest-relations:non-equal-nest-relations&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/1_0#relationships:join-table-associations:self-referencing-nest-relations:non-equal-nest-relations&lt;/a&gt; .&lt;br/&gt;
I&apos;ve created User backend module using doctrine:generate-admin backend User task. On how to reproduce the error:&lt;/p&gt;

&lt;p&gt;1. Add 3 User objects (A,B,C)&lt;br/&gt;
2. Open generated edit form for User A.&lt;br/&gt;
3. Set User B as Children from Children list and Save&lt;br/&gt;
4. Set User B and C as Chidren from Children list and Save&lt;/p&gt;

&lt;p&gt;As a result you will see only C set as Children, and strange situation in database : &lt;/p&gt;

&lt;p&gt;UserReference Table:&lt;/p&gt;

&lt;p&gt;parent_id  |  child_id&lt;br/&gt;
    pk_B      |    pk_B       (!!!)&lt;br/&gt;
    pk_A      |    pk_C&lt;/p&gt;
</description>
                <environment>Ubuntu 10.04 + PHP 5.3.3 + Symfony 1.4.8</environment>
            <key id="12278">DC-952</key>
            <summary>Non-Equal Nest Relations Not Working - from &quot;Children&quot; side</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="pawelbaranski">Pawe&#322; Bara&#324;ski</reporter>
                        <labels>
                    </labels>
                <created>Mon, 3 Jan 2011 10:15:37 +0000</created>
                <updated>Thu, 24 Mar 2011 04:59:10 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Record</component>
                <component>Relations</component>
                        <due></due>
                    <votes>4</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="15111" author="pawelbaranski" created="Thu, 6 Jan 2011 09:41:02 +0000"  >&lt;p&gt;Same ticket on symfony trac because I&apos;m not sure whose fault is it &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;

&lt;p&gt;&lt;a href=&quot;http://trac.symfony-project.org/ticket/9398&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/ticket/9398&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also some new error path there&lt;/p&gt;</comment>
                    <comment id="15574" author="bigbadbassman" created="Thu, 24 Mar 2011 04:56:07 +0000"  >&lt;p&gt;Test Case of Non-Equal Self-Referencing Relations, based on #&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-329&quot; title=&quot;Problem saving Self Referencing (Nest Relations)&quot;&gt;DC-329&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Failure occures in line 75 of the test case file. This should not happen!&lt;br/&gt;
Only the parent object is modified in line 73 and saving should not interfere with the relations.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10958" name="DC952TestCase.php" size="4075" author="bigbadbassman" created="Thu, 24 Mar 2011 04:56:07 +0000" />
                </attachments>
            <subtasks>
            <subtask id="12323">DC-958</subtask>
        </subtasks>
        </item>

<item>
            <title>[DC-962] Broken logic when doctrine translates limit&apos;s into subqueries, with joins. (with patch)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-962</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Problem exists when Doctrine formulates a subquery to perform a limit when a join in included.&lt;/p&gt;

&lt;p&gt;The problem is that the where clause that doctrine creates for the subquery (the WHERE IN clause) is inserted as the first where clause.&lt;br/&gt;
This will break the parameter duplicate done at Doctrine_Query_Abstract:969, as the order of the parameters is now wrong.&lt;/p&gt;

&lt;p&gt;Consider:&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 * from table
join metadata WITH c = ?
where a = ? and b = ?
limit 1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;with parameters be (1, 2, 3)&lt;/p&gt;

&lt;p&gt;Doctrine will translate 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; 
select * from table
join metadata WITH c = ?
where table.id IN (
    select id from table
    join metadata WITH c = ?
    where a = ? and b = ?
    limit 1
)
and a = ? and b = ?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Doctrine will duplicate the params (Doctrine_Query_Abstract:969) to (1, 2, 3, 1, 2, 3), but now they are in the wrong order completely.&lt;br/&gt;
They should be (1,1,2,3,2,3).&lt;/p&gt;

&lt;p&gt;The easy fix is to move the limit subquery to the LAST where clause, which would reuslt in a query like so:&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 * from table
join metadata WITH c = ?
where a = ? and b = ?
and table.id IN (
    select id from table
    join metadata WITH c = ?
    where a = ? and b = ?
    limit 1
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Attached is a patch to fix this issue, along with a patch that fixes all unit tests referring to the old query format.&lt;/p&gt;</description>
                <environment>All</environment>
            <key id="12347">DC-962</key>
            <summary>Broken logic when doctrine translates limit&apos;s into subqueries, with joins. (with patch)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ben.davies">Ben Davies</reporter>
                        <labels>
                    </labels>
                <created>Wed, 2 Feb 2011 10:11:22 +0000</created>
                <updated>Wed, 2 Feb 2011 10:19:59 +0000</updated>
                                    <version>1.2.3</version>
                                                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15207" author="ben.davies" created="Wed, 2 Feb 2011 10:19:59 +0000"  >&lt;p&gt;upping to blocker since this breaks very basic queries&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10926" name="Query.php.patch" size="1381" author="ben.davies" created="Wed, 2 Feb 2011 10:11:22 +0000" />
                    <attachment id="10927" name="Tests.patch" size="17500" author="ben.davies" created="Wed, 2 Feb 2011 10:11:22 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-972] MySQL field aliases with triple ticks</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-972</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In revision 7691 something has happened. Ever since I updated my Doctrine to that revision all my queries having &quot; ... fieldname AS aliasname ... &quot; go crazy and make the PHP to throw an exception, like this:&lt;/p&gt;

&lt;p&gt;&apos;Doctrine_Connection_Mysql_Exception&apos; with message &apos;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S22&amp;#93;&lt;/span&gt;: Column not found: 1054 Unknown column &apos;t.`id`&apos; in &apos;field list&apos;.  Failing Query:&lt;br/&gt;
&quot;SELECT `t`.`id` AS `t_&lt;em&gt;id`, `t`.```id``` AS `t&lt;/em&gt;&lt;em&gt;0`, `t`.```name``` AS `t&lt;/em&gt;&lt;em&gt;1`, `t`.`id` AS `t&lt;/em&gt;&lt;em&gt;0`, `t`.`name` AS `t&lt;/em&gt;_1` FROM `territoryCombined` `t` ORDER BY `t`.`name` asc&quot;&apos;&lt;br/&gt;
in ...path here.../doctrine/lib/Doctrine/Connection.php:1082&lt;/p&gt;

&lt;p&gt;The problem is that the DQL parser somewhere along the process encapsualtes aliases in ticks, but then it does it again in lib/Doctrine/Formatter.php : quoteIdentifier() , which is called in lib/Doctrine/Connection : quoteIdentifier() , which is called in lib/Doctrine/Query.php : processPendingFields() @ between lines 485 and 512. The problem is that by the time the alias name gets to line 507 it is already encapsualted in ticks, but it does it again. At the end we end up with ```alias``` , which is not good.&lt;/p&gt;

&lt;p&gt;It only happens to aliases. If I say select(&apos;*&apos;) or select(&quot;t.id, t.name&quot;) then it executes properly. Only the aliases couse problems.&lt;/p&gt;

&lt;p&gt;A test query:&lt;/p&gt;

&lt;p&gt;$vTerritories = Doctrine_Query::create()&lt;br/&gt;
                    -&amp;gt;select(&quot;t.id as territory_id, t.name as territory_name&quot;)&lt;br/&gt;
                    -&amp;gt;from(&apos;TerritoryCombined t&apos;)&lt;br/&gt;
                    -&amp;gt;orderBy(&apos;t.name asc&apos;)&lt;br/&gt;
                    -&amp;gt;fetchArray();&lt;/p&gt;


&lt;p&gt;MY PROPOSED PATCH:&lt;/p&gt;

&lt;p&gt;If I change the Formatter::quoteIdentifier() to this:&lt;/p&gt;

&lt;p&gt;    public function quoteIdentifier($str, $checkOption = true)&lt;/p&gt;
    {
        $tmp = $this-&amp;gt;conn-&amp;gt;identifier_quoting; // I move up this line to here because I need it

        if ( (substr($str, 0, 1) == $tmp[&apos;start&apos;]) &amp;amp;&amp;amp; (substr($str, -1) == $tmp[&apos;end&apos;]) ) return $str; // new line; is it already quoted? if yes, then don&apos;t do it again

        // the rest is unchanged
    }

&lt;p&gt;then it works correctly. Please note I only tested that in MySQL, as we use MySQL in all our projects.&lt;/p&gt;</description>
                <environment>MySQL 5, PHP 5</environment>
            <key id="12396">DC-972</key>
            <summary>MySQL field aliases with triple ticks</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="hroland">Roland Huszti</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Feb 2011 11:14:24 +0000</created>
                <updated>Wed, 16 Feb 2011 11:14:24 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10941" name="BaseTerritoryCombined.php" size="2337" author="hroland" created="Wed, 16 Feb 2011 11:14:24 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1021] i am executing doctrine type query i am geting error  please gave me reply</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1021</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;$query = new Doctrine_Query();&lt;br/&gt;
$query-&amp;gt;select(&apos;e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,c.country_id,c.country_name&apos;)&lt;br/&gt;
//$query-&amp;gt;select(&apos;e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,ea.Country&apos;)&lt;br/&gt;
-&amp;gt;from(&apos;Entities e&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;e.EntityAddresses ea ON ea.entity_id = e.entity_id AND ea.address_type =&quot;M&quot;&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ea.Country c ON ea.country = c.country_id&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;e.ActiveFactories s&apos;)&lt;br/&gt;
-&amp;gt;where(&apos;e.status=1&apos;);&lt;br/&gt;
if(!empty($alpha))&lt;br/&gt;
{&lt;br/&gt;
$query-&amp;gt;andWhere(&quot;e.entity_name like &apos;&quot;.$alpha.&quot;%&apos;&quot;);&lt;br/&gt;
}&lt;br/&gt;
$query-&amp;gt;andWhere(&quot;s.company_id=&quot;.$parentId)&lt;br/&gt;
-&amp;gt;andWhere(&quot;e.entity_type=2&quot;)&lt;br/&gt;
-&amp;gt;andWhere(&apos;s.status=1&apos;)&lt;br/&gt;
-&amp;gt;groupBy(&apos;e.entity_id&apos;);&lt;/p&gt;</description>
                <environment>windows ,wamp,php</environment>
            <key id="12849">DC-1021</key>
            <summary>i am executing doctrine type query i am geting error  please gave me reply</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="rajani">cherukuri</reporter>
                        <labels>
                    </labels>
                <created>Sun, 24 Jul 2011 15:05:33 +0000</created>
                <updated>Sun, 24 Jul 2011 15:05:33 +0000</updated>
                                    <version>1.2.3</version>
                                <fixVersion>1.2.4</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1025] Doctrine is unable to handle table names with spaces</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1025</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When trying to query a table which contains spaces I get the following exception&lt;/p&gt;

&lt;p&gt;I have attached an simple example to reproduce&lt;/p&gt;


&lt;p&gt;C:\Documents and Settings\daniel\Dokumenter\NetBeansProjects\test&amp;gt;php doctrineTest.php&lt;/p&gt;

&lt;p&gt;Fatal error: Uncaught exception &apos;Doctrine_Query_Exception&apos; with message &apos;Unknown table alias with&apos; in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php:856&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 C:\Doctrine-1.2.3\Doctrine\Query.php(1022): Doctrine_Query_Abstract-&amp;gt;getComponentAlias(&apos;with&apos;)&lt;br/&gt;
#1 C:\Doctrine-1.2.3\Doctrine\Query.php(1239): Doctrine_Query-&amp;gt;_buildSqlFromPart()&lt;br/&gt;
#2 C:\Doctrine-1.2.3\Doctrine\Query.php(1133): Doctrine_Query-&amp;gt;buildSqlQuery(true)&lt;br/&gt;
#3 C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php(958): Doctrine_Query-&amp;gt;getSqlQuery(Array)&lt;br/&gt;
#4 C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php(1026): Doctrine_Query_Abstract-&amp;gt;_execute(Array)&lt;br/&gt;
#5 C:\Documents and Settings\daniel\Dokumenter\NetBeansProjects\test\doctrineTest.php(18): Doctrine_Query_Abstract-&amp;gt;execute()&lt;br/&gt;
#6 &lt;/p&gt;
{main}
&lt;p&gt;  thrown in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php on line 856&lt;/p&gt;</description>
                <environment>PHP Version 5.2.14&lt;br/&gt;
Apache 2&lt;br/&gt;
MySQL&lt;br/&gt;
Windows Xp</environment>
            <key id="12892">DC-1025</key>
            <summary>Doctrine is unable to handle table names with spaces</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="sajbar">Daniel Borg</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Aug 2011 07:43:13 +0000</created>
                <updated>Tue, 2 Aug 2011 10:37:03 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="11041" name="doctrineTest.php" size="509" author="sajbar" created="Tue, 2 Aug 2011 07:43:14 +0000" />
                    <attachment id="11042" name="tbl.php" size="810" author="sajbar" created="Tue, 2 Aug 2011 07:43:14 +0000" />
                    <attachment id="11043" name="tbl_1.php" size="234" author="sajbar" created="Tue, 2 Aug 2011 07:43:14 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1031] CLONE -Multiple connections and i18n (raised as unresolved - original ticket marked as resolved)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1031</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I used to work with a single database named &quot;doctrine&quot;. The query was working properly.&lt;/p&gt;

&lt;p&gt;I then decided to use 2 databases so I got my schema like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;connection: doctrine&lt;/p&gt;

&lt;p&gt;Category:&lt;br/&gt;
  actAs:&lt;br/&gt;
    I18n:&lt;br/&gt;
      actAs:&lt;br/&gt;
        Sluggable:&lt;br/&gt;
          fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;name&amp;#93;&lt;/span&gt;&lt;br/&gt;
        Timestampable: ~&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;name, description&amp;#93;&lt;/span&gt;&lt;br/&gt;
  columns:&lt;br/&gt;
    id: ~&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
      notnull: true&lt;br/&gt;
    description: string&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  connection: second&lt;br/&gt;
  columns:&lt;br/&gt;
    id: ~&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
      notnull: true&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I did setup my connections in config/databases.yml this way:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;all:&lt;br/&gt;
  doctrine:&lt;br/&gt;
   // ....&lt;br/&gt;
  second:&lt;br/&gt;
   // ....&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;build-model, build-forms, build-filters and cc got ran. But now, I got an exception saying the &quot;Translation&quot; relation doesn&apos;t exist. The Base Models include correctly the bindComponent line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Doctrine_Manager::getInstance()-&amp;gt;bindComponent(&apos;Category&apos;, &apos;doctrine&apos;);&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;For now, I managed to kind of fixing it with simply swapping the databases order in my config/databases.yml and it&apos;s now working again perfectly.&lt;/p&gt;

&lt;p&gt;I forgot to mention that in the CategoryTable when i call $this-&amp;gt;getConnection()-&amp;gt;getName(), it outputs &quot;second&quot;&lt;/p&gt;</description>
                <environment>MySQL 5.1.37&lt;br/&gt;
PHP 5.2.11&lt;br/&gt;
symfony 1.2.11 DEV&lt;br/&gt;
&lt;br/&gt;
symfony 1.4.13&lt;br/&gt;
PHP 5.3.6 &lt;br/&gt;
Postgres 8.4.8&lt;br/&gt;
</environment>
            <key id="12962">DC-1031</key>
            <summary>CLONE -Multiple connections and i18n (raised as unresolved - original ticket marked as resolved)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="sarcas">James Bell</reporter>
                        <labels>
                    </labels>
                <created>Tue, 23 Aug 2011 14:26:27 +0000</created>
                <updated>Wed, 28 Mar 2012 08:20:53 +0000</updated>
                                    <version>1.2.2</version>
                <version>1.2.3</version>
                                <fixVersion>1.2.3</fixVersion>
                                <component>Connection</component>
                <component>I18n</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16370" author="sarcas" created="Tue, 23 Aug 2011 14:28:15 +0000"  >&lt;p&gt;Original issue: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-363&quot; title=&quot;Multiple connections and i18n&quot;&gt;&lt;del&gt;DC-363&lt;/del&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-363&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-363&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;There are some additional comments in there that explain the issue as currently being seen in released versions of Doctrine 1.2. Can I help verify that this is the same ticket? &lt;/p&gt;

&lt;p&gt;What is needed to help with debug (in addition to the extra information already provided)?&lt;/p&gt;
</comment>
                    <comment id="17664" author="lvqingan" created="Wed, 28 Mar 2012 08:20:53 +0000"  >&lt;p&gt;meet the same issue and it really blocked my project, seems no one will maintain 1.x. I&apos;m considering whether to replace symfony 1.4 with 2.0.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1034] ORA-00904 in Doctrine_Connection_Oracle</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1034</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When i execute this 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; 
$q = Doctrine_Query::create()
            -&amp;gt;from(&apos;AGENT ag&apos;)
            -&amp;gt;leftJoin(&apos;ag.CHANTIER_AGENT cag)
            -&amp;gt;orderBy(&apos;ag.nom&apos;)
            -&amp;gt;limit(10)
            -&amp;gt;offset(10)
            -&amp;gt;execute();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Doctrine executes :&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 a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, 
c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent 
FROM AGENT a 
LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent 
WHERE a.ck_agent IN 
(SELECT b.ck_agent 
FROM ( SELECT a.*, ROWNUM AS doctrine_rownum 
FROM ( SELECT DISTINCT a2.ck_agent, a2.nom FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) 
a2 ) 
b 
WHERE doctrine_rownum BETWEEN 11 AND 20) 
ORDER BY a.nom
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;The problem is in function _createLimitSubquery in Doctrine_Connection_Oracle :&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= &apos;SELECT &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;b&apos;).&apos;.&apos;.$column.&apos; FROM ( &apos;.
                                 &apos;SELECT &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;a&apos;).&apos;.*, ROWNUM AS doctrine_rownum FROM ( &apos;
                                   . $query . &apos; ) &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;a&apos;) . &apos; &apos;.
                              &apos; ) &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;b&apos;) . &apos; &apos;.
                              &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Error occures, because table name is  AGENT and Doctrine give the first letter of the table name for identifier. &lt;br/&gt;
To correct this. Use more than one letter in the quoteIdentifier.&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 = &apos;SELECT &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;limb&apos;).&apos;.&apos;.$column.&apos; FROM ( &apos;.
                                 &apos;SELECT &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;lima&apos;).&apos;.*, ROWNUM AS doctrine_rownum FROM ( &apos;
                                   . $query . &apos; ) &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;lima&apos;) . &apos; &apos;.
                              &apos; ) &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier(&apos;limb&apos;) . &apos; &apos;.
                              &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; </description>
                <environment>Windows 7 64 bits, PHP 5.2.11, Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi, Symfony 1.4.13&lt;br/&gt;
</environment>
            <key id="12987">DC-1034</key>
            <summary>ORA-00904 in Doctrine_Connection_Oracle</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jayson">Jayson LE PAPE</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Sep 2011 08:43:20 +0000</created>
                <updated>Thu, 1 Sep 2011 08:43:20 +0000</updated>
                                    <version>1.2.4</version>
                                <fixVersion>1.2.4</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1035] ORA-01791 due to bad driver name in Doctrine_Adapter_Oracle</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1035</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When i execute this 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; 
$q = Doctrine_Query::create()
            -&amp;gt;from(&apos;AGENT ag&apos;)
            -&amp;gt;leftJoin(&apos;ag.CHANTIER_AGENT cag)
            -&amp;gt;orderBy(&apos;ag.nom&apos;)
            -&amp;gt;limit(10)
            -&amp;gt;execute();
$q2 = Doctrine_Query::create()
            -&amp;gt;from(&apos;AGENT ag&apos;)
            -&amp;gt;leftJoin(&apos;ag.CHANTIER_AGENT cag)
            -&amp;gt;orderBy(&apos;ag.nom&apos;)
            -&amp;gt;limit(10)
            -&amp;gt;execute();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Doctrine executes :&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 a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, 
a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, 
c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent 
FROM AGENT a 
LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent 
WHERE a.ck_agent IN (
SELECT a2.ck_agent FROM ( 
SELECT DISTINCT a2.ck_agent, a2.nom FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) 
a2 WHERE ROWNUM &amp;lt;= 10) ORDER BY a.nom

SELECT a.pk AS a__pk, a.ts AS a__ts, a.ck_agent AS a__ck_agent, a.matricule AS a__matricule, a.nom AS a__nom, 
a.prenom AS a__prenom, a.agent_maitrise AS a__agent_maitrise, c.pk AS c__pk, c.ts AS c__ts, c.ck_chantier_agent AS c__ck_chantier_agent, 
c.ek_chantier AS c__ek_chantier, c.fk_chantier AS c__fk_chantier, c.ek_agent AS c__ek_agent, c.fk_agent AS c__fk_agent 
FROM AGENT a 
LEFT JOIN CHANTIER_AGENT c ON a.ck_agent = c.ek_agent 
WHERE a.ck_agent IN (
SELECT a2.ck_agent FROM ( 
SELECT DISTINCT a2.ck_agent FROM AGENT a2 LEFT JOIN CHANTIER_AGENT c2 ON a2.ck_agent = c2.ek_agent ORDER BY a2.nom ) 
a2 WHERE ROWNUM &amp;lt;= 10) ORDER BY a.nom
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;This causes &quot;Oracle DB Error ORA-01791 not a SELECTed expression&quot; because the sql query don&apos;t have a2.nom in SELECT DISTINCT and it&apos;s indispensable for ORDER BY a2.nom&lt;br/&gt;
The problem is caused by the variable $attributes in Doctrine_Adapter_Oracle :&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;protected&lt;/span&gt; $attributes = array(Doctrine_Core::ATTR_DRIVER_NAME    =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;oci8&quot;&lt;/span&gt;,
                                  Doctrine_Core::ATTR_ERRMODE        =&amp;gt; Doctrine_Core::ERRMODE_SILENT);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The problem is in Query.php line 1417 : &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;if&lt;/span&gt; ($driverName == &apos;pgsql&apos; || $driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos; || $driverName == &apos;mssql&apos; || $driverName == &apos;odbc&apos;) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The driver name declared in Doctrine_Adapter_Oracle not in this conditional. &lt;br/&gt;
To resolve this we have to modify the declaration of $attributes in Doctrine_Adapter_Oracle 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;protected&lt;/span&gt; $attributes = array(Doctrine_Core::ATTR_DRIVER_NAME    =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;oracle&quot;&lt;/span&gt;,
                                  Doctrine_Core::ATTR_ERRMODE        =&amp;gt; Doctrine_Core::ERRMODE_SILENT);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;An other problem is probably located at line 1409 &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;if&lt;/span&gt; (($driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos;) &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_isOrderedByJoinedColumn()) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and 1497&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;if&lt;/span&gt; (($driverName == &apos;oracle&apos; || $driverName == &apos;oci&apos;) &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_isOrderedByJoinedColumn()) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;if don&apos;t correct the declaration of $attributes in Doctrine_Adapter_Oracle.&lt;/p&gt;</description>
                <environment>Windows 7 64 bits, PHP 5.2.11, Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi, Symfony 1.4.13</environment>
            <key id="12988">DC-1035</key>
            <summary>ORA-01791 due to bad driver name in Doctrine_Adapter_Oracle</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jayson">Jayson LE PAPE</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Sep 2011 09:30:57 +0000</created>
                <updated>Thu, 1 Sep 2011 09:31:24 +0000</updated>
                                    <version>1.2.4</version>
                                <fixVersion>1.2.4</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1040] allow queries with table joins across different databases</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1040</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I&apos;m currently working on a project which relies upon several databases declared in databases.yml in symfony 1.4.8.&lt;/p&gt;

&lt;p&gt;I was facing an issue that has already been raised by other people, namely that you can&apos;t join tables which reference each other among different mysql databases.&lt;/p&gt;

&lt;p&gt;I&apos;ve dug a bit in the Doctrine_Query class and came to a solution that is acceptable for us, and allows now to make joins accross databases. Description follows :&lt;/p&gt;

&lt;p&gt;first change is in the Doctrine_Core class, that gets stuffed with a new constant :&lt;br/&gt;
const ATTR_DATABASE_NAME                = 0x1DB;&lt;/p&gt;

&lt;p&gt;this constant allows us to add a new attribute to the databases.yml file as in :&lt;br/&gt;
  gesdoc:&lt;br/&gt;
    class: sfDoctrineDatabase&lt;br/&gt;
    param:&lt;br/&gt;
      dsn:      mysql:host=127.0.0.1;dbname=gesdoc&lt;br/&gt;
      username: root&lt;br/&gt;
      password: &lt;br/&gt;
      attributes:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;************* NEW ATTRIBUTE BELOW ************&lt;br/&gt;
        database_name: gesdoc&lt;br/&gt;
        default_table_collate: utf8_general_ci&lt;br/&gt;
        default_table_charset: utf8&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;after that, a few changes have been done in the Doctrine_Query class which is attached to this issue for the sake of readability.&lt;/p&gt;

&lt;p&gt;This may not be optimal, and probably need some regression testing, but it is currently working fine on our test server.&lt;/p&gt;

&lt;p&gt;after this is done, I was able to issue queries like the following :&lt;br/&gt;
    $x = DocumentTable::getInstance()-&amp;gt;createQuery(&apos;d&apos;)&lt;br/&gt;
                                     -&amp;gt;distinct()&lt;br/&gt;
                                     -&amp;gt;leftJoin(&apos;d.Travail t&apos;)&lt;br/&gt;
                                     -&amp;gt;leftJoin(&apos;t.CdcIndInt ci&apos;)&lt;br/&gt;
                                     -&amp;gt;leftJoin(&apos;ci.CdcIndExt ce&apos;)&lt;br/&gt;
                                     -&amp;gt;leftJoin(&apos;ce.Cahierdescharge cdc&apos;)&lt;br/&gt;
                                     -&amp;gt;where(&apos;cdc.cdc_chro = ?&apos;, $cdc_chro)&lt;br/&gt;
                                    -&amp;gt;addWhere(&apos;d.id != ?&apos;, $document_id)&lt;br/&gt;
                                    -&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;where the referenced tables are in different databases. The necessary object binding has been done in every model class following the paradigm :&lt;/p&gt;

&lt;p&gt;Doctrine_Manager::getInstance()-&amp;gt;bindComponent(&apos;CdcIndInt &apos;, &apos;gescdc&apos;);&lt;br/&gt;
abstract class BaseCdcIndInt extends sfDoctrineRecord&lt;br/&gt;
{&lt;br/&gt;
...&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;I don&apos;t know if this description is clear enough, so let me know if something is missing/wrong.&lt;/p&gt;</description>
                <environment>Windows XP SP3, Apache 2, PHP 5.3, MySQL 5.1.36, Symfony 1.4.8, Doctrine 1.2.3</environment>
            <key id="13198">DC-1040</key>
            <summary>allow queries with table joins across different databases</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/blocker.png">Blocker</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="fabrice.agnello">Fabrice Agnello</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Nov 2011 14:42:03 +0000</created>
                <updated>Thu, 17 Nov 2011 14:42:03 +0000</updated>
                                    <version>1.2.3</version>
                                <fixVersion>1.2.3</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="11111" name="Query.php" size="86043" author="fabrice.agnello" created="Thu, 17 Nov 2011 14:42:03 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-347] AddPendingJoinConditions doesn&apos;t work if alias equals model name</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-347</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If the alias in a from-query is equal to the model name, I get an exception when executing the query after adding a &quot;pendingJoinCondition&quot;.&lt;/p&gt;

&lt;p&gt;See attached testCase.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10594">DC-347</key>
            <summary>AddPendingJoinConditions doesn&apos;t work if alias equals model name</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="jensen83">Christian Jaentsch</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Dec 2009 14:51:23 +0000</created>
                <updated>Fri, 29 Jan 2010 06:50:10 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11517" author="hobodave" created="Fri, 29 Jan 2010 03:05:21 +0000"  >&lt;p&gt;I fail to see why you would use an alias that is equal to the model name.&lt;/p&gt;</comment>
                    <comment id="11519" author="jensen83" created="Fri, 29 Jan 2010 06:50:10 +0000"  >&lt;p&gt;To clarify again: Using an alias equal to the model name is the same as not using an alias at all. The built sql is the same afterwards (and the addPendingJoinCondition behaviour is the same as well).&lt;/p&gt;

&lt;p&gt;I would not use an alias equal to the model name myself, but sometimes this is used in Doctrine core, e.g. in Doctrine_Relation_ForeignKey around line 60. So to solve the problem either all the core queries, where no alias or an alias equal to the model name is used, have to be rewritten or the behaviour of a respective query has to be changed somehow so that applying an addPendingJoinCondition is possible even in the given case.&lt;/p&gt;
</comment>
                </comments>
                    <attachments>
                    <attachment id="10223" name="AliasEqualsModelNameTestCase.php" size="2441" author="jensen83" created="Wed, 9 Dec 2009 14:51:23 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-371] Lazy loading - doctrine makes extra queries into db</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-371</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Just downloaded symfony 1.4&lt;/p&gt;

&lt;p&gt;First of all I have a query:&lt;/p&gt;

&lt;p&gt;                $q = \Doctrine_Query::create()&lt;br/&gt;
                    -&amp;gt;select(&apos;u.&lt;b&gt;, ur.&lt;/b&gt;&apos;)&lt;br/&gt;
                    -&amp;gt;from(&apos;UserDb u&apos;)&lt;br/&gt;
                    -&amp;gt;leftJoin(&apos;u.RealUserDetailsDb ur&apos;)&lt;br/&gt;
                    -&amp;gt;leftJoin(&apos;u.MockUserDetailsDb um&apos;)&lt;br/&gt;
                    -&amp;gt;where(&apos;u.id = :user_id&apos;)&lt;br/&gt;
                ;&lt;br/&gt;
                $user = $q-&amp;gt;fetchOne(array(&apos;:user_id&apos; =&amp;gt; $uid));&lt;/p&gt;

&lt;p&gt;After that I&apos;m accessing the fields of this object:&lt;/p&gt;

&lt;p&gt;                $userArray = array(&lt;br/&gt;
                    &apos;id&apos; =&amp;gt; $this-&amp;gt;getUser()-&amp;gt;getId(),&lt;br/&gt;
                    &apos;real_user_details_id&apos; =&amp;gt; $this-&amp;gt;getUser()-&amp;gt;getRealUserDetailsId(),&lt;br/&gt;
                    &apos;mock_user_details_id&apos; =&amp;gt; $this-&amp;gt;getUser()-&amp;gt;getMockUserDetailsId(),&lt;br/&gt;
                    &apos;real_user_details&apos; =&amp;gt; array(),&lt;br/&gt;
                    &apos;mock_user_details&apos; =&amp;gt; array()&lt;br/&gt;
                );&lt;/p&gt;

&lt;p&gt;This is the actual queries into DB:&lt;/p&gt;

&lt;p&gt;NR1:&lt;br/&gt;
SELECT u.id AS u_&lt;em&gt;id, u.user_real_id AS u&lt;/em&gt;&lt;em&gt;user_real_id, u.user_mock_id AS u&lt;/em&gt;&lt;em&gt;user_mock_id, u2.id AS u2&lt;/em&gt;&lt;em&gt;id, u2.nickname AS u2&lt;/em&gt;&lt;em&gt;nickname, u2.email AS u2&lt;/em&gt;_email FROM user u LEFT JOIN user_real u2 ON u.user_real_id = u2.id LEFT JOIN user_mock u3 ON u.user_mock_id = u3.id WHERE (u.id = :user_id)&lt;/p&gt;

&lt;p&gt;NR2:&lt;br/&gt;
SELECT u.id AS u_&lt;em&gt;id, u.user_real_id AS u&lt;/em&gt;&lt;em&gt;user_real_id, u.user_mock_id AS u&lt;/em&gt;_user_mock_id FROM user u WHERE (u.id = &apos;1&apos;) LIMIT 1&lt;/p&gt;

&lt;p&gt;As you can see there are TWO queries however there should be only one query. The problem is that u.user_real_id is NULL in database and when I do  &apos;real_user_details_id&apos; =&amp;gt; $this-&amp;gt;getUser()-&amp;gt;getRealUserDetailsId() doctrine does not have enough intelligence to understand that these fields have been already requested in NR1. If I comment this field, everything works well. &lt;/p&gt;

&lt;p&gt;SURPRISE! &lt;br/&gt;
And now a surprise... if I modify a little bit my first query: &quot;&lt;del&gt;&amp;gt;select(&apos;u.&lt;b&gt;&apos;)&quot; instead of , &quot;&lt;/del&gt;&amp;gt;select(&apos;u.&lt;/b&gt;,  ur.*&apos;)&quot; it WON&apos;T make TWO queries. It will make ONLY ONE!&lt;/p&gt;

&lt;p&gt;As you understand this a very critical bug and of course our system won&apos;t go to production with this bug. &lt;/p&gt;

&lt;p&gt;P.S. Is it possible to turn off the lazy loading in doctrine?&lt;/p&gt;</description>
                <environment>Symfony 1.4, Doctrine Version: 1.2.0-BETA3</environment>
            <key id="10636">DC-371</key>
            <summary>Lazy loading - doctrine makes extra queries into db</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="drapeko">Roman Drapeko</reporter>
                        <labels>
                    </labels>
                <created>Sat, 19 Dec 2009 22:53:48 +0000</created>
                <updated>Thu, 23 Dec 2010 20:22:10 +0000</updated>
                                    <version>1.2.0-BETA3</version>
                                                <component>Behaviors</component>
                <component>Documentation</component>
                <component>Query</component>
                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11405" author="drapeko" created="Sun, 17 Jan 2010 16:56:01 +0000"  >&lt;p&gt;Any comments? Will it be fixed??&lt;/p&gt;</comment>
                    <comment id="11893" author="jwage" created="Mon, 1 Mar 2010 15:52:49 +0000"  >&lt;p&gt;Hi, I&apos;d like to take a look but can you make a failing test case that I can run so that I can see if I can come up with a patch that fixes your case and doesn&apos;t break anything else.&lt;/p&gt;</comment>
                    <comment id="13087" author="lukis" created="Tue, 1 Jun 2010 13:11:16 +0000"  >&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;I had similar problem but after several hours i did work it out&lt;/p&gt;

&lt;p&gt;Try to make get method in your model for getting field which has NULL value in database&lt;/p&gt;

&lt;p&gt;public function getUserRealId() &lt;/p&gt;
{

  return $this-&amp;gt;_get(&quot;user_real_id&quot;, false);

}

&lt;p&gt;by making second argument false u force doctrine not to lazy load value and extra sql query is not created&lt;/p&gt;

&lt;p&gt;regards&lt;/p&gt;</comment>
                    <comment id="13207" author="jwage" created="Tue, 8 Jun 2010 16:31:53 +0000"  >&lt;p&gt;Has anyone been able to reproduce this in a test case? I am not having much luck so far.&lt;/p&gt;</comment>
                    <comment id="15001" author="gena01" created="Thu, 23 Dec 2010 20:22:10 +0000"  >&lt;p&gt;I&apos;ve seen this a ton of times. Basically when it loads related records through the Hydrator using leftJoin() and gets NULLs back. BUT it doesn&apos;t save the fact that the related records are NULL. So when you actually do call to getRelated objects it sees that it doesn&apos;t have the value cached and runs the query again.&lt;/p&gt;

&lt;p&gt;Let me know if I should show you the problem in the Doctrine code base.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-489] Doctrine_Record seems to have a bug with default values when updating</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-489</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;So lets see the table:&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  tableName: users&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(1)&lt;br/&gt;
      fixed: false&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    username:&lt;br/&gt;
      type: string(32)&lt;br/&gt;
      fixed: false&lt;br/&gt;
      unsigned: false&lt;br/&gt;
      primary: false&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: false&lt;br/&gt;
    password:&lt;br/&gt;
      type: string(48)&lt;br/&gt;
      fixed: false&lt;br/&gt;
      unsigned: false&lt;br/&gt;
      primary: false&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: false&lt;br/&gt;
    role:&lt;br/&gt;
      type: enum&lt;br/&gt;
      fixed: false&lt;br/&gt;
      unsigned: false&lt;br/&gt;
      values:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;admin&lt;/li&gt;
	&lt;li&gt;support&lt;br/&gt;
      default: support                 &amp;lt;----- &lt;span class=&quot;error&quot;&gt;Unable to render embedded object: File (ROOT OF EVIL) not found.&lt;/span&gt;&lt;br/&gt;
      primary: false&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: false&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So lets say we have a user with `role` = &apos;support&apos; and want to set em&lt;br/&gt;
&apos;admin&apos; we wrote&lt;/p&gt;

&lt;p&gt;$user = new App_Model_User();&lt;br/&gt;
$user-&amp;gt;assignIdentifier(1);&lt;br/&gt;
$user-&amp;gt;role = &apos;admin&apos;;&lt;br/&gt;
$user-&amp;gt;save();&lt;br/&gt;
var_dump($user-&amp;gt;toArray());&lt;/p&gt;

&lt;p&gt;in debugger we see SQL query been made:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;0.55 ms&amp;#93;&lt;/span&gt; UPDATE users SET role = ? WHERE id = ?&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
	&lt;li&gt;bindings: admin&lt;/li&gt;
	&lt;li&gt;1&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;array(6) &lt;/p&gt;
{ [&quot;id&quot;]=&amp;gt;  int(1) [&quot;display_name&quot;]=&amp;gt;  string(13)
&quot;Administrator&quot; [&quot;username&quot;]=&amp;gt;  string(4) &quot;root&quot; [&quot;password&quot;]=&amp;gt;
string(40) &quot;45bb0f589525a2f0f2a48620bb59b1b8baef0c1d&quot; [&quot;role&quot;]=&amp;gt;
string(5) &quot;admin&quot; [&quot;is_active&quot;]=&amp;gt;  bool(true) }

&lt;p&gt;Superb! Works as it should! So lets now set role of this user back to&lt;br/&gt;
&apos;support&apos;:&lt;/p&gt;

&lt;p&gt;$user = new App_Model_User();&lt;br/&gt;
$user-&amp;gt;assignIdentifier(1);&lt;br/&gt;
$user-&amp;gt;role = &apos;support&apos;; // This value defined as default in scheme,&lt;br/&gt;
thats why have problems&lt;br/&gt;
$user-&amp;gt;save();&lt;br/&gt;
var_dump($user-&amp;gt;toArray());&lt;/p&gt;

&lt;p&gt;in debugger we didnot see any UPDATE queries! However object is been&lt;br/&gt;
changed, results just has not been flushed to database.&lt;/p&gt;

&lt;p&gt;array(6) &lt;/p&gt;
{ [&quot;id&quot;]=&amp;gt;  int(1) [&quot;display_name&quot;]=&amp;gt;  string(13)
&quot;Administrator&quot; [&quot;username&quot;]=&amp;gt;  string(4) &quot;root&quot; [&quot;password&quot;]=&amp;gt;
string(40) &quot;45bb0f589525a2f0f2a48620bb59b1b8baef0c1d&quot; [&quot;role&quot;]=&amp;gt;
string(7) &quot;support&quot; [&quot;is_active&quot;]=&amp;gt;  bool(true) }

&lt;p&gt;I cant overcome this problem right now, unfortunatelly (well I can&lt;br/&gt;
just remove all default values from table definitions or use&lt;br/&gt;
Doctrine_Query for updating staff.. but I&apos;d like to use models &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;

&lt;p&gt;However if I use Doctrine_Query of even&lt;/p&gt;

&lt;p&gt;$user = Doctrine_Core::getTable(&apos;App_Model_User&apos;)-&amp;gt;find(1);&lt;/p&gt;

&lt;p&gt;instead of&lt;/p&gt;

&lt;p&gt;$user = new App_Model_User();&lt;br/&gt;
$user-&amp;gt;assignIdentifier(1);&lt;/p&gt;

&lt;p&gt;updates works well...&lt;/p&gt;</description>
                <environment>PHP 5.2.11</environment>
            <key id="10858">DC-489</key>
            <summary>Doctrine_Record seems to have a bug with default values when updating</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="silverstorm">Silver</reporter>
                        <labels>
                    </labels>
                <created>Wed, 10 Feb 2010 15:15:34 +0000</created>
                <updated>Thu, 20 Jan 2011 08:53:02 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="15153" author="elijen" created="Thu, 20 Jan 2011 08:52:31 +0000"  >&lt;p&gt;I second this.&lt;/p&gt;

&lt;p&gt;When you UPDATE row with save() method of Record after setting identifier by assignIdentifier() doctrine removes columns updates from SQL which are set to default values same as it would do with INSERT. Other columns are updated correctly. This is sure a bug.&lt;/p&gt;

&lt;p&gt;You can workaround this by setting the value as NULL instead of the actual default value. (Which I wouldn&apos;t recommend).&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-515] HYDRATE_RECORD_HIERARCHY broken with many roots</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-515</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;DB schema:&lt;/p&gt;

&lt;p&gt;Category:&lt;br/&gt;
  actAs:&lt;br/&gt;
    NestedSet:&lt;br/&gt;
      hasManyRoots: true&lt;br/&gt;
      rootColumnName: root_id&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(64)&lt;br/&gt;
      notnull: true&lt;br/&gt;
    image: string(64)&lt;br/&gt;
  indexes:&lt;br/&gt;
    tree:&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;lft, rgt, root_id&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Sample data:&lt;/p&gt;

&lt;p&gt;id: &apos;1&apos;                                                                   &lt;br/&gt;
  name: &apos;Przyk&#322;adowa kategoria 1&apos;                                           &lt;br/&gt;
  image: null                                                               &lt;br/&gt;
  root_id: &apos;1&apos;                                                              &lt;br/&gt;
  lft: &apos;1&apos;                                                                  &lt;br/&gt;
  rgt: &apos;6&apos;                                                                  &lt;br/&gt;
  level: &apos;0&apos;                                                                &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;p&gt;  id: &apos;2&apos;                                                                   &lt;br/&gt;
  name: &apos;Przyk&#322;adowa kategoria 2&apos;                                           &lt;br/&gt;
  image: null                                                               &lt;br/&gt;
  root_id: &apos;2&apos;&lt;br/&gt;
  lft: &apos;1&apos;&lt;br/&gt;
  rgt: &apos;6&apos;&lt;br/&gt;
  level: &apos;0&apos;&lt;br/&gt;
-&lt;br/&gt;
  id: &apos;3&apos;&lt;br/&gt;
  name: &apos;Przyk&#322;adowa podkategoria 1&apos;&lt;br/&gt;
  image: null&lt;br/&gt;
  root_id: &apos;2&apos;&lt;br/&gt;
  lft: &apos;2&apos;&lt;br/&gt;
  rgt: &apos;5&apos;&lt;br/&gt;
  level: &apos;1&apos;&lt;br/&gt;
-&lt;br/&gt;
  id: &apos;4&apos;&lt;br/&gt;
  name: &apos;Przyk&#322;adowa podkategoria 2&apos;&lt;br/&gt;
  image: null&lt;br/&gt;
  root_id: &apos;2&apos;&lt;br/&gt;
  lft: &apos;3&apos;&lt;br/&gt;
  rgt: &apos;4&apos;&lt;br/&gt;
  level: &apos;2&apos;&lt;br/&gt;
-&lt;br/&gt;
  id: &apos;5&apos;&lt;br/&gt;
  name: teset1&lt;br/&gt;
  image: null&lt;br/&gt;
  root_id: &apos;1&apos;&lt;br/&gt;
  lft: &apos;2&apos;&lt;br/&gt;
  rgt: &apos;5&apos;&lt;br/&gt;
  level: &apos;1&apos;&lt;br/&gt;
-&lt;br/&gt;
  id: &apos;6&apos;&lt;br/&gt;
  name: test2&lt;br/&gt;
  image: null&lt;br/&gt;
  root_id: &apos;1&apos;&lt;br/&gt;
  lft: &apos;3&apos;&lt;br/&gt;
  rgt: &apos;4&apos;&lt;br/&gt;
  level: &apos;2&apos;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;When using HYDRATE_RECORD_HIERARCHY, the first top-level category is empty. Everything is assigned to the other one. Only single-root trees work properly.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10935">DC-515</key>
            <summary>HYDRATE_RECORD_HIERARCHY broken with many roots</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="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="krojew">Kamil Rojewski</reporter>
                        <labels>
                    </labels>
                <created>Mon, 22 Feb 2010 15:30:42 +0000</created>
                <updated>Wed, 9 Jun 2010 03:11:58 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12304" author="krojew" created="Wed, 17 Mar 2010 05:46:20 +0000"  >&lt;p&gt;If you look at Doctrine_Collection::toHierarchy() you&apos;ll notice that there is NO reference to root_id, therefore it treats the entire collection as 1 tree (which is false). The bug is 100% repeatable. I&apos;ve made a fast walkaround ba adding a multi-tree hydrator:&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 MultiRootHydrator &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Hydrator_RecordDriver
{
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function hydrateResultSet($stmt)
  {
    $result = parent::hydrateResultSet($stmt);

    $collection = array();
    foreach ($result as $item)
    {
      &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!isset($collection[$item-&amp;gt;root_id]))
        $collection[$item-&amp;gt;root_id] = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Collection($result-&amp;gt;getTable());

      $collection[$item-&amp;gt;root_id]-&amp;gt;add($item);
    }

    $result = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Collection($result-&amp;gt;getTable());
    foreach ($collection as $tree)
    {
      $tree = $tree-&amp;gt;toHierarchy();
      $record = $tree-&amp;gt;getFirst();

      $result-&amp;gt;add($record, $record-&amp;gt;root_id);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $result;
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It should clarify the problem.&lt;/p&gt;</comment>
                    <comment id="13206" author="jwage" created="Tue, 8 Jun 2010 16:31:25 +0000"  >&lt;p&gt;I think it was intended that you would only convert a single tree to a hierarchy. What would the structure of the returned data be like?&lt;/p&gt;</comment>
                    <comment id="13243" author="krojew" created="Wed, 9 Jun 2010 03:11:58 +0000"  >&lt;p&gt;A Doctrine_Collection with root nodes seems to work fine. It allows to traverse the tree for each root.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-586] Doctrine outputs invalid SQL when using Limit and Order By conditions in MSSQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-586</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have a Doctrine model which connects to a MSSQL database. I was trying to run the following query:&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;$q = Doctrine_Query::create()
    -&amp;gt;select(&apos;*&apos;)
    -&amp;gt;from(&apos;Comment c&apos;)
    -&amp;gt;innerJoin(&apos;c.RecordType&apos;)
    -&amp;gt;innerJoin(&apos;c.Department&apos;)
    -&amp;gt;limit(10)
    -&amp;gt;orderBy(&apos;c.Counter&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The code failed with a SQL Syntax exception so I took a look at the generated query and found the following (SELECT fields shortened for readabilty):&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 * FROM (
	SELECT TOP 10 * FROM (
		SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ...
		FROM comments c
			INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = &apos;RecordType&apos;
			INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = &apos;Department&apos;
		ORDER BY [c].[counter]
	) AS [inner_tbl]
	ORDER BY [inner_tbl].[counter] AS [c__counter] DESC
) AS [outer_tbl]
ORDER BY [outer_tbl].[counter] AS [c__counter] ASC
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As you can see, the ORDER BY clauses on the inner_tbl and outer_tbl segments have AS clauses which do not belong there. If you fix the ORDER BY statements the query runs just fine.&lt;/p&gt;

&lt;p&gt;So I decided to prod around the Mssql.php connection class and found the following:&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;140 &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;, $isSubQuery = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
141 {
...
169                    $field_array = explode(&apos;,&apos;, $fields_string);
170                    $field_array = array_shift($field_array);
171                    $aux2 = preg_split(&apos;/ as /&apos;, $field_array);
172                    $aux2 = explode(&apos;.&apos;, end($aux2));
173
174                    $aliases[$i] = trim(end($aux2));
...
232 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Line 171 seems to be in charge of setting up the orderBy aliases but it is looking for a lower case &apos; as &apos; string which doesn&apos;t exist in this SQL expression. Changing that to a case insensitive regular expression search seems to fix the problem:&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;171                    $aux2 = preg_split(&apos;/ as /i&apos;, $field_array);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here is the resulting SQL with the change:&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 * FROM (
	SELECT TOP 10 * FROM (
		SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ...
		FROM comments c
			INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = &apos;RecordType&apos;
			INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = &apos;Department&apos;
		ORDER BY [c].[counter]
	) AS [inner_tbl]
	ORDER BY [inner_tbl].[c__counter] DESC
) AS [outer_tbl]
ORDER BY [outer_tbl].[c__counter] ASC]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This seems to fix the problem but I don&apos;t know if it&apos;ll create a regression. It&apos;s a start though. Anyone have any thoughts on this?&lt;/p&gt;</description>
                <environment>Windows XP&lt;br/&gt;
Apache 2.2&lt;br/&gt;
PHP 5.3&lt;br/&gt;
Doctrine 1.2.1&lt;br/&gt;
Symfony 1.4</environment>
            <key id="11089">DC-586</key>
            <summary>Doctrine outputs invalid SQL when using Limit and Order By conditions in MSSQL</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="pradador">Jose Prado</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Mar 2010 19:08:42 +0000</created>
                <updated>Thu, 18 Mar 2010 19:08:42 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-644] _getCacheKeys() exhausts memory</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-644</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>
&lt;p&gt;My scripts have excessive memory consumption and I&apos;ve often saw in my logs:&lt;/p&gt;

&lt;p&gt;PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 2097152 bytes) in /proj/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Cache/Apc.php on line 111&lt;/p&gt;

&lt;p&gt;Looking into the code I&apos;ve found which function to blame:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;    protected function _getCacheKeys()&lt;br/&gt;
    {&lt;br/&gt;
        $ci = apc_cache_info(&apos;user&apos;);&lt;br/&gt;
        $keys = array();&lt;/p&gt;

&lt;p&gt;        foreach ($ci&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;cache_list&amp;#39;&amp;#93;&lt;/span&gt; as $entry) &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {          $keys[] = $entry[&amp;#39;info&amp;#39;]; ######### THIS IS THE LINE        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        return $keys;&lt;br/&gt;
    }&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;My server extensively uses APC caching and it&apos;s normal to have many cache keys.&lt;br/&gt;
Obviously retrieving ALL of them is time and memory consuming.&lt;br/&gt;
As I&apos;m not well versed with Doctrine&apos;s code, I didn&apos;t want to dive further in.&lt;/p&gt;

&lt;p&gt;Is there another way to avoid this pitfall? &lt;/p&gt;</description>
                <environment>Doctrine is installed as a Symfony plugin. Using the latest Symfony from SVN.</environment>
            <key id="11258">DC-644</key>
            <summary>_getCacheKeys() exhausts memory</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="colnector">Amir W</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Apr 2010 12:54:15 +0000</created>
                <updated>Wed, 6 Jul 2011 08:17:14 +0000</updated>
                                                                    <component>Caching</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12757" author="colnector" created="Mon, 26 Apr 2010 20:38:25 +0000"  >&lt;p&gt;Is there any patch that could be provided meanwhile? This is quite a problem on a live website.&lt;/p&gt;</comment>
                    <comment id="12887" author="colnector" created="Mon, 10 May 2010 02:44:24 +0000"  >&lt;p&gt;Is this not a critical issue for Doctrine&apos;s cache? It&apos;s been up for 2 weeks with not even a comment...&lt;/p&gt;</comment>
                    <comment id="12896" author="jwage" created="Mon, 10 May 2010 12:34:16 +0000"  >&lt;p&gt;Hi, what are you calling that is invoking _getCacheKeys()? The only methods that call it are the deleteBy*() methods. It is expected that these methods have to get the entire list of cache keys from the driver in order to perform the delete by operation. These cache clearing operations should probably be done in the CLI environment where the memory limits are higher. If you want to avoid _getCacheKeys() being invoked, then you must not use the deleteBy*() methods.&lt;/p&gt;</comment>
                    <comment id="12897" author="colnector" created="Mon, 10 May 2010 13:15:10 +0000"  >&lt;p&gt;Thank you for commenting. Yes, I am using deleteByRegex() since I need to expire some result cache entries upon an update operation. What other choice do I have if I wish to keep using the result cache offered by Doctrine? Is there any other mechanism?&lt;/p&gt;

&lt;p&gt;Can&apos;t _getCacheKeys() be optimized some way?&lt;/p&gt;</comment>
                    <comment id="12898" author="jwage" created="Mon, 10 May 2010 13:22:50 +0000"  >&lt;p&gt;No, it is not able to be optimized anymore. It has to load all the keys into a php array in memory in order to loop over them to compare against the regex. You should probably not be doing cache clearing operations in the browser under apache. If you do, you&apos;ll need to raise your memory limit.&lt;/p&gt;</comment>
                    <comment id="12899" author="colnector" created="Mon, 10 May 2010 13:29:32 +0000"  >&lt;p&gt;My code actually had a few of these calls and I&apos;ve now removed use of the result cache with Doctrine. What you&apos;re writing means the result cache is not usable for dynamic websites. IMHO, it&apos;s a good practice to cache results and remove them once an update is made to the data (which naturally can happen due to an update from a user). However, if that by itself creates an overload on the server (and as you know even a temporary memory abuse leads to an overload), I cannot see how it can be useful.&lt;br/&gt;
Please tell me if you think there&apos;s a way the results cache can still be usable for a dynamic website.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="12900" author="jwage" created="Mon, 10 May 2010 13:37:08 +0000"  >&lt;p&gt;This is the only way to allow more complex delete functionality. How you use it, is not up to us. We intended that cache clearing is done from the command line or in an environment where the memory limit is high enough to be able to load all those keys. It may not be able to be used by everyone, if it is not working for how you are using it then you will need to think of another solution I suppose.&lt;/p&gt;</comment>
                    <comment id="12901" author="colnector" created="Mon, 10 May 2010 13:58:34 +0000"  >&lt;p&gt;Thank you for your response and I&apos;ll think of another solution for my application.&lt;/p&gt;

&lt;p&gt;I did dive into the code and there&apos;s a relevant &lt;b&gt;optimization&lt;/b&gt; that could be made.&lt;/p&gt;

&lt;p&gt;_getCacheKeys() is actually creating another array for all the cache keys which needlessly increases the memory used.&lt;br/&gt;
If the deleteBy*() method would be implemented at the driver level (such as with Apc.php) and not at the general level (Driver.php as it is now) this array would not have to be created. It won&apos;t be such a code bloat and would surely lessen memory use.&lt;/p&gt;

&lt;p&gt;There could be a way around the problem which also implements another feature I miss with the results cache. By allowing some sort of cache tagging to mark the items that may need to be deleted we could easily delete relevant entries. I&apos;ll describe the interface here.&lt;/p&gt;

&lt;p&gt;Instead of &lt;br/&gt;
$q = $q-&amp;gt;useResultCache(true, 86400);&lt;/p&gt;

&lt;p&gt;There should be&lt;br/&gt;
$q = $q-&amp;gt;useTagResultCache(&apos;SomeTag&apos;, true, 86400);&lt;br/&gt;
which does the same PLUS update a cached variable (such as &apos;Doctrine_Result_Cache_Tag_SomeTag&apos;) which references the result cache keys of &apos;SomeTag&apos;.&lt;/p&gt;

&lt;p&gt;We can then easily implement deletion of relevant result cache entries with&lt;/p&gt;

&lt;p&gt;deleteByTag(&apos;SomeTag&apos;)&lt;/p&gt;

&lt;p&gt;which would read  &apos;Doctrine_Result_Cache_Tag_SomeTag&apos; to figure out which entries should be removed from the cache.&lt;/p&gt;

&lt;p&gt;I&apos;m pretty sure my usage scenario is not marginal but let me know what you think.&lt;/p&gt;</comment>
                    <comment id="12902" author="jwage" created="Mon, 10 May 2010 14:08:13 +0000"  >&lt;p&gt;This is already possible if I understand what you describe.&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;$q-&amp;gt;useResultCache(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, 3600, &apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you can do:&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;$cacheDriver-&amp;gt;delete(&apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also what you describe useTagResultCache() and keeping up with our own list of cache keys is the way it used to be and was changed to this after worse performance problems were discovered with that approach.&lt;/p&gt;</comment>
                    <comment id="12903" author="colnector" created="Mon, 10 May 2010 14:44:26 +0000"  >&lt;p&gt;Perhaps I&apos;ve been misunderstood so I&apos;ll try explain from the start.&lt;/p&gt;

&lt;p&gt;In my system a few queries do relate to the same pieces of information. That information can be updated by a user and thus I would need to remove anywhere between 0 and 50 related result cache variables. I cannot easily name each and every one of my queries thus giving a specific key name doesn&apos;t help. So what I did was to prefix the name of each of the queries to indicate that I&apos;ll know how to remove them. I may have thousands of results cached and would need to clear just a few. That&apos;s why I use the deleteBy*() which proves to be extremely inefficient as it retrieves ALL the keys in my cache driver and not only the Doctrine related ones.&lt;/p&gt;

&lt;p&gt;I really don&apos;t know how it has been implemented before but what I suggest wouldn&apos;t hurt performance as tagging would be an optional addition managed with another variable. If you think that won&apos;t b useful to other Doctrine users, I&apos;ll simply implement it for my system.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="12904" author="jwage" created="Mon, 10 May 2010 14:54:35 +0000"  >&lt;p&gt;I think the best solution is the one you suggested earlier. That each cache driver should directly implement this functionality and bypass the creation of the array. What do you think? It is backwards compatible so that way we can commit it in 1.2.&lt;/p&gt;</comment>
                    <comment id="12905" author="colnector" created="Mon, 10 May 2010 15:20:07 +0000"  >&lt;p&gt;Bypassing the array is a required optimization which is easy to implement but it&apos;s not really a solution to the problem I&apos;m facing and I believe is common enough (Zend_Cache for example implements tagging) and need to be offered. As it&apos;ll be 2 new functions that will implement tagging only when specifically requested, it&apos;ll also be backward compatible. The only thing I&apos;m not sure about is if an implementation of some locking mechanism would be needed for the cached variable which would hold the list of cache keys for a specific tag.&lt;/p&gt;</comment>
                    <comment id="12906" author="jwage" created="Mon, 10 May 2010 15:38:52 +0000"  >&lt;p&gt;Let me know what you come up with and we&apos;ll have a look at including it in the next 1.2.x release.&lt;/p&gt;</comment>
                    <comment id="12981" author="colnector" created="Sun, 16 May 2010 14:21:37 +0000"  >&lt;p&gt;Bypassing the extra array is still not good enough and IMHO the whole idea of deleteBy() should NOT be used if many such requests could be made, as is my case.&lt;/p&gt;

&lt;p&gt;What I&apos;ve done now is what I mentioned before with a patch that is quite ugly.&lt;/p&gt;

&lt;p&gt;In Doctrine/Query/Abstract.php right after the line&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;$cacheDriver-&amp;gt;save($hash, $cached, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getResultCacheLifeSpan());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ve added &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;if&lt;/span&gt; (!empty($GLOBALS[&apos;rcache_users_in_query&apos;])) {
                	MyCache::keepRelatedCacheKey($GLOBALS[&apos;rcache_users_in_query&apos;], $hash);
                }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which saves another cache key which holds the hash tags that would have to be deleted on an update.&lt;br/&gt;
My global variable is actually an array as a Doctrine query result may be associated with more than one user and possibly other parameters.&lt;br/&gt;
Before calling the $q-&amp;gt;execute(), I simply update this variable.&lt;/p&gt;

&lt;p&gt;When a user on my system does the update, I then delete all relevant Doctrine keys with something like&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;if&lt;/span&gt; (is_null($cacheDriver)) $cacheDriver = Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_RESULT_CACHE);
		
		foreach($arKeys as $key) {
			$cacheDriver-&amp;gt;delete($key);			
		}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then delete my other cache key.&lt;/p&gt;

&lt;p&gt;This solution works well for me. Sorry I cannot make a nice Doctrine patch for it as I&apos;m not well versed with your code. I still believe it should be supported by Doctrine with an optional extra parameter for $q-&amp;gt;useResultCache()&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="13191" author="hobodave" created="Tue, 8 Jun 2010 14:42:42 +0000"  >&lt;p&gt;Hi Amir,&lt;/p&gt;

&lt;p&gt;Zend_Cache does not implement tagging for either APC or Memcached backends, see the &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-460&quot; class=&quot;external-link&quot;&gt;documentation&lt;/a&gt;. It also likely never will, all requests for this functionality have been closed with Wont Fix.&lt;/p&gt;

&lt;p&gt;I don&apos;t think the deleteBy methods should have ever been implemented. When initially implemented they cached a &quot;doctrine_cache_keys&quot; variable to store the keys known to Doctrine. This however led to a crippling bug that would crash my production servers after a few hours. Not even a friendly &quot;out of memory&quot; limit, but a slowdown and eventual crash. Please see &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-460&quot; class=&quot;external-link&quot;&gt;DDC-460&lt;/a&gt; for details. Note that I don&apos;t use the magic delete methods, just simple saves with timeouts and this was affecting me.&lt;/p&gt;

&lt;p&gt;I fixed the solution as you&apos;ve seen using the _getCacheKeys() method. I don&apos;t believe this functionality should have ever been added to Doctrine to begin with, but this is what we have to work with. It should be the responsibility of the cache store to handle tagging and such, not poorly hacked on with application code.&lt;/p&gt;

&lt;p&gt;As it stands, the current implementation doesn&apos;t affect people who aren&apos;t even using this functionality, as it should be. As Jon suggested, you shouldn&apos;t be using this in the context of a page request. Use a CLI script or work on another solution. Your idea of tracking your keys in application code is a good idea, but it doesn&apos;t belong in Doctrine imo.&lt;/p&gt;</comment>
                    <comment id="13263" author="colnector" created="Thu, 10 Jun 2010 02:07:13 +0000"  >&lt;p&gt;Thanks David for your comment.&lt;/p&gt;

&lt;p&gt;I agree with you that my implementation should not belong in Doctrine and that tagging should have been a part of the cache backends.&lt;/p&gt;

&lt;p&gt;Continuing with the same logic you&apos;ve presented, deleteBy...() functionality **&lt;b&gt;should be removed&lt;/b&gt;** from Doctrine if it causes the system to crash as it does so in an obnoxious way so that it would take too long for most developers to notice this is where the problem lies. It has certainly taken too much of my time and efforts and I&apos;d rather save the pain from others.&lt;/p&gt;</comment>
                    <comment id="16119" author="carsten" created="Wed, 6 Jul 2011 08:17:13 +0000"  >&lt;p&gt;We had the exact same problem. We used a &quot;deleteAll()&quot; of a ApcCache object and ran into the &quot;allowed memory size exhausted&quot; pitfall. We helped ourselves with a new class that extends ApcCache and uses the simpler apc_clear_cache function.&lt;/p&gt;


&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
namespace Foo\Cache;

class ApcCache extends \Doctrine\Common\Cache\ApcCache
{
    /**
     * Delete all cache entries. Memory saving version...
     *
     * @return bool
     */
    public function deleteAll()
    {
        return apc_clear_cache(&apos;user&apos;);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
use Foo\Cache\ApcCache as Apc;
...
$this-&amp;gt;_apc = new Apc();
$this-&amp;gt;_apc-&amp;gt;deleteAll();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;This doesn&apos;t return the ids of the deleted entries like the original function but we don&apos;t need that. So this works fine for us.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-659] Sluggable behavior does not check uniqueness on insert if a slug is manually set, causing SQL error/crash</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-659</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The Sluggable behavior has the following code:
&lt;br class=&quot;atl-forced-newline&quot; /&gt;&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;Sluggable.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    /**
     * Set the slug value automatically when a record is inserted
     *
     * @param Doctrine_Event $event
     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; void
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preInsert(Doctrine_Event $event)
    {
        $record = $event-&amp;gt;getInvoker();
        $name = $record-&amp;gt;getTable()-&amp;gt;getFieldName($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_options[&apos;name&apos;]);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $record-&amp;gt;$name) {
            $record-&amp;gt;$name = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;buildSlugFromFields($record);
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;However, this can lead to problems...&lt;/p&gt;

&lt;p&gt;If the user incorrectly assigns a duplicate slug to the record then there is no uniqueness checking in doctrine and you get an uncaught SQL error looking something like this:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry &apos;my-slug-en_GB&apos; for key &apos;foo_i18n_sluggable_idx&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If this kind of &quot;don&apos;t do a preInsert check if I manunally set the slug&quot; behavior is a &lt;em&gt;FEATURE&lt;/em&gt; then it would be best to have an option to allow it to be disabled. If it is a &lt;em&gt;BUG&lt;/em&gt; then I would suggest that the preInsert method should be changed to:&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;Sluggable.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    /**
     * Set the slug value automatically when a record is inserted
     *
     * @param Doctrine_Event $event
     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; void
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preInsert(Doctrine_Event $event)
    {
        $record = $event-&amp;gt;getInvoker();
        $name = $record-&amp;gt;getTable()-&amp;gt;getFieldName($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_options[&apos;name&apos;]);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $record-&amp;gt;$name) {
            $record-&amp;gt;$name = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;buildSlugFromFields($record);
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; { &lt;span class=&quot;code-comment&quot;&gt;// Still check &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; slug uniqueness when you insert
&lt;/span&gt;            $record-&amp;gt;$name = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;buildSlugFromSlugField($record);
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 


&lt;p&gt;C&lt;/p&gt;</description>
                <environment>symfony-1.3.4 and doctrine-1.2.2</environment>
            <key id="11307">DC-659</key>
            <summary>Sluggable behavior does not check uniqueness on insert if a slug is manually set, causing SQL error/crash</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="caponica">Christian Seaman</reporter>
                        <labels>
                    </labels>
                <created>Sat, 1 May 2010 14:22:21 +0000</created>
                <updated>Tue, 5 Oct 2010 11:14:25 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13177" author="jwage" created="Tue, 8 Jun 2010 13:38:42 +0000"  >&lt;p&gt;Can you provide your changes as a patch/diff with a test case?&lt;/p&gt;</comment>
                    <comment id="14531" author="caponica" created="Tue, 5 Oct 2010 11:14:25 +0000"  >&lt;p&gt;Hi Jonathan,&lt;/p&gt;

&lt;p&gt;I&apos;m not so hot at making patches or test cases, but it should be fairly easy if you know what you&apos;re doing...&lt;/p&gt;

&lt;p&gt;Just try to create and save two records with the same hard-coded slug and the second one will fail with an ugly MySQL crash.&lt;/p&gt;

&lt;p&gt;If you add the lines&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;        } else { // Still check for slug uniqueness when you insert
            $record-&amp;gt;$name = $this-&amp;gt;buildSlugFromSlugField($record);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to the Sluggable::preInsert() method then this problem is averted and the test cases will pass.&lt;/p&gt;

&lt;p&gt;I have been running with this modification in our production version of Doctrine since I first reported this in May and it all seems to work well.&lt;/p&gt;

&lt;p&gt;If you really need me to figure out how to make a patch and test case please re-comment on this ticket and I&apos;ll see what I can do when I have some free time.&lt;/p&gt;


&lt;p&gt;C&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-674] NULL Dates are translated to &apos;0000-00-00&apos; after upgrading to 1.2.2</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-674</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Once the upgrade was done from Doctrine 1.2.1 to 1.2.2 we discovered that date related issues started to appear.&lt;br/&gt;
With dates that are persisted in DB as NULL are translated to &quot;0000-00-00&quot; when retrieved from DB. This has occurred in multiple places and is quite worrying as there is a lot of dates in our project. This means that everywhere in our codebase where we check a datevalue in our Models is NULL we need also to check for the string literal &quot;0000-00-00&quot;.&lt;/p&gt;
</description>
                <environment>Zend Framework, Ubuntu 9.10, MySQL </environment>
            <key id="11343">DC-674</key>
            <summary>NULL Dates are translated to &apos;0000-00-00&apos; after upgrading to 1.2.2</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="villeit">Ville It&#228;maa</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 May 2010 07:59:54 +0000</created>
                <updated>Wed, 6 Oct 2010 06:29:40 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                                <fixVersion>1.2.1</fixVersion>
                <fixVersion>1.2.2</fixVersion>
                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12895" author="jwage" created="Mon, 10 May 2010 12:19:21 +0000"  >&lt;p&gt;Are you able to reproduce this in a test case?&lt;/p&gt;</comment>
                    <comment id="12909" author="villeit" created="Tue, 11 May 2010 04:54:06 +0000"  >&lt;p&gt;We reverted to Doctrine 1.2.1 after realising the bug to confirm it was Doctrine 1.2.2 that was the cause for the problem. And as a result the records with NULL dates in the DB became NULL in the Models.&lt;br/&gt;
But when using Doctrine 1.2.2, the NULL dates became &apos;0000-00-00&apos; in the Models.&lt;br/&gt;
I don&apos;t have any other way to reproduce this error.&lt;/p&gt;</comment>
                    <comment id="12912" author="jwage" created="Tue, 11 May 2010 08:06:09 +0000"  >&lt;p&gt;Were you able to identity which changeset it was? You can read about creating test cases here &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;

&lt;p&gt;So far I am not able to reproduce the error you described.&lt;/p&gt;</comment>
                    <comment id="13212" author="jwage" created="Tue, 8 Jun 2010 16:54:48 +0000"  >&lt;p&gt;I&apos;d like to fix this. Did you ever figure out which changeset introduced the issue? I&apos;ve been trying to figure it out myself.&lt;/p&gt;</comment>
                    <comment id="14535" author="hroland" created="Wed, 6 Oct 2010 06:29:30 +0000"  >&lt;p&gt;With 1.2.3 this works for me fine with both TIMESTAMP and DATE fields.&lt;/p&gt;


&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;YAML

        date_of_birth:
            type: date

BASE MODEL

        $this-&amp;gt;hasColumn(&apos;date_of_birth&apos;, &apos;date&apos;, null, array(
             &apos;type&apos; =&amp;gt; &apos;date&apos;,

             // try these two
             // &apos;notnull&apos; =&amp;gt; false,
             // &apos;default&apos; =&amp;gt; null
         ));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;YAML

        exported_at:
            type: timestamp(25)
            notnull: false
            default: null

            # in this model I have everything to make sure it accepts and defaults to NULL

BASE MODEL

        $this-&amp;gt;hasColumn(&apos;exported_at&apos;, &apos;timestamp&apos;, 25, array(
             &apos;type&apos; =&amp;gt; &apos;timestamp&apos;,
             &apos;notnull&apos; =&amp;gt; false,
             &apos;length&apos; =&amp;gt; &apos;25&apos;,
             ));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You may try adding these to your YAML and (base) models&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;
YAML

    fieldname:
         . . .
        notnull: false
        default: null

BASE MODEL

        $this-&amp;gt;hasColumn(&apos;fieldname&apos;, . . .
             . . .
             &apos;notnull&apos; =&amp;gt; false, // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
             // &apos;default&apos; =&amp;gt; null, // &amp;lt;&amp;lt;&amp;lt; maybe, probably not needed
             ));

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

&lt;p&gt;I hope it helps.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-690] Wrong data type for oracle integer</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-690</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Trying to migrate from doctrine 1 to 1.2 and this problem came up to me, i cant map a column to integer(7) (which should create a number(7) column)  using Oracle, he always create a NUMBER(20) field.&lt;/p&gt;

&lt;p&gt;Taking a look at Doctrine_DataDict_Oracle i realize the problem is here.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11384">DC-690</key>
            <summary>Wrong data type for oracle integer</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dead_thinker">Arian Maykon de Ara&#250;jo Di&#243;genes</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 May 2010 10:06:23 +0000</created>
                <updated>Tue, 8 Jun 2010 11:05:38 +0000</updated>
                                    <version>1.2.2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13162" author="jwage" created="Tue, 8 Jun 2010 11:05:38 +0000"  >&lt;p&gt;We made a bunch of changes/fixes related to oracle. This was to fix another bug I believe. I can&apos;t remember the user that is responsible for these changes. Does anyone else remember or know anything?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-725] Call record-&gt;get(&apos;RelationManyToManyName&apos;, FALSE) corrupt the record and generate a exception when calling  record-&gt;save()</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-725</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Imagine a simple case. Contact can have many categories.&lt;br/&gt;
Doing thoses calls:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$c = Doctrine::getTable(&apos;Contact&apos;)-&amp;gt;findOneById($id);
$c-&amp;gt;get(&apos;Categories&apos;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
$c-&amp;gt;save();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Generate the following error &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;PHP Fatal error:  Call to a member function save() on a non-object in /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php on line 443
PHP Stack trace:
PHP   1. {main}() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:0
PHP   2. Doctrine_Record-&amp;gt;save() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:51
PHP   3. Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php:1705
PHP   4. Doctrine_Connection_UnitOfWork-&amp;gt;saveAssociations() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php:137
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
</description>
                <environment>PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22) &lt;br/&gt;
mysql Ver 14.14 Distrib 5.1.41, for apple-darwin9.5.0 (i386) using readline 5.1 &lt;br/&gt;
Doctrine version 1.2.2 from SVN: &lt;a href=&quot;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&quot;&gt;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&lt;/a&gt;</environment>
            <key id="11467">DC-725</key>
            <summary>Call record-&gt;get(&apos;RelationManyToManyName&apos;, FALSE) corrupt the record and generate a exception when calling  record-&gt;save()</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jeanmonod">David Jeanmonod</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Jun 2010 07:50:57 +0000</created>
                <updated>Wed, 9 Jun 2010 07:55:21 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="13249" author="jeanmonod" created="Wed, 9 Jun 2010 07:55:21 +0000"  >&lt;p&gt;Test case for the bug&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10635" name="get_with_no_load_corrupt_many_to_many_assoc_.php" size="1766" author="jeanmonod" created="Wed, 9 Jun 2010 07:55:21 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-735] Imported objects not converted to objects and parsed as string when a setter method exists</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-735</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If you set a setter method for a model which is for a relation the data import no longer works. This seems to be because in the _processRow method it checks if a method exists and then passes the default value rather than checking whether a relation exists first and passing the imported object. &lt;/p&gt;

&lt;p&gt;This effectively means you can&apos;t overload a setter method and still use the data import. &lt;/p&gt;</description>
                <environment>Mac OS X 10.6</environment>
            <key id="11492">DC-735</key>
            <summary>Imported objects not converted to objects and parsed as string when a setter method exists</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="kev">Kevin Dew</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Jun 2010 17:32:09 +0000</created>
                <updated>Fri, 22 Jul 2011 05:09:34 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16191" author="ryan" created="Fri, 22 Jul 2011 05:09:34 +0000"  >&lt;p&gt;added testcase here&lt;br/&gt;
&lt;a href=&quot;https://github.com/rahx/doctrine1/commit/ba5628abaa5b3d60638d833d90b1cf439504d560&quot; class=&quot;external-link&quot;&gt;https://github.com/rahx/doctrine1/commit/ba5628abaa5b3d60638d833d90b1cf439504d560&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-743] Incompatibilty between fixture import and accessors extends</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-743</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I had a problem when i try to import data with an extended accessors when i try to insert a content with a relation. I discovered this problem in symfony.&lt;/p&gt;

&lt;p&gt;For example, here is my table :&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; 
News:
  tableName: ne_news
  columns:
    id:           { type: integer(4), 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; }
    author_id:    { type: integer(4), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    name:         { type: string(255) }
    description:  { type: text }
  relations:
    author: { class: sfGuardUser, onDelete: NULL, local: author_id, foreign: id, foreignAlias: sfGuardUser }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the fixture :&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; 
SfGuardUser:
  sadmin:
    username:       admin
    password:       admin
    is_super_admin: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  author1:
    username: myname
    
News:
  News1:
    name: Test 1
    description: Description of news 1
    author: author1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I import it with  symfony doctrine:data-load and it works.&lt;/p&gt;

&lt;p&gt;If i add a news.class.php and extends the autogenerated class it fails.&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 setAuthor($v)
    {
        &lt;span class=&quot;code-comment&quot;&gt;//__log(&apos;extending setter&apos;);
&lt;/span&gt;        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_set(&apos;author&apos;, $v);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;WhenDoctrine_Data_Import finds the setAuthor function, it wont transform author1 in object so $v will be a string, not an sfGuardUser object. &lt;/p&gt;

&lt;p&gt;What do you think? Is a common behavior, how can i extends my accessor?&lt;/p&gt;</description>
                <environment>Window, PHP5, Symfony</environment>
            <key id="11508">DC-743</key>
            <summary>Incompatibilty between fixture import and accessors extends</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bricef">Brice Favre</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Jun 2010 11:06:58 +0000</created>
                <updated>Fri, 22 Jul 2011 02:28:49 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Data Fixtures</component>
                <component>Import/Export</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="16190" author="ryan" created="Fri, 22 Jul 2011 02:28:49 +0000"  >&lt;p&gt;this is the same issue as &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-735&quot; class=&quot;external-link&quot;&gt;DC-735&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-747] Sequence name of build process is different to the one used in UnitOfWorks (based on DC521 with updated TestCase) </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-747</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I moved our project from doctrine 1.2.1 to 1.2.4. The build process stops because of this patch. We are using primary keys with an alias. It seems that the generation of the sequence name in the build-process is different to the one used in UnitOfWorks.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Authority:&lt;br/&gt;
columns:&lt;br/&gt;
a_id: &lt;/p&gt;
{ name: a_id as id, type: integer, primary: true, autoincrement: true }
&lt;p&gt;name: &lt;/p&gt;
{ type: string }

&lt;p&gt;This will generate a sequence called &quot;authority_a_id&quot;, but it will try no &quot;currval&quot; the sequence &quot;authority_id&quot;.&lt;/p&gt;

&lt;p&gt;I&apos;ll try to provide a UnitTest. The current seems broken.&lt;/p&gt;

&lt;p&gt;php -l Ticket/DC521TestCase.php &lt;br/&gt;
PHP Parse error: syntax error, unexpected $end, expecting T_FUNCTION in Ticket/DC521TestCase.php on line 143&lt;/p&gt;

&lt;p&gt;Parse error: syntax error, unexpected $end, expecting T_FUNCTION in Ticket/DC521TestCase.php on line 143&lt;br/&gt;
Errors parsing Ticket/DC521TestCase.php&lt;/p&gt;</description>
                <environment>doctrine 1.2.4, symfony 1.4, snow leopard, php 5.3.1, postgresql 8.3</environment>
            <key id="11512">DC-747</key>
            <summary>Sequence name of build process is different to the one used in UnitOfWorks (based on DC521 with updated TestCase) </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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="enrico">Enrico Stahn</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Jun 2010 05:56:12 +0000</created>
                <updated>Thu, 17 Jun 2010 06:47:38 +0000</updated>
                                    <version>1.2.3</version>
                <version>1.2.4</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13351" author="enrico" created="Thu, 17 Jun 2010 06:25:45 +0000"  >&lt;p&gt;Here is the test updated with the current ticket number.&lt;/p&gt;</comment>
                    <comment id="13352" author="enrico" created="Thu, 17 Jun 2010 06:37:36 +0000"  >&lt;p&gt;Updated. Now it should work/not work as expected.&lt;/p&gt;</comment>
                    <comment id="13353" author="enrico" created="Thu, 17 Jun 2010 06:47:38 +0000"  >&lt;p&gt;This isn&apos;t a blocker anymore because of the workaround i&apos;ve found.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;remove autoincrement&lt;/li&gt;
	&lt;li&gt;add sequence name manually&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Authority:&lt;br/&gt;
columns:&lt;br/&gt;
a_id: &lt;/p&gt;
{ name: a_id as id, type: integer, primary: true, sequence: authority_a_id }
&lt;p&gt;name: &lt;/p&gt;
{ type: string }</comment>
                </comments>
                    <attachments>
                    <attachment id="10665" name="DC747TestCase.php" size="2827" author="enrico" created="Thu, 17 Jun 2010 06:37:36 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-755] CLONE [DC-558] incorrect handling of MODEL_CLASS_PREFIX causes Doctrine_Migration_Diff to drop the whole database when working from YAML (Regression)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-755</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Replicating the bug:&lt;br/&gt;
1. Set ATTR_MODEL_CLASS_PREFIX non-null&lt;br/&gt;
2. create schema file with entity&lt;br/&gt;
3. run doctrine build-all&lt;br/&gt;
4. copy schema file&lt;br/&gt;
5. edit schema file to add column to entity&lt;br/&gt;
6. run generate-migrations-diff from copy of schema file to edited schema file&lt;/p&gt;

&lt;p&gt;Expected (previous) behaviour:&lt;br/&gt;
Migration is generated to add the new column to entity&lt;/p&gt;

&lt;p&gt;Real behaviour:&lt;br/&gt;
Drops entity from database and creates new&lt;/p&gt;</description>
                <environment>Current HEAD of Doctrine 1.2</environment>
            <key id="11528">DC-755</key>
            <summary>CLONE [DC-558] incorrect handling of MODEL_CLASS_PREFIX causes Doctrine_Migration_Diff to drop the whole database when working from YAML (Regression)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="andrewcoulton">Andrew Coulton</reporter>
                        <labels>
                    </labels>
                <created>Sun, 20 Jun 2010 09:58:04 +0000</created>
                <updated>Sun, 10 Oct 2010 18:51:58 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Migrations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13377" author="andrewcoulton" created="Sun, 20 Jun 2010 10:08:30 +0000"  >&lt;p&gt;This seems to be a regression caused by the fix for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-558&quot; title=&quot;CLONE -generate-migrations-diff is producing bogus migrations (drops the whole database)&quot;&gt;&lt;del&gt;DC-558&lt;/del&gt;&lt;/a&gt; which added the MODEL_CLASS_PREFIX to the $_toPrefix in Doctrine_Migration_Diff::generateChanges.&lt;/p&gt;

&lt;p&gt;While this fixed the issue when generating diff from models to YAML, it has now created the reverse issue for generating diffs from YAML to YAML - as the models generated for the &quot;from&quot; schema do not get MODEL_CLASS_PREFIX prepended and so now this command will drop all existing tables and recreate.&lt;/p&gt;

&lt;p&gt;I believe the fix may be to amend as:&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;        $from = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateModels(
            Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_fromPrefix,
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_from);
        $to = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateModels(
            Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_toPrefix,
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_to                
        );
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since it seems that when presented with a folder of models _generateModels ignores the prefix anyway. However, I&apos;m not sure of other impacts possible as a result?&lt;/p&gt;</comment>
                    <comment id="14141" author="andrewcoulton" created="Sun, 29 Aug 2010 06:29:06 +0000"  >&lt;p&gt;I&apos;ve been using and testing the modified version above locally for some time and it seems to work as expected. Any chance of this making it into core? Otherwise, the migrations feature is completely unusable when working YAML-YAML and using model prefixes on the newly released 1.2.3&lt;/p&gt;</comment>
                    <comment id="14144" author="jwage" created="Sun, 29 Aug 2010 12:22:54 +0000"  >&lt;p&gt;Has anyone been able to produce this in a test case?&lt;/p&gt;</comment>
                    <comment id="14182" author="andrewcoulton" created="Mon, 30 Aug 2010 18:16:35 +0000"  >&lt;p&gt;I&apos;ve attached a diff file with the DC755TestCase and the required from and to YAML schema files to reproduce this bug. I wasn&apos;t sure whether you prefer like this or as a git commit?&lt;/p&gt;</comment>
                    <comment id="14183" author="andrewcoulton" created="Mon, 30 Aug 2010 18:24:52 +0000"  >&lt;p&gt;Also attached a diff file of my proposed change to Doctrine_Migration_Diff to resolve this, but as I say unsure if it has implications on other migration types.&lt;/p&gt;</comment>
                    <comment id="14550" author="andrewcoulton" created="Sun, 10 Oct 2010 18:51:58 +0000"  >&lt;p&gt;Fixed by &lt;a href=&quot;http://github.com/acoulton/doctrine1/tree/DC-755&quot; class=&quot;external-link&quot;&gt;http://github.com/acoulton/doctrine1/tree/DC-755&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10752" name="dc755TestCase.diff" size="3114" author="andrewcoulton" created="Mon, 30 Aug 2010 18:16:35 +0000" />
                    <attachment id="10753" name="fix755.diff" size="642" author="andrewcoulton" created="Mon, 30 Aug 2010 18:24:52 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-802] Alias in select and having</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-802</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;i have query&lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;br/&gt;
            -&amp;gt;select(&apos;g.&lt;b&gt;,gp.&lt;/b&gt;,st.&lt;b&gt;,np.&lt;/b&gt;,v.&lt;b&gt;,s.&lt;/b&gt;,max(gp.card_date) as md&apos;)&lt;br/&gt;
            -&amp;gt;from(&apos;gragdans as g&apos;)&lt;br/&gt;
            -&amp;gt;innerJoin(&apos;g.Pribs_ gp&apos;)&lt;br/&gt;
            -&amp;gt;leftJoin(&apos;gp.Streets_ st&apos;)&lt;br/&gt;
            -&amp;gt;leftJoin(&apos;gp.Viddocs_ v&apos;)&lt;br/&gt;
            -&amp;gt;leftJoin(&apos;gp.Sobits_ s&apos;)&lt;br/&gt;
            -&amp;gt;leftJoin(&apos;st.Npunkts_ np&apos;)&lt;br/&gt;
            -&amp;gt;where(&apos;g.grid in &apos;.$idlst,1)&lt;br/&gt;
            -&amp;gt;orderby(&apos;fam&apos;)&lt;br/&gt;
            -&amp;gt;having(&apos;gp.card_date=md&apos;);&lt;/p&gt;

&lt;p&gt;When it runs i have error:&lt;/p&gt;

&lt;p&gt;&amp;lt;b&amp;gt;Fatal error&amp;lt;/b&amp;gt;:  Uncaught exception&lt;br/&gt;
&apos;Doctrine_Connection_Mysql_Exception&apos; with message &apos;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S22&amp;#93;&lt;/span&gt;:&lt;br/&gt;
Column not found: 1054 Unknown column &apos;md&apos; in &apos;having clause&apos;&apos; in Z:&lt;br/&gt;
\home\new\www\system\application\plugins\doctrine\lib\Doctrine&lt;br/&gt;
\Connection.php:1082&lt;/p&gt;

&lt;p&gt;SQL for it looks like:&lt;/p&gt;

&lt;p&gt;SELECT g.grid AS g_&lt;em&gt;grid, g.fam AS g&lt;/em&gt;&lt;em&gt;fam, g.nam AS g&lt;/em&gt;_nam, g.otc AS&lt;br/&gt;
g_&lt;em&gt;otc, g.date_rogd AS g&lt;/em&gt;&lt;em&gt;date_rogd, g.gosgrid AS g&lt;/em&gt;_gosgrid,&lt;br/&gt;
g.rogd_place AS g_&lt;em&gt;rogd_place, g.pol AS g&lt;/em&gt;_pol, g.reg_date AS&lt;br/&gt;
g_&lt;em&gt;reg_date, g.deesp AS g&lt;/em&gt;&lt;em&gt;deesp, p.pribid AS p&lt;/em&gt;_pribid, p.grid AS&lt;br/&gt;
p_&lt;em&gt;grid, p.strid AS p&lt;/em&gt;&lt;em&gt;strid, p.hom AS p&lt;/em&gt;&lt;em&gt;hom, p.cor AS p&lt;/em&gt;_cor, p.kva&lt;br/&gt;
AS p_&lt;em&gt;kva, p.reg_date AS p&lt;/em&gt;&lt;em&gt;reg_date, p.vidid AS p&lt;/em&gt;_vidid, p.pas_ser&lt;br/&gt;
AS p_&lt;em&gt;pas_ser, p.pas_no AS p&lt;/em&gt;&lt;em&gt;pas_no, p.org_name AS p&lt;/em&gt;_org_name,&lt;br/&gt;
p.pas_date AS p_&lt;em&gt;pas_date, p.sobid AS p&lt;/em&gt;_sobid, p.reg_expire AS&lt;br/&gt;
p_&lt;em&gt;reg_expire, p.card_date AS p&lt;/em&gt;&lt;em&gt;card_date, s.strid AS s&lt;/em&gt;_strid,&lt;br/&gt;
s.npid AS s_&lt;em&gt;npid, s.name AS s&lt;/em&gt;&lt;em&gt;name, v.vidid AS v&lt;/em&gt;_vidid, v.name AS&lt;br/&gt;
v_&lt;em&gt;name, s2.sobid AS s2&lt;/em&gt;&lt;em&gt;sobid, s2.cod_s AS s2&lt;/em&gt;_cod_s, s2.cod_oi AS&lt;br/&gt;
s2_&lt;em&gt;cod_oi, s2.name AS s2&lt;/em&gt;&lt;em&gt;name, n.npid AS n&lt;/em&gt;&lt;em&gt;npid, n.name AS n&lt;/em&gt;_name,&lt;br/&gt;
n.sid AS n_&lt;em&gt;sid, MAX(p.card_date) AS p&lt;/em&gt;_0 FROM gragdans g INNER JOIN&lt;br/&gt;
prib p ON g.grid = p.grid LEFT JOIN streets s ON p.strid = s.strid&lt;br/&gt;
LEFT JOIN viddoc v ON p.vidid = v.vidid LEFT JOIN sobit s2 ON p.sobid&lt;br/&gt;
= s2.sobid LEFT JOIN npunkt n ON s.npid = n.npid WHERE (g.grid in (4,&lt;br/&gt;
13, 19, 20)) HAVING p.card_date=md ORDER BY g.fam&lt;/p&gt;

&lt;p&gt;But i need Query looks like:&lt;/p&gt;

&lt;p&gt;SELECT g.grid AS g_&lt;em&gt;grid, g.fam AS g&lt;/em&gt;&lt;em&gt;fam, g.nam AS g&lt;/em&gt;_nam, g.otc AS&lt;br/&gt;
g_&lt;em&gt;otc, g.date_rogd AS g&lt;/em&gt;&lt;em&gt;date_rogd, g.gosgrid AS g&lt;/em&gt;_gosgrid,&lt;br/&gt;
g.rogd_place AS g_&lt;em&gt;rogd_place, g.pol AS g&lt;/em&gt;_pol, g.reg_date AS&lt;br/&gt;
g_&lt;em&gt;reg_date, g.deesp AS g&lt;/em&gt;&lt;em&gt;deesp, p.pribid AS p&lt;/em&gt;_pribid, p.grid AS&lt;br/&gt;
p_&lt;em&gt;grid, p.strid AS p&lt;/em&gt;&lt;em&gt;strid, p.hom AS p&lt;/em&gt;&lt;em&gt;hom, p.cor AS p&lt;/em&gt;_cor, p.kva&lt;br/&gt;
AS p_&lt;em&gt;kva, p.reg_date AS p&lt;/em&gt;&lt;em&gt;reg_date, p.vidid AS p&lt;/em&gt;_vidid, p.pas_ser&lt;br/&gt;
AS p_&lt;em&gt;pas_ser, p.pas_no AS p&lt;/em&gt;&lt;em&gt;pas_no, p.org_name AS p&lt;/em&gt;_org_name,&lt;br/&gt;
p.pas_date AS p_&lt;em&gt;pas_date, p.sobid AS p&lt;/em&gt;_sobid, p.reg_expire AS&lt;br/&gt;
p_&lt;em&gt;reg_expire, p.card_date AS p&lt;/em&gt;&lt;em&gt;card_date, s.strid AS s&lt;/em&gt;_strid,&lt;br/&gt;
s.npid AS s_&lt;em&gt;npid, s.name AS s&lt;/em&gt;&lt;em&gt;name, v.vidid AS v&lt;/em&gt;_vidid, v.name AS&lt;br/&gt;
v_&lt;em&gt;name, s2.sobid AS s2&lt;/em&gt;&lt;em&gt;sobid, s2.cod_s AS s2&lt;/em&gt;_cod_s, s2.cod_oi AS&lt;br/&gt;
s2_&lt;em&gt;cod_oi, s2.name AS s2&lt;/em&gt;&lt;em&gt;name, n.npid AS n&lt;/em&gt;&lt;em&gt;npid, n.name AS n&lt;/em&gt;_name,&lt;br/&gt;
n.sid AS n__sid, MAX(p.card_date) AS md FROM gragdans g INNER JOIN&lt;br/&gt;
prib p ON g.grid = p.grid LEFT JOIN streets s ON p.strid = s.strid&lt;br/&gt;
LEFT JOIN viddoc v ON p.vidid = v.vidid LEFT JOIN sobit s2 ON p.sobid&lt;br/&gt;
= s2.sobid LEFT JOIN npunkt n ON s.npid = n.npid WHERE (g.grid in (4,&lt;br/&gt;
13, 19, 20)) group by fam HAVING p.card_date=md&lt;/p&gt;

&lt;p&gt;This query run fine and give me what i need.&lt;/p&gt;

&lt;p&gt;Doctrine dont use &apos;md&apos; alias instead it convert it to &apos;p__0&apos; &lt;/p&gt;</description>
                <environment>Windows XP sp3 </environment>
            <key id="11692">DC-802</key>
            <summary>Alias in select and having</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="skyranger">Vasiliy Altunin</reporter>
                        <labels>
                    </labels>
                <created>Wed, 28 Jul 2010 22:39:58 +0000</created>
                <updated>Sat, 7 Aug 2010 15:39:30 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-815] Model&apos;s default sorting breaks subqueries</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-815</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;It works except subqueries. Main table&apos;s order is added to subquery and vice versa. SQL query looks like this:&lt;/p&gt;

&lt;p&gt;{{&lt;br/&gt;
SELECT t.id AS t_&lt;em&gt;id FROM ticket&lt;/em&gt;_d_c9999_&lt;em&gt;record t WHERE (t.id = (SELECT MAX(t2.id) AS t2&lt;/em&gt;&lt;em&gt;0 FROM ticket&lt;/em&gt;_d_c9999__record t2 ORDER BY t.id ASC, t2.id ASC)) ORDER BY t.id ASC, t2.id ASC&lt;br/&gt;
}}&lt;/p&gt;

&lt;p&gt;Query fails because there is &amp;gt;&amp;gt;no such column &quot;t.id&quot;&amp;lt;&amp;lt;.&lt;/p&gt;

&lt;p&gt;I include a testcase when it is all visible.&lt;/p&gt;

&lt;p&gt;BTW. there is nothing about that feature (and relation orderBy) in docs. It is only in UPGRADE file.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11752">DC-815</key>
            <summary>Model&apos;s default sorting breaks subqueries</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="extreme">Jacek J&#281;drzejewski</reporter>
                        <labels>
                    </labels>
                <created>Wed, 11 Aug 2010 07:31:23 +0000</created>
                <updated>Mon, 14 Mar 2011 18:01:49 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14064" author="extreme" created="Wed, 25 Aug 2010 07:26:04 +0000"  >&lt;p&gt;Anyone?&lt;/p&gt;</comment>
                    <comment id="15487" author="beverage" created="Thu, 10 Mar 2011 08:57:34 +0000"  >&lt;p&gt;Am having the same issue!&lt;/p&gt;

&lt;p&gt;Eventually found the orderBy option on both the model and on relationships and was over joyed as I&apos;d been trying to find a way of doing this, but it didn&apos;t work!!&lt;/p&gt;

&lt;p&gt;Found the patch &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-651&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-651&lt;/a&gt; which solved the first problem I encountered but now I&apos;m getting this.&lt;/p&gt;</comment>
                    <comment id="15498" author="beverage" created="Mon, 14 Mar 2011 18:01:49 +0000"  >&lt;p&gt;Had a look at the code and tried only setting the orderBy if the current component is actually referenced in the from sql part of the query.&lt;/p&gt;

&lt;p&gt;Looking at what is selected from, &lt;tt&gt;$this-&amp;gt;_sqlParts&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;from&amp;#39;&amp;#93;&lt;/span&gt;&lt;/tt&gt;, it appears that the main table (&lt;tt&gt;$map&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;table&amp;#39;&amp;#93;&lt;/span&gt;-&amp;gt;getTableName()&lt;/tt&gt;) and &lt;tt&gt;$sqlAlias&lt;/tt&gt; is include with a zero index and joined tables are keyed by their &lt;tt&gt;$alias&lt;/tt&gt; (or at least the content of these variables within the loop).&lt;/p&gt;

&lt;p&gt;From this I believe I could detect if the current entry in the loop was from a table that was in the current &quot;FROM&quot; part of the query by looking for the table name and alias as an entry or the current alias as a key in the &quot;FROM&quot; array.&lt;/p&gt;

&lt;p&gt;Within my sub query the orderBy valeus would still get applied but only in the subquery and not in the main query where they were included before, out of scope.&lt;/p&gt;

&lt;p&gt;With patch &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-651&quot; title=&quot;[PATCH] Doctrine_Record::option(&amp;#39;orderBy&amp;#39;, ...) of join&amp;#39;s right side being applied to refTable in m2m relationship&quot;&gt;DC-651&lt;/a&gt; applied my code in Query.php at line 1315 noew looks as follows:&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;// Note: Only include orderBy values &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; tables we&apos;re actually selecting from (both the root table or
&lt;/span&gt;                &lt;span class=&quot;code-comment&quot;&gt;// tables referenced from it)
&lt;/span&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (in_array(&lt;span class=&quot;code-quote&quot;&gt;&quot;{$map[&apos;table&apos;]-&amp;gt;getTableName()} {$sqlAlias}&quot;&lt;/span&gt;, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;from&apos;]) || array_key_exists($alias, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;from&apos;])) {
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($map[&apos;relation&apos;])) {
                        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($map[&apos;ref&apos;])) {
                            $orderBy = $map[&apos;relation&apos;][&apos;refTable&apos;]-&amp;gt;processOrderBy($sqlAlias, $map[&apos;relation&apos;][&apos;orderBy&apos;], &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($map[&apos;relation&apos;][&apos;orderBy&apos;] &amp;amp;&amp;amp; $orderBy == $map[&apos;relation&apos;][&apos;orderBy&apos;]) {
                                $orderBy = $map[&apos;relation&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            }
                        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                            $orderBy = $map[&apos;relation&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderBy == $map[&apos;relation&apos;][&apos;orderBy&apos;]) {
                                $orderBy = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
                            }
                        }
                    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                        $orderBy = $map[&apos;table&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                    }
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                        $orderBy = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
                }

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

&lt;p&gt;Am I correct in my assumptions?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10735" name="DC9999TestCase.php" size="997" author="extreme" created="Wed, 11 Aug 2010 07:31:23 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-857] postHydrate not called for One to One relations, when ATTR_HYDRATE_OVERWRITE == false, and the record is cached in the table&apos;s identityMap</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-857</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table&apos;s cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation&apos;s postHydrate method will never be called.&lt;/p&gt;

&lt;p&gt;This is due to &lt;a href=&quot;http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255&quot; class=&quot;external-link&quot;&gt;this line&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; 
} &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! isset($prev[$parent][$relationAlias])) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;...which will always evaluate to false, and postHydrate will ever be called, as the record has been pulled from the table cache &lt;a href=&quot;http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L155&quot; class=&quot;external-link&quot;&gt;here&lt;/a&gt;&lt;/p&gt;</description>
                <environment>All</environment>
            <key id="11878">DC-857</key>
            <summary>postHydrate not called for One to One relations, when ATTR_HYDRATE_OVERWRITE == false, and the record is cached in the table&apos;s identityMap</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ben.davies">Ben Davies</reporter>
                        <labels>
                    </labels>
                <created>Fri, 3 Sep 2010 09:25:22 +0000</created>
                <updated>Sun, 5 Sep 2010 12:41:13 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14253" author="ben.davies" created="Fri, 3 Sep 2010 09:27:24 +0000"  >&lt;p&gt;Test case attached.&lt;/p&gt;</comment>
                    <comment id="14254" author="ben.davies" created="Fri, 3 Sep 2010 09:30:09 +0000"  >&lt;p&gt;There needs to be some kind of caching on the pre/postHydrate calls, which is done throughout the Doctrine_Hydrator_Graph, except for when the relation is one-to-one.&lt;br/&gt;
This is done &lt;a href=&quot;http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L224&quot; class=&quot;external-link&quot;&gt;just above&lt;/a&gt;, for relations that are not one-to-one.&lt;/p&gt;

&lt;p&gt;Unfortunately, I couldn&apos;t work out how to implement it for one-to-one.&lt;br/&gt;
Probably a simple fix for someone familiar with the code&lt;/p&gt;</comment>
                    <comment id="14255" author="ben.davies" created="Fri, 3 Sep 2010 11:31:45 +0000"  >&lt;p&gt;Correct Test Case&lt;/p&gt;</comment>
                    <comment id="14257" author="ben.davies" created="Fri, 3 Sep 2010 11:37:03 +0000"  >&lt;p&gt;Correct Test Case&lt;/p&gt;</comment>
                    <comment id="14279" author="ben.davies" created="Sun, 5 Sep 2010 12:41:13 +0000"  >&lt;p&gt;I was probably a little too tired to think this through clearly on a Friday after a long weeks work!&lt;br/&gt;
Patched attached, which doesn&apos;t break any of the existing unit tests.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10774" name="DC857.patch" size="1051" author="ben.davies" created="Sun, 5 Sep 2010 12:41:13 +0000" />
                    <attachment id="10773" name="DC857TestCase.php" size="2194" author="ben.davies" created="Fri, 3 Sep 2010 11:37:36 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-922] master-slave replication with i18n behavior</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-922</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I&apos;m trying to use sfDoctrineMasterSlavePlugin for database replication with Symfony  1.4 and PHP 5.3. But facing problem while selecting I18n records and receiving &quot;Unknown relation alias Translation&quot; error.&lt;/p&gt;

&lt;p&gt;I&apos;ve also tried same with implementation solution given in master-slave chapter of doctrine cookbook but no success. &lt;/p&gt;

&lt;p&gt;Is anyone facing same problem with sfDoctrineMasterSlavePlugin and i18n behavio? Is there any solution of the problem?&lt;/p&gt;</description>
                <environment>php 5.3, doctrine 1.2, Symfony 1.4, mysql</environment>
            <key id="12088">DC-922</key>
            <summary>master-slave replication with i18n behavior</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="husen">husen mankada</reporter>
                        <labels>
                    </labels>
                <created>Wed, 10 Nov 2010 02:34:37 +0000</created>
                <updated>Wed, 10 Nov 2010 02:34:37 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-932] Queries fail when a model contains underscore and we try to apply a limit</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-932</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Actually, I&apos;ve a dead simple schema.yml, with two tables:&lt;/p&gt;

&lt;p&gt;T_Media:&lt;br/&gt;
    actAs:&lt;br/&gt;
        Timestampable: ~&lt;br/&gt;
    columns:&lt;br/&gt;
        media_id: &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;        name: string(25)&lt;/p&gt;


&lt;p&gt;J_Acl:&lt;br/&gt;
    columns:&lt;br/&gt;
        media_id: integer&lt;br/&gt;
    relations:&lt;br/&gt;
        Media: &lt;/p&gt;
{ class: T_Media, local: media_id, foreign: media_id, onDelete: CASCADE }


&lt;p&gt;I have some fixtures:&lt;br/&gt;
T_Media:&lt;br/&gt;
    m1:&lt;br/&gt;
        name: foobar&lt;/p&gt;

&lt;p&gt;J_Acl:&lt;br/&gt;
    a1:&lt;br/&gt;
        Media: m1&lt;/p&gt;

&lt;p&gt;And then, the DQL query I want to execute:&lt;/p&gt;

&lt;p&gt;&quot;From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1&quot;&lt;/p&gt;

&lt;p&gt;But if I run this query, for instance in CLI, I got an error:&lt;br/&gt;
./symfony doctrine:dql &quot;From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1&quot;&lt;/p&gt;


&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S02&amp;#93;&lt;/span&gt;: Base table or view not found: 1146 Table &apos;test_noel.t2__media&apos; doesn&apos;t exist.&lt;br/&gt;
Failing Query: &quot;SELECT DISTINCT t2.media_id FROM t2_&lt;em&gt;media t2 INNER JOIN j2&lt;/em&gt;_acl j2 ON t2.media_id = j2.media_id ORDER BY t2.created_at LIMIT 1&quot;&lt;/p&gt;

&lt;p&gt;Notes: &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;the query works if I do not apply the limit clause.&lt;/li&gt;
	&lt;li&gt;if I remove the underscore from the model, or if I set manually the tableName to remove the double underscore, it works&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>Doctrine 1.2, Symfony 1.4.6, MySQL, Postgresql</environment>
            <key id="12125">DC-932</key>
            <summary>Queries fail when a model contains underscore and we try to apply a limit</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="noel">Noel GUILBERT</reporter>
                        <labels>
                    </labels>
                <created>Fri, 19 Nov 2010 08:47:27 +0000</created>
                <updated>Fri, 19 Nov 2010 08:47:27 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-963] Doctrine cache - Salt dissociation</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-963</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine Cache store data into a persistence storage.&lt;/p&gt;

&lt;p&gt;Regarding APC, Doctrine use a share storage.&lt;br/&gt;
Doctrine is able to cache SQL from DQL, and DOM from SQL.&lt;br/&gt;
To do this, Doctrine create a DQL hash, and store the SQL result refer to the hash. &lt;/p&gt;

&lt;p&gt;I&apos;m using a server to host two Doctrine project, a preproduction &amp;amp; production Website. In some case, DQL is the same on both project, but the data model definition isn&apos;t.&lt;/p&gt;

&lt;p&gt;Preproduction convert DQL to SQL using data model definition, and store the SQL result into APC cache refer to the DQL hash.&lt;br/&gt;
Production create a DQL hash, this is the same hash as preproduction.. So production instance use the SQL refer to the preproduction.. &lt;/p&gt;

&lt;p&gt;I&apos;m not sure about the quality of this explanation... But I can add some information is needed.&lt;/p&gt;


&lt;p&gt;The solution of this problem is easy. Just add a SALT to any cache id&apos;s. It&apos;s a Doctrine_Cache problem, not only a Doctrine_Cache_APC problem..&lt;br/&gt;
For Query cache it&apos;s not really important because this cache is optional, but for result cache.. It&apos;s more critical.&lt;br/&gt;
The SALT can be define when instantiate the Doctrine_Cache object, it&apos;s just an option..&lt;/p&gt;


&lt;p&gt;$cacheDriver = new doctrine_Cache_Apc ();&lt;br/&gt;
$cacheDriver-&amp;gt;setOption (&quot;salt&quot;, &quot;domain.tld&quot;);&lt;/p&gt;</description>
                <environment></environment>
            <key id="12351">DC-963</key>
            <summary>Doctrine cache - Salt dissociation</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Feb 2011 05:05:19 +0000</created>
                <updated>Mon, 18 Apr 2011 10:13:28 +0000</updated>
                                                                    <component>Caching</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15219" author="armetiz" created="Thu, 3 Feb 2011 05:12:45 +0000"  >&lt;p&gt;to complete this bug, I think it&apos;s also a problem on DC 2..&lt;/p&gt;</comment>
                    <comment id="15737" author="jaikdean" created="Mon, 18 Apr 2011 10:13:28 +0000"  >&lt;p&gt;There is already an (undocumented?) option &quot;prefix&quot; that allows this.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;$cacheDriver = new Doctrine_Cache_Apc(array(&apos;prefix&apos; =&amp;gt; &apos;MY UNIQUE SALT&apos;));&lt;/tt&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-978] Doctrine_Connection_Mssql dies on modifyLimitSubquery every time</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-978</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Looking at the latest version of Doctrine_Connection_Mssql in git repo:&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine1/blob/b4dc8e66a89a7e17cd195c489b18005e19ca9ea5/lib/Doctrine/Connection/Mssql.php&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine1/blob/b4dc8e66a89a7e17cd195c489b18005e19ca9ea5/lib/Doctrine/Connection/Mssql.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Doctrine_Query:getLimitSubquery() there is a call to Doctrine_Connection_Mssql::modifyLimitSubquery().&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 modifyLimitSubquery(Doctrine_Table $rootTable, $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;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;modifyLimitQuery($query, $limit, $offset, $isManip, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This in turn calls Doctrine_Connection_Mssql::modifyLimitQuery() wihtout passing the $queryOrigin parameter:&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;, $isSubQuery = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, Doctrine_Query $queryOrigin = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($limit === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; || !($limit &amp;gt; 0)) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $query;
        }

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

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; &amp;amp;&amp;amp; $orderby === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
            &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;OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons.&quot;&lt;/span&gt;);
        }
        
        $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;);
        }

        $orderbySql = $queryOrigin-&amp;gt;getSqlQueryPart(&apos;orderby&apos;);
        $orderbyDql = $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&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;) {
            $orders = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;parseOrderBy(implode(&apos;, &apos;, $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&apos;)));

            &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ($i = 0; $i &amp;lt; count($orders); $i++) {
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;From just looking at the above code, the query chokes on the first call to a $queryOrigin method. It seems like there is a lot of missing code here which should work with the $query directly when $queryOrigin is not available...&lt;/p&gt;

&lt;p&gt;What is the point of $orderbySql and $orderbyDql variables when they are not used anywhere?&lt;/p&gt;

&lt;p&gt;This code looks like it&apos;s half way done and untested.&lt;/p&gt;</description>
                <environment>windows</environment>
            <key id="12434">DC-978</key>
            <summary>Doctrine_Connection_Mssql dies on modifyLimitSubquery every time</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="andrej.pavlovic">Andrej Pavlovic</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Feb 2011 17:14:51 +0000</created>
                <updated>Sun, 27 Feb 2011 17:17:16 +0000</updated>
                                    <version>1.2.4</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-980] Moving all ALTERS queries to the end of generated sql file (task build-sql)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-980</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Actual in case of using multi database configuration and foreign keys between them.&lt;/p&gt;

&lt;p&gt;Now build-sql task generates SQL query for database by database in alphabetical order. It&apos;s ugly when we have multidatabase configuration and foreign keys between their tables. It&apos;s impossible to do &apos;import-sql&apos; without errors beucase foreign keys constrains to nonexisting tables are in next database in order. &lt;/p&gt;

&lt;p&gt;I have added some code to strings 1176-...&lt;/p&gt;</description>
                <environment></environment>
            <key id="12446">DC-980</key>
            <summary>Moving all ALTERS queries to the end of generated sql file (task build-sql)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="seremenko">Sergey Eremenko</reporter>
                        <labels>
                    </labels>
                <created>Fri, 4 Mar 2011 06:42:03 +0000</created>
                <updated>Fri, 4 Mar 2011 06:42:03 +0000</updated>
                                                                    <component>Cli</component>
                <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10951" name="Export.php" size="56058" author="seremenko" created="Fri, 4 Mar 2011 06:42:03 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1007] Cannot update a field to NULL with MSSQL connection</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1007</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When trying to update a field to NULL in a MSSQL database, Doctrine generates the following request:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    UPDATE table SET fieldThatMustBeNull = , anotherField = &apos;blabla&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;therefore generating a syntax error.&lt;/p&gt;

&lt;p&gt;A fix would be to override the update method in the Doctrine_Connection_Mssql and add the following behavior:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Doctrine_Connection_Mssql&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 update(Doctrine_Table $table, array $fields, array $identifier)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (empty($fields)) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        }

        $set = array();
        foreach ($fields as $fieldName =&amp;gt; $value) {
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($value &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Doctrine_Expression) {
                $set[] = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier($table-&amp;gt;getColumnName($fieldName)) . &apos; = &apos; . $value-&amp;gt;getSql();
                unset($fields[$fieldName]);
            } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_null($value)) {
                $set[] = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier($table-&amp;gt;getColumnName($fieldName)) . &apos; = NULL&apos;;
                unset($fields[$fieldName]);
            } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                $set[] = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier($table-&amp;gt;getColumnName($fieldName)) . &apos; = ?&apos;;
            }
        }

        $params = array_merge(array_values($fields), array_values($identifier));

        $sql  = &apos;UPDATE &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteIdentifier($table-&amp;gt;getTableName())
              . &apos; SET &apos; . implode(&apos;, &apos;, $set)
              . &apos; WHERE &apos; . implode(&apos; = ? AND &apos;, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteMultipleIdentifier($table-&amp;gt;getIdentifierColumnNames()))
              . &apos; = ?&apos;;

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;exec($sql, $params);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Windows 7 32 bits with Apache 2.2.x, PHP 5.2.17, Sql Server 2008, Symfony 1.4.11 and Doctrine 1.2.4</environment>
            <key id="12667">DC-1007</key>
            <summary>Cannot update a field to NULL with MSSQL connection</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="guitio2002">guitio2002</reporter>
                        <labels>
                    </labels>
                <created>Wed, 25 May 2011 19:37:07 +0000</created>
                <updated>Wed, 25 May 2011 19:43:52 +0000</updated>
                                                    <fixVersion>1.2.4</fixVersion>
                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1009] save() also updates fields which should not be</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1009</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When I want to do a simple update like this :&lt;/p&gt;

&lt;p&gt; $batches = ExamResultsBatchTable::getInstance()-&amp;gt;retrieveByExamBatchStatus(ExamResultsBatch::valid_status_code);&lt;br/&gt;
foreach($batches as $batch)&lt;br/&gt;
{&lt;br/&gt;
        $batch-&amp;gt;setExamBatchStatusId($batchStatusId);&lt;br/&gt;
        $batch-&amp;gt;setStatusDate(date(&apos;Y-m-d&apos;));&lt;br/&gt;
        $batch-&amp;gt;save();&lt;br/&gt;
}&lt;br/&gt;
Only exam_batch_status_id and status_date should be updated (see screenshot before), but columns exam_batch_status_id ,status_date AND exam_subject_id are updated,with the same value (23) (screenshot after_with_save).&lt;/p&gt;

&lt;p&gt;If I run this:&lt;br/&gt;
        $toto = Doctrine_Query::create()&lt;br/&gt;
                       -&amp;gt;update(&apos;ExamResultsBatch erb&apos;)&lt;br/&gt;
                        -&amp;gt;set(&apos;erb.exam_batch_status_id&apos;, 23)&lt;br/&gt;
                        -&amp;gt;set(&apos;erb.status_date&apos;, date(&apos;Y-m-d&apos;))&lt;br/&gt;
                       &lt;del&gt;&amp;gt;where(&apos;erb.id = ?&apos; , $batch&lt;/del&gt;&amp;gt;getId())&lt;br/&gt;
                       -&amp;gt;execute(); &lt;br/&gt;
Everything is correctly done.&lt;/p&gt;

&lt;p&gt;here is the simpliest case.&lt;/p&gt;

&lt;p&gt;The same problems are signaled on other tables in the database, but different tables can be impacted by one save() (the execute() query still works fine).&lt;/p&gt;

&lt;p&gt;Example : 2 foreign tables will be updated , even if the save() action should only concern the main table, and one field (which is not a foreign key).&lt;br/&gt;
The corresponding foreign key fields in the 2 foreign tables, will be updated with the value given (here 23).&lt;/p&gt;

&lt;p&gt;Because save() is used in a lot of different places in our app, I need to find a solution to fix save(), or if not possible to override it to run a execute()like query.&lt;/p&gt;

&lt;p&gt;Thanks for your help.&lt;br/&gt;
Don&apos;t hesitate to ask if you want more details.&lt;/p&gt;

&lt;p&gt;Yan&lt;/p&gt;</description>
                <environment>Windows server 2003  PHP 5.2.17 / XP PRO 32bits XAMPP PHP 5.3.5&lt;br/&gt;
MSSQL / MYSQL&lt;br/&gt;
Symfony 1.4.6</environment>
            <key id="12702">DC-1009</key>
            <summary>save() also updates fields which should not be</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="karibusan">Yan Urquiza</reporter>
                        <labels>
                    </labels>
                <created>Wed, 8 Jun 2011 15:24:12 +0000</created>
                <updated>Wed, 8 Jun 2011 15:40:42 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="11012" name="after_with_execute.PNG" size="110183" author="karibusan" created="Wed, 8 Jun 2011 15:24:12 +0000" />
                    <attachment id="11011" name="after_with_save.PNG" size="110270" author="karibusan" created="Wed, 8 Jun 2011 15:24:12 +0000" />
                    <attachment id="11010" name="before.PNG" size="108968" author="karibusan" created="Wed, 8 Jun 2011 15:24:12 +0000" />
                    <attachment id="11014" name="retrieveByExamBatchStatus.php" size="1246" author="karibusan" created="Wed, 8 Jun 2011 15:29:50 +0000" />
                    <attachment id="11013" name="schema.yml" size="4243" author="karibusan" created="Wed, 8 Jun 2011 15:29:50 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1050] Doctrine_Relation_ForeignKey ignores ATTR_COLL_KEY attribute</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1050</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine_Relation_ForeignKey::fetchRelatedFor() executes the following code at line 70:&lt;/p&gt;

&lt;p&gt;$coll = $this-&amp;gt;getTable()&lt;del&gt;&amp;gt;getConnection()&lt;/del&gt;&amp;gt;query($dql, $id);&lt;br/&gt;
$related = $coll&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;As you can see it accesses the first element by using index &quot;0&quot; in $coll and hence ignores a modified ATTR_COLL_KEY-setting, for instance:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;setAttribute(Doctrine_Core::ATTR_COLL_KEY, &apos;id&apos;);&lt;/p&gt;

&lt;p&gt;Fortunately I had two models (ForeignA and ForeignB) in my project which both have an one-to-one relation to a third model (Main). That helped me finding this bug which causes the following strange behavior:&lt;/p&gt;

&lt;p&gt;// program 1:&lt;/p&gt;

&lt;p&gt;$m = new Main();&lt;br/&gt;
$m-&amp;gt;name = &apos;M1&apos;;&lt;br/&gt;
$m-&amp;gt;setForeignA(new ForeignA()); // has ATTR_COLL_KEY changed to &apos;id&apos;&lt;br/&gt;
$m-&amp;gt;setForeignB(new ForeignB());&lt;br/&gt;
$m-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;// program 2:&lt;/p&gt;

&lt;p&gt;$m = Doctrine_Core::getTable(&apos;M1&apos;)-&amp;gt;findOneBy(&apos;name&apos;, &apos;M1&apos;);&lt;br/&gt;
$m-&amp;gt;getForeignA()-&amp;gt;exists(); // false&lt;br/&gt;
$m-&amp;gt;getForeignB()-&amp;gt;exists(); // true&lt;/p&gt;

&lt;p&gt;-------------------------&lt;/p&gt;

&lt;p&gt;The big problem about this issue is that behavior is inconsistent. If you don&apos;t split the example above into two separate programs/processes you won&apos;t have problems, since Doctrine accesses the reference which was stored when calling save().&lt;/p&gt;

&lt;p&gt;You will get into trouble using functional tests in Symfony. Since there is only a single process for all requests I wasn&apos;t able to reproduce a problem caused by this bug which appeared in the production environment.&lt;/p&gt;

&lt;p&gt;-------------------------&lt;/p&gt;

&lt;p&gt;Edit:&lt;/p&gt;

&lt;p&gt;Doctrine_Connection::queryOne() is affected as well!&lt;/p&gt;

&lt;p&gt;A solution is to replace&lt;/p&gt;

&lt;p&gt;$coll = $this-&amp;gt;getTable()&lt;del&gt;&amp;gt;getConnection()&lt;/del&gt;&amp;gt;query($dql, $id);&lt;br/&gt;
$related = $coll&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;by&lt;/p&gt;

&lt;p&gt;$related = $this-&amp;gt;getTable()&lt;del&gt;&amp;gt;getConnection()&lt;/del&gt;&amp;gt;query($dql, $id)-&amp;gt;getFirst();&lt;/p&gt;</description>
                <environment>Windows 7 64Bit&lt;br/&gt;
PHP 5.3&lt;br/&gt;
Symfony 1.4</environment>
            <key id="13506">DC-1050</key>
            <summary>Doctrine_Relation_ForeignKey ignores ATTR_COLL_KEY attribute</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="fishbone">Uli Hecht</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Mar 2012 22:55:02 +0000</created>
                <updated>Wed, 7 Mar 2012 13:02:40 +0000</updated>
                                    <version>1.2.3</version>
                                <fixVersion>1.2.4</fixVersion>
                                <component>Attributes</component>
                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17534" author="fishbone" created="Wed, 7 Mar 2012 13:02:40 +0000"  >&lt;p&gt;Suggested patch&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11167" name="ForeignKey.php.patch" size="642" author="fishbone" created="Wed, 7 Mar 2012 13:02:40 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1052] limit() get lost on multiple joins</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1052</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;$strSql = UserFeedTable::getInstance()&lt;del&gt;&amp;gt;createQuery(&apos;q&apos;)&lt;/del&gt;&amp;gt;&lt;br/&gt;
                select(&apos;q.&lt;b&gt;, f.&lt;/b&gt;, fi.&lt;b&gt;, fav.&lt;/b&gt;&apos;)-&amp;gt;&lt;br/&gt;
                leftJoin(&apos;q.Feed f&apos;)-&amp;gt;&lt;br/&gt;
                leftJoin(&apos;f.FeedItem fi&apos;)-&amp;gt;&lt;br/&gt;
                leftJoin(&apos;fi.Favorite fav&apos;)-&amp;gt;&lt;br/&gt;
                andWhere(&apos;q.profile_id = ?&apos;, $intUserId)-&amp;gt;&lt;br/&gt;
                andWhere(&apos;q.is_active = ?&apos;, true)-&amp;gt;&lt;br/&gt;
                limit(10)-&amp;gt;getSqlQuery();&lt;br/&gt;
var_dump($strSql);&lt;/p&gt;

&lt;p&gt;string(1075) &quot;SELECT u.id AS u_&lt;em&gt;id, u.name AS u&lt;/em&gt;&lt;em&gt;name, u.image AS u&lt;/em&gt;&lt;em&gt;image, u.lead AS u&lt;/em&gt;&lt;em&gt;lead, u.headline AS u&lt;/em&gt;&lt;em&gt;headline, u.sort AS u&lt;/em&gt;&lt;em&gt;sort, u.is_active AS u&lt;/em&gt;&lt;em&gt;is_active, u.is_favorite AS u&lt;/em&gt;&lt;em&gt;is_favorite, u.feed_id AS u&lt;/em&gt;&lt;em&gt;feed_id, u.profile_id AS u&lt;/em&gt;&lt;em&gt;profile_id, u.category_id AS u&lt;/em&gt;&lt;em&gt;category_id, u.created_at AS u&lt;/em&gt;&lt;em&gt;created_at, u.updated_at AS u&lt;/em&gt;&lt;em&gt;updated_at, f.id AS f&lt;/em&gt;&lt;em&gt;id, f.url AS f&lt;/em&gt;&lt;em&gt;url, f.name AS f&lt;/em&gt;&lt;em&gt;name, f.created_at AS f&lt;/em&gt;&lt;em&gt;created_at, f.updated_at AS f&lt;/em&gt;&lt;em&gt;updated_at, f2.id AS f2&lt;/em&gt;&lt;em&gt;id, f2.lead AS f2&lt;/em&gt;&lt;em&gt;lead, f2.description AS f2&lt;/em&gt;&lt;em&gt;description, f2.image AS f2&lt;/em&gt;&lt;em&gt;image, f2.pub_date AS f2&lt;/em&gt;&lt;em&gt;pub_date, f2.link AS f2&lt;/em&gt;&lt;em&gt;link, f2.feed_id AS f2&lt;/em&gt;&lt;em&gt;feed_id, f2.created_at AS f2&lt;/em&gt;&lt;em&gt;created_at, f2.updated_at AS f2&lt;/em&gt;&lt;em&gt;updated_at, f3.id AS f3&lt;/em&gt;&lt;em&gt;id, f3.profile_id AS f3&lt;/em&gt;&lt;em&gt;profile_id, f3.feed_item_id AS f3&lt;/em&gt;&lt;em&gt;feed_item_id, f3.created_at AS f3&lt;/em&gt;&lt;em&gt;created_at, f3.updated_at AS f3&lt;/em&gt;_updated_at FROM user_feed u LEFT JOIN feed f ON u.feed_id = f.id LEFT JOIN feed_item f2 ON f.id = f2.feed_id LEFT JOIN favorite f3 ON f2.id = f3.feed_item_id WHERE u.id IN (&apos;7&apos;, &apos;8&apos;, &apos;9&apos;, &apos;10&apos;, &apos;11&apos;) AND (u.profile_id = ? AND u.is_active = ?)&quot;&lt;/p&gt;

&lt;p&gt;As you can see, the limit is missing.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13543">DC-1052</key>
            <summary>limit() get lost on multiple joins</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="kempf-solutions">Michael Kempf</reporter>
                        <labels>
                    </labels>
                <created>Tue, 20 Mar 2012 13:37:12 +0000</created>
                <updated>Tue, 20 Mar 2012 13:37:12 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1053] Renaming a doctrine &apos;string&apos; field may result in loss of data as the field&apos;s type changes. (MySQL)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1053</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Consider the following schema:&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;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;MyTable:
  columns:
    some_text:        string
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Doctrine creates the table with:&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;CREATE TABLE `my_table` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `some_text` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, the following migration should rename the field from &lt;tt&gt;some_text&lt;/tt&gt; to &lt;tt&gt;just_text&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;&amp;lt;?php
class Version1 &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Migration_Base
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function up()
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;renameColumn(&apos;my_table&apos;, &apos;some_text&apos;, &apos;just_text&apos;);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function down()
    {
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;renameColumn(&apos;my_table&apos;, &apos;just_text&apos;, &apos;some_text&apos;);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;...however the field gets renamed and the type becomes &lt;tt&gt;VARCHAR(255)&lt;/tt&gt;, as the resulting &lt;tt&gt;SHOW CREATE TABLE my_table&lt;/tt&gt; shows:&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;CREATE TABLE `my_table` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `a_varchar` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Causes data in the column greater than 255 bytes to get truncated&lt;/p&gt;</description>
                <environment>PHP 5.3.5-1ubuntu7.2ppa1~lucid with Suhosin-Patch (cli) (built: May  7 2011 03:12:27) &lt;br/&gt;
Zend Engine v2.3.0&lt;br/&gt;
Xdebug v2.0.5&lt;br/&gt;
Turnkey LAMP 10.04 LTS x86_64&lt;br/&gt;
Symfony 1.4.11&lt;br/&gt;
mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (i486) using readline 6.1</environment>
            <key id="13561">DC-1053</key>
            <summary>Renaming a doctrine &apos;string&apos; field may result in loss of data as the field&apos;s type changes. (MySQL)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="benlancaster">Ben Lancaster</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Mar 2012 20:49:27 +0000</created>
                <updated>Mon, 26 Mar 2012 20:52:02 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Migrations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1058] Warning: Invalid argument supplied for foreach() in SqlWalker.php line 899</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1058</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hallo, i get the error&lt;br/&gt;
Warning: Invalid argument supplied for foreach() in /var/www/phverbose/vendor/doctrine/Doctrine/ORM/Query/SqlWalker.php line 899&lt;/p&gt;

&lt;p&gt;Here is the line&lt;br/&gt;
foreach ($assoc&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;relationToTargetKeyColumns&amp;#39;&amp;#93;&lt;/span&gt; as $relationColumn =&amp;gt; $targetColumn) {&lt;/p&gt;

&lt;p&gt;Here are the relations and the query&lt;br/&gt;
&lt;a href=&quot;http://pastie.org/4352511&quot; class=&quot;external-link&quot;&gt;http://pastie.org/4352511&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://pastie.org/4352498&quot; class=&quot;external-link&quot;&gt;http://pastie.org/4352498&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the dump of $assoc before warning&lt;/p&gt;


&lt;p&gt;array(16) {&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;fieldName&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(5) &quot;sites&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;joinTable&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(0) {&lt;br/&gt;
  }&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;targetEntity&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(13) &quot;Entities\Site&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;mappedBy&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(6) &quot;emails&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;inversedBy&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  NULL&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;cascade&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(1) &lt;/p&gt;
{
    [0]=&amp;gt;
    string(7) &quot;persist&quot;
  }
&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;orphanRemoval&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;fetch&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  int(2)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;type&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  int(8)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isOwningSide&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;sourceEntity&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  string(14) &quot;Entities\Email&quot;&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isCascadeRemove&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isCascadePersist&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(true)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isCascadeRefresh&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isCascadeMerge&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;isCascadeDetach&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  bool(false)&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>Linux, Ubuntu 12, php 5.4</environment>
            <key id="13891">DC-1058</key>
            <summary>Warning: Invalid argument supplied for foreach() in SqlWalker.php line 899</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="alexanderc">Alexander Cucer</reporter>
                        <labels>
                        <label>paginator</label>
                    </labels>
                <created>Sun, 29 Jul 2012 09:44:56 +0000</created>
                <updated>Sun, 29 Jul 2012 09:44:56 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-49] Wrong query parameter order when using limit() on PostgreSQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-49</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Trying to add limit() to complex query with many where&apos;s and some joins. In pgsql it causes nested limit subquery and in some cases parameter order (when limit subquery exists params array just merges with itself, i. e. (1,2) becomes (1,2,1,2)) makes result query wrong, i. e. params array order doesn&apos;t correspond placeholders order in query.&lt;/p&gt;

&lt;p&gt;With named query parameters all ok.&lt;/p&gt;

&lt;p&gt;Testcase attached.&lt;/p&gt;</description>
                <environment>latest doctrine 1.1 revision, linux x64, PostgeSQL 8.4, php 5.2.10</environment>
            <key id="10098">DC-49</key>
            <summary>Wrong query parameter order when using limit() on PostgreSQL</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="corristo">Nicholas Kasyanov</reporter>
                        <labels>
                    </labels>
                <created>Tue, 22 Sep 2009 09:07:18 +0000</created>
                <updated>Mon, 26 Jul 2010 10:01:23 +0000</updated>
                                    <version>1.1.4</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="10121" author="jwage" created="Thu, 24 Sep 2009 20:54:11 +0000"  >&lt;p&gt;here is the working test case:&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 Doctrine_Ticket_DC49_TestCase &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_UnitTestCase 
{
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; $query;
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; $params;

        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function init()
        {
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;dbh = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Adapter_Mock(&apos;pgsql&apos;);
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn = Doctrine_Manager::getInstance()-&amp;gt;openConnection($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;dbh);
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;addListener(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; PPB_QueryListener());
        }
        
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function prepareTables()
        {
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;tables = array(&apos;PPB_Section&apos;, &apos;PPB_Post&apos;, &apos;PPB_PostVote&apos;);
                
                parent::prepareTables();
        }
        
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function testBug()
        {
                $q = Doctrine_Query::create()-&amp;gt;from(&apos;PPB_Post p&apos;)
                                             -&amp;gt;where(&apos;p.section_id = ?&apos;, 1)
                                             -&amp;gt;addWhere(&apos;p.id = ?&apos;, 15)
                                             -&amp;gt;leftJoin(&apos;p.Votes v WITH v.user_id = ?&apos;, 10)
                                             -&amp;gt;limit(10);
                                             
                $q-&amp;gt;execute();
                
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEqual(self::$query, &lt;span class=&quot;code-quote&quot;&gt;&quot;SELECT p.id AS p__id, p.section_id AS p__section_id, p2.id AS p2__id, p2.post_id AS p2__post_id, p2.user_id AS p2__user_id FROM p_p_b__post p LEFT JOIN p_p_b__post_vote p2 ON p.id = p2.post_id AND (p2.user_id = ?) WHERE p.id IN (SELECT doctrine_subquery_alias.id FROM (SELECT DISTINCT p3.id FROM p_p_b__post p3 LEFT JOIN p_p_b__post_vote p4 ON p3.id = p4.post_id AND (p4.user_id = ?) WHERE p3.section_id = ? AND p3.id = ? LIMIT 10) AS doctrine_subquery_alias) AND (p.section_id = ? AND p.id = ?)&quot;&lt;/span&gt;);
                
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEqual(implode(&lt;span class=&quot;code-quote&quot;&gt;&quot;,&quot;&lt;/span&gt;, self::$params), &apos;10,10,1,15,1,15&apos;); &lt;span class=&quot;code-comment&quot;&gt;// correct order of params
&lt;/span&gt;        }
}

class PPB_Post &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;section_id&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;PPB_Section&apos;, array(&apos;local&apos; =&amp;gt; &apos;section_id&apos;,
                                                   &apos;foreign&apos; =&amp;gt; &apos;id&apos;));
                                                   
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;PPB_PostVote as Votes&apos;, array(&apos;local&apos; =&amp;gt; &apos;id&apos;,
                                                              &apos;foreign&apos; =&amp;gt; &apos;post_id&apos;));
        }
}

class PPB_Section &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()
        {
        }
}

class PPB_PostVote &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;post_id&apos;, &apos;integer&apos;);
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;user_id&apos;, &apos;integer&apos;);
        }
}

class PPB_QueryListener &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_EventListener
{
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function postStmtExecute(Doctrine_Event $event)
        {
                &lt;span class=&quot;code-comment&quot;&gt;//var_dump($event-&amp;gt;getQuery());
&lt;/span&gt;                &lt;span class=&quot;code-comment&quot;&gt;//var_dump($event-&amp;gt;getParams());
&lt;/span&gt;                
                Doctrine_Ticket_DC49_TestCase::$query = $event-&amp;gt;getQuery();
                Doctrine_Ticket_DC49_TestCase::$params = $event-&amp;gt;getParams();
        }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="13705" author="dbojdo" created="Mon, 26 Jul 2010 10:01:23 +0000"  >&lt;p&gt;I fixed this bug. Patch in attachment. I hope it&apos;s clear enough.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10709" name="Doctrine_Query_Abstract.diff" size="570" author="dbojdo" created="Mon, 26 Jul 2010 10:01:23 +0000" />
                    <attachment id="10036" name="PostgresParamsBugTestCase.php" size="4520" author="corristo" created="Tue, 22 Sep 2009 09:07:18 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-67] Taggable not working</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-67</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;After enabling Taggable extension, magic methods on the tables (e.g. getPopularTags)&lt;br/&gt;
cannot be reached:&lt;/p&gt;

&lt;p&gt;Doctrine::getTable(&apos;Upload&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;

&lt;p&gt;Fatal error: Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method Doctrine_Table::getPopularTags&apos; in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php:2608 Stack trace: #0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array) #1 C:\Users\user\www\extens.dev\index.php(7): Doctrine_Table-&amp;gt;getPopularTags() #2 &lt;/p&gt;
{main}
&lt;p&gt; thrown in C:\Users\user\www\extens.dev\lib\Doctrine\Table.php on line 2608&lt;/p&gt;</description>
                <environment>PHP 5.2.8, Doctrine 1.2.0 Alpha1, Vista, Sandbox 1.2.0 Alpha1</environment>
            <key id="10118">DC-67</key>
            <summary>Taggable not working</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="admirau">admirau</reporter>
                        <labels>
                    </labels>
                <created>Mon, 28 Sep 2009 10:49:57 +0000</created>
                <updated>Thu, 15 Apr 2010 14:50:14 +0000</updated>
                                    <version>1.2.0-ALPHA1</version>
                                                <component>Extensions</component>
                        <due></due>
                    <votes>4</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="10187" author="admirau" created="Thu, 8 Oct 2009 12:16:38 +0000"  >&lt;p&gt;The same with Alpha2&lt;/p&gt;</comment>
                    <comment id="10199" author="admirau" created="Sat, 10 Oct 2009 14:34:25 +0000"  >&lt;p&gt;Running the tests results in one failure:&lt;/p&gt;


&lt;p&gt;Doctrine Unit Tests&lt;br/&gt;
===================&lt;br/&gt;
Doctrine_Template_Taggable_TestCase.............................................failed&lt;/p&gt;


&lt;p&gt;Unexpected Doctrine_Connection_Sqlite_Exception thrown in &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine_Template_Taggable_TestCase&amp;#93;&lt;/span&gt; with message [SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;HY000&amp;#93;&lt;/span&gt;: General error: 1 no such column: a__2] in C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php on line 1067&lt;/p&gt;

&lt;p&gt;Trace&lt;br/&gt;
-------------&lt;/p&gt;

&lt;p&gt;#0 C:\Users\user\www\extens.dev\lib\Doctrine\Connection.php(1015): Doctrine_Connection-&amp;gt;rethrowException(Object(PDOException), Object(Doctrine_Connection_Sqlite))&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(936): Doctrine_Connection-&amp;gt;execute(&apos;SELECT t.id AS ...&apos;, Array)&lt;br/&gt;
#2 C:\Users\user\www\extens.dev\lib\Doctrine\Query\Abstract.php(990): Doctrine_Query_Abstract-&amp;gt;_execute(Array)&lt;br/&gt;
#3 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\lib\Doctrine\Template\TaggableTag.php(76): Doctrine_Query_Abstract-&amp;gt;execute(Array, 2)&lt;br/&gt;
#4 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Template_TaggableTag-&amp;gt;getPopularTagsTableProxy(Array)&lt;br/&gt;
#5 C:\Users\user\www\extens.dev\lib\Doctrine\Record.php(2569): call_user_func_array(Array, Array)&lt;br/&gt;
#6 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Record-&amp;gt;__call(&apos;getPopularTagsT...&apos;, Array)&lt;br/&gt;
#7 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: TaggableTag-&amp;gt;getPopularTagsTableProxy(Array)&lt;br/&gt;
#8 C:\Users\user\www\extens.dev\lib\Doctrine\Table.php(2605): call_user_func_array(Array, Array)&lt;br/&gt;
#9 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#10 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\Template\TaggableTestCase.php(216): Doctrine_Table-&amp;gt;getPopularTags(Array)&lt;br/&gt;
#11 C:\Users\user\www\extens.dev\tests\DoctrineTest\UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase-&amp;gt;testGetPopularTags()&lt;br/&gt;
#12 C:\Users\user\www\extens.dev\tests\DoctrineTest\GroupTest.php(61): UnitTestCase-&amp;gt;run()&lt;br/&gt;
#13 C:\Users\user\www\extens.dev\tests\DoctrineTest.php(180): GroupTest-&amp;gt;run(Object(DoctrineTest_Reporter_Cli), &apos;&apos;)&lt;br/&gt;
#14 C:\Users\user\www\extens.dev\tools\sandbox\extensions\Taggable\tests\run.php(29): DoctrineTest-&amp;gt;run()&lt;br/&gt;
#15 &lt;/p&gt;
{main}



&lt;p&gt;Tested: 1 test cases.&lt;br/&gt;
Successes: 26 passes.&lt;br/&gt;
Failures: 1 fails.&lt;br/&gt;
Number of new Failures: 0 &lt;br/&gt;
Number of fixed Failures: 0 &lt;/p&gt;

&lt;p&gt;Tests ran in 1 seconds and used 15279.15625 KB of memory&lt;/p&gt;</comment>
                    <comment id="10468" author="jwage" created="Tue, 3 Nov 2009 21:52:15 +0000"  >&lt;p&gt;The tests all pass now.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/extension/Taggable/1_2-1_0/tests&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="10471" author="admirau" created="Wed, 4 Nov 2009 08:41:14 +0000"  >&lt;p&gt;It still does not work on my environment (Windows or Ubuntu 9.10, PHP 5.3/5.2.6)&lt;br/&gt;
The test result is a bit different, but still fails:&lt;/p&gt;

&lt;p&gt;Doctrine Unit Tests&lt;br/&gt;
===================&lt;br/&gt;
Doctrine_Template_Taggable_TestCase.............................................failed&lt;/p&gt;


&lt;p&gt;Unexpected Doctrine_Record_UnknownPropertyException thrown in &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine_Template_Taggable_TestCase&amp;#93;&lt;/span&gt; with message &lt;span class=&quot;error&quot;&gt;&amp;#91;Unknown record property / related component &amp;quot;total_num&amp;quot; on &amp;quot;TaggableTag&amp;quot;&amp;#93;&lt;/span&gt; in /home/user/doctrine12b/lib/Doctrine/Record/Filter/Standard.php on line 55&lt;/p&gt;

&lt;p&gt;Trace&lt;br/&gt;
-------------&lt;/p&gt;

&lt;p&gt;#0 /home/taat/doctrine12b/lib/Doctrine/Record.php(1359): Doctrine_Record_Filter_Standard-&amp;gt;filterGet(Object(TaggableTag), &apos;total_num&apos;)&lt;br/&gt;
#1 /home/taat/doctrine12b/lib/Doctrine/Record.php(1318): Doctrine_Record-&amp;gt;_get(&apos;total_num&apos;, true)&lt;br/&gt;
#2 /home/taat/doctrine12b/lib/Doctrine/Access.php(117): Doctrine_Record-&amp;gt;get(&apos;total_num&apos;)&lt;br/&gt;
#3 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/Template/TaggableTestCase.php(217): Doctrine_Access-&amp;gt;offsetGet(&apos;total_num&apos;)&lt;br/&gt;
#4 /home/taat/doctrine12b/tests/DoctrineTest/UnitTestCase.php(144): Doctrine_Template_Taggable_TestCase-&amp;gt;testGetPopularTags()&lt;br/&gt;
#5 /home/taat/doctrine12b/tests/DoctrineTest/GroupTest.php(61): UnitTestCase-&amp;gt;run()&lt;br/&gt;
#6 /home/taat/doctrine12b/tests/DoctrineTest.php(180): GroupTest-&amp;gt;run(Object(DoctrineTest_Reporter_Cli), &apos;&apos;)&lt;br/&gt;
#7 /home/taat/doctrine12b/tools/sandbox/extensions/Taggable/tests/run.php(29): DoctrineTest-&amp;gt;run()&lt;br/&gt;
#8 &lt;/p&gt;
{main}



&lt;p&gt;Tested: 1 test cases.&lt;br/&gt;
Successes: 26 passes.&lt;br/&gt;
Failures: 1 fails.&lt;br/&gt;
Number of new Failures: 0 &lt;br/&gt;
Number of fixed Failures: 0 &lt;/p&gt;</comment>
                    <comment id="10486" author="jwage" created="Wed, 4 Nov 2009 14:23:51 +0000"  >&lt;p&gt;Did you update Doctrine? I fixed something in Doctrine 1.2 that fixes it.&lt;/p&gt;</comment>
                    <comment id="10487" author="admirau" created="Wed, 4 Nov 2009 15:07:57 +0000"  >&lt;p&gt;Yes, the results above  (&quot;total_num&quot;) I get after updating to 1.2.0-BETA1.&lt;br/&gt;
At 1.2.0-ALPHA2 it was &quot;no such column: a__2&quot; (see above comments).&lt;/p&gt;

&lt;p&gt;Do the extensions work with 2.0, or they are 1.2 specific?&lt;/p&gt;</comment>
                    <comment id="10488" author="jwage" created="Wed, 4 Nov 2009 15:10:55 +0000"  >&lt;p&gt;1.2 specific. I don&apos;t get any fails now, can you try and troubleshoot it and figure out why it fails for you? They don&apos;t fail for me anywhere.&lt;/p&gt;</comment>
                    <comment id="10492" author="admirau" created="Wed, 4 Nov 2009 18:45:41 +0000"  >&lt;p&gt;Doctrine_Template_Taggable_TestCase::testGetPopularTags()&lt;br/&gt;
line 214:&lt;br/&gt;
$test = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(array(&apos;ArticleTaggableTest&apos;, &apos;ArticleTaggableTest2&apos;));&lt;/p&gt;

&lt;p&gt;// compare this with your results&lt;br/&gt;
echo serialize($test);&lt;br/&gt;
result:&lt;br/&gt;
C:19:&quot;Doctrine_Collection&quot;:169:{a:7:{s:4:&quot;data&quot;;a:0:{}s:6:&quot;_table&quot;;s:11:&quot;TaggableTag&quot;;s:9:&quot;_snapshot&quot;;a:0:{}s:14:&quot;referenceField&quot;;N;s:9:&quot;keyColumn&quot;;s:4:&quot;name&quot;;s:8:&quot;_locator&quot;;N;s:10:&quot;_resources&quot;;a:0:{}}}&lt;/p&gt;

&lt;p&gt;When I try to var_dump($test),&lt;br/&gt;
I get circular dependency.&lt;br/&gt;
I tried to save results of var_dump($test) to disk, by I get 1,5GB file, and still growing...&lt;/p&gt;

&lt;p&gt;Maybe this article helps somehow:&lt;br/&gt;
&lt;a href=&quot;http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency&quot; class=&quot;external-link&quot;&gt;http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Can I see the fix you mentioned above?&lt;/p&gt;

&lt;p&gt;I&apos;m sorry, but I do not know what else I can do.&lt;br/&gt;
Any ideas?&lt;/p&gt;</comment>
                    <comment id="10568" author="jwage" created="Tue, 10 Nov 2009 17:30:55 +0000"  >&lt;p&gt;I am not sure what to say since it is working for me on all the machines I test. I&apos;ll be happy to look if I can get something to fail so I can troubleshoot it.&lt;/p&gt;</comment>
                    <comment id="10584" author="admirau" created="Wed, 11 Nov 2009 12:19:34 +0000"  >&lt;p&gt;I&apos;ve tested on PLD Linux too.&lt;br/&gt;
The same thing.&lt;/p&gt;

&lt;p&gt;Could you provide sample server/php configuration on which the tests are passing?&lt;/p&gt;

&lt;p&gt;Can you describe the fix you&apos;ve made to correct the errors with &apos;&apos;Unknown method Doctrine_Table::getPopularTags&apos;.&lt;br/&gt;
Maybe I can manage to investigate it, but I do not know where to start.&lt;/p&gt;</comment>
                    <comment id="10592" author="admirau" created="Wed, 11 Nov 2009 14:24:04 +0000"  >&lt;p&gt;Sorry for reopening this again.&lt;/p&gt;

&lt;p&gt;After upgrading to BETA2 all Taggable tests are passing OK for me too.&lt;/p&gt;

&lt;p&gt;However, in the code I still get &apos;Unknown method BlogPostTable::getPopularTags&apos; in /tools\sandbox\lib\Doctrine\Table.php:2793&apos;&lt;br/&gt;
Isn&apos;t it a regression of the bug you&apos;ve already fixed before ALPHA2?&lt;/p&gt;


&lt;p&gt;Here is the description of how I came to this exception.&lt;/p&gt;

&lt;p&gt;At the very end of config.php:&lt;/p&gt;

&lt;p&gt;$manager-&amp;gt;registerExtension(&apos;Taggable&apos;);&lt;/p&gt;

&lt;p&gt;In the index.php:&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;/p&gt;

&lt;p&gt;require_once(&apos;config.php&apos;);&lt;/p&gt;

&lt;p&gt;$models = Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;

&lt;p&gt;$post = new BlogPost();&lt;br/&gt;
$post-&amp;gt;title = &apos;This is a sample blog post&apos;;&lt;br/&gt;
$post-&amp;gt;description = &apos;Cool!&apos;;&lt;br/&gt;
$post-&amp;gt;setTags(&apos;2009, symfony, doctrine&apos;);&lt;br/&gt;
$post-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;$table = Doctrine::getTable(&apos;BlogPost&apos;);&lt;br/&gt;
echo get_class($table);     // echoes Doctrine_Collection&lt;br/&gt;
$table-&amp;gt;getPopularTags();   // this throws the exception&lt;/p&gt;

&lt;p&gt;Then in the console:&lt;br/&gt;
php doctrine.php create-db&lt;br/&gt;
php doctrine.php generate-models-yaml (BaseBlogPost, BlogPost, BlogPostTable were generated)&lt;br/&gt;
php doctrine.php generate-sql (see SQL below)&lt;br/&gt;
php doctrine.php create-tables&lt;br/&gt;
(all ok)&lt;/p&gt;

&lt;p&gt;php index.php&lt;/p&gt;

&lt;p&gt;result:&lt;/p&gt;

&lt;p&gt;BlogPostTablePHP Fatal error:  Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method BlogPostTable::getPopularTags&apos; in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable-&amp;gt;getPopularTags()&lt;br/&gt;
#2 &lt;/p&gt;
{main}&lt;br/&gt;
  thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793&lt;br/&gt;
Fatal error: Uncaught exception &apos;Doctrine_Table_Exception&apos; with message &apos;Unknown method BlogPostTable::getPopularTags&apos; in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php:2793&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 &lt;span class=&quot;error&quot;&gt;&amp;#91;internal function&amp;#93;&lt;/span&gt;: Doctrine_Table-&amp;gt;__call(&apos;getPopularTags&apos;, Array)&lt;br/&gt;
#1 C:\Users\user\www\extens.dev\tools\sandbox\index.php(15): BlogPostTable-&amp;gt;getPopularTags()&lt;br/&gt;
#2 {main}
&lt;p&gt;  thrown in C:\Users\user\www\extens.dev\tools\sandbox\lib\Doctrine\Table.php on line 2793&lt;/p&gt;

&lt;p&gt;And here is the generated SQL:&lt;/p&gt;

&lt;p&gt;CREATE TABLE taggable_tag (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) UNIQUE);&lt;br/&gt;
CREATE TABLE blog_post_taggable_tag (id INTEGER, tag_id INTEGER, PRIMARY KEY(id, tag_id));&lt;br/&gt;
CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL);&lt;/p&gt;</comment>
                    <comment id="10616" author="jwage" created="Thu, 12 Nov 2009 20:50:21 +0000"  >&lt;p&gt;When I test your code, it is working for me. You sure you don&apos;t have some old versions of PHP or something?&lt;/p&gt;</comment>
                    <comment id="10619" author="admirau" created="Thu, 12 Nov 2009 21:33:08 +0000"  >&lt;p&gt;Everything is up to date.&lt;br/&gt;
Tested on different servers, with different operating systems, different versions PHP, different versions of Doctrine, by different people.&lt;/p&gt;

&lt;p&gt;Common thing for all these machines is that PHP (&amp;gt;5.2.10 &amp;lt;= 5.3.1) was installed from precompiled builds, not from source.&lt;/p&gt;

&lt;p&gt;The error I get now is the same error I got earlier (at the beginning of this topic), which disapperared after your fix.&lt;br/&gt;
Then appeared the second error, which was fixed in BETA2, but the previous error is back. (strange, but the tests are passing now, despite the errors in the regular code).&lt;/p&gt;

&lt;p&gt;When I find some spare time I&apos;ll try to trace the changes you&apos;ve made since the beginning of the topic.&lt;/p&gt;</comment>
                    <comment id="10733" author="admirau" created="Wed, 18 Nov 2009 14:12:11 +0000"  >&lt;p&gt;Maybe the models are generated not properly.&lt;br/&gt;
Here are my models (three) for the reproduction procedure (above):&lt;/p&gt;

&lt;p&gt;class BlogPostTable extends Doctrine_Table {}&lt;/p&gt;

&lt;p&gt;class BlogPost extends BaseBlogPost {}&lt;/p&gt;

&lt;p&gt;abstract class BaseBlogPost extends Doctrine_Record&lt;br/&gt;
{&lt;br/&gt;
    public function setTableDefinition()&lt;/p&gt;
    {
        $this-&amp;gt;setTableName(&apos;blog_post&apos;);
        $this-&amp;gt;hasColumn(&apos;title&apos;, &apos;string&apos;, 255, array(
        											   &apos;type&apos; =&amp;gt; &apos;string&apos;,
        											   &apos;notnull&apos; =&amp;gt; true,
        											   &apos;length&apos; =&amp;gt; &apos;255&apos;,
        											   ));
        $this-&amp;gt;hasColumn(&apos;description&apos;, &apos;string&apos;, 255, array(
        													 &apos;type&apos; =&amp;gt; &apos;string&apos;,
        													 &apos;notnull&apos; =&amp;gt; true,
        													 &apos;length&apos; =&amp;gt; &apos;255&apos;,
        													 ));
    }

&lt;p&gt;    public function setUp()&lt;/p&gt;
    {
        parent::setUp();
        $taggable0 = new Doctrine_Template_Taggable();
        $this-&amp;gt;actAs($taggable0);
    }
&lt;p&gt;}&lt;/p&gt;</comment>
                    <comment id="10758" author="jwage" created="Wed, 18 Nov 2009 22:11:51 +0000"  >&lt;p&gt;I have everything generated the same as you.&lt;/p&gt;</comment>
                    <comment id="10811" author="balupton" created="Sat, 21 Nov 2009 12:12:04 +0000"  >&lt;p&gt;Also getting this. Using doctrine 1.2.0-beta3 and also tried with latest SVN. Taggable is latest available.&lt;/p&gt;

&lt;p&gt;PHP 5.3.0 running on Zend Server version 5.0.0Beta2&lt;/p&gt;</comment>
                    <comment id="10832" author="admirau" created="Tue, 24 Nov 2009 07:59:51 +0000"  >&lt;p&gt;No changes after upgrade to 1.2.0-RC1.&lt;/p&gt;</comment>
                    <comment id="10848" author="admirau" created="Tue, 24 Nov 2009 20:30:36 +0000"  >&lt;p&gt;Maybe this helps somehow:&lt;/p&gt;

&lt;p&gt;// Following line throws:&lt;br/&gt;
// Doctrine_Table_Exception: Unknown method Doctrine_Table::getPopularTags in /home/user/doctrine12rc1/lib/Doctrine/Table.php on line 2799&lt;br/&gt;
$tags = Doctrine::getTable(&apos;BlogPost&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;


&lt;p&gt;// This line returns collection of tags, as expected&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(&apos;BlogPost&apos;);&lt;/p&gt;


&lt;p&gt;$rel = Doctrine::getTable(&apos;BlogPost&apos;)-&amp;gt;getRelations();          // is int(2)&lt;br/&gt;
$rel = Doctrine::getTable(&apos;TagableTag&apos;)-&amp;gt;getRelations();     // is int(2)&lt;/p&gt;


</comment>
                    <comment id="11202" author="wormling" created="Wed, 16 Dec 2009 16:46:38 +0000"  >&lt;p&gt;Symfony 1.3 SVN updated as of this post.&lt;/p&gt;

&lt;p&gt;Ubuntu Karmic with PHP 5.3.1&lt;/p&gt;

&lt;p&gt;I have installed Taggable in mysymfonyproject/lib/doctrine_extensions/Taggable&lt;/p&gt;

&lt;p&gt;I have two example tables defined with Taggable:&lt;/p&gt;

&lt;p&gt;Video:&lt;br/&gt;
  actAs: &lt;/p&gt;
{ Taggable: ~, Timestampable: ~ }
&lt;p&gt;  columns:&lt;br/&gt;
    id: &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    content_id: &lt;/p&gt;
{ type: integer, notnull: true }
&lt;p&gt;    title: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    description: &lt;/p&gt;
{ type: clob }
&lt;p&gt;  relations:&lt;br/&gt;
    Content: &lt;/p&gt;
{ local: content_id, foreign: id }

&lt;p&gt;Photo:&lt;br/&gt;
  actAs: &lt;/p&gt;
{ Taggable: ~, Timestampable: ~ }
&lt;p&gt;  columns:&lt;br/&gt;
    id: &lt;/p&gt;
{ type: integer, primary: true, autoincrement: true }
&lt;p&gt;    content_id: &lt;/p&gt;
{ type: integer, notnull: true }
&lt;p&gt;    title: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;    description: &lt;/p&gt;
{ type: clob }
&lt;p&gt;    uri: &lt;/p&gt;
{ type: string(255) }
&lt;p&gt;  relations:&lt;br/&gt;
    Content: &lt;/p&gt;
{ local: content_id, foreign: id }

&lt;p&gt;The following code functions and populates the database:&lt;br/&gt;
$video = new Video();&lt;br/&gt;
...&lt;br/&gt;
$video-&amp;gt;setTags(implode(&quot;, &quot;, $tags));&lt;br/&gt;
$video-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;The following code errors:&lt;br/&gt;
$tags = Doctrine::getTable(&apos;Video&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;

&lt;p&gt;500 | Internal Server Error | Doctrine_Table_Exception&lt;br/&gt;
Unknown method VideoTable::getPopularTags&lt;/p&gt;

&lt;p&gt;The following code errors:&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(&apos;Video&apos;);&lt;/p&gt;

&lt;p&gt;500 | Internal Server Error | Doctrine_Exception&lt;br/&gt;
Couldn&apos;t find class TagableTag&lt;/p&gt;</comment>
                    <comment id="11434" author="sorin" created="Wed, 20 Jan 2010 13:36:07 +0000"  >&lt;p&gt;Dont know if its related to this issue or not, but for some reason Doctrine::getTable(&apos;TaggableTag&apos;) throws a &quot;&lt;/p&gt;
{Doctrine_Exception}
&lt;p&gt; Couldn&apos;t find class TaggableTag&quot; exception&lt;/p&gt;

&lt;p&gt;I understand that you would normally do this:&lt;br/&gt;
Doctrine::getTable(&apos;Video&apos;)-&amp;gt;getTags() &lt;br/&gt;
but I just want plain access to the TaggableTag model and Doctrine doesnt seem to generate any model classess for TaggableTag &lt;/p&gt;</comment>
                    <comment id="11900" author="jwage" created="Mon, 1 Mar 2010 16:18:10 +0000"  >&lt;p&gt;I have tested everything everyone has provided and it is all working for me. The only thing I can suggest now is that someone creates a Doctrine failing test case so that I can run it to see the failure.&lt;/p&gt;</comment>
                    <comment id="11938" author="balupton" created="Mon, 1 Mar 2010 20:23:35 +0000"  >&lt;p&gt;Will create a test case this weekend for this and a few other problems I&apos;ve across (with fixes). Nothing more frustrating than not being able to reproduce a problem, so I feel your pain.&lt;/p&gt;</comment>
                    <comment id="11984" author="ivarne" created="Tue, 2 Mar 2010 14:04:20 +0000"  >&lt;p&gt;I think this bug i related to the bug in the documentation &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-378&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-378&lt;/a&gt; to get the popular tags you will first have to load the models you want the tags for.&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;// load models that you want the tags from
&lt;/span&gt;Doctrine::getTable(&apos;blog&apos;);
Doctrine::getTable(&apos;products&apos;);
&lt;span class=&quot;code-comment&quot;&gt;// then you can get the tags &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the models currently loaded
&lt;/span&gt;$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12047" author="wormling" created="Sun, 7 Mar 2010 00:41:57 +0000"  >&lt;p&gt;This works for me:&lt;/p&gt;

&lt;p&gt;// load models that you want the tags from&lt;br/&gt;
Doctrine::getTable(&apos;blog&apos;);&lt;br/&gt;
Doctrine::getTable(&apos;products&apos;);&lt;br/&gt;
// then you can get the tags for the models currently loaded&lt;br/&gt;
$tags = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags();&lt;/p&gt;</comment>
                    <comment id="12541" author="balupton" created="Thu, 1 Apr 2010 07:00:29 +0000"  >&lt;p&gt;Okie... Creating test cases for this turned out to be more complicated than I can handle - myself not being that familiar with phpunit.&lt;br/&gt;
Although within the test it is written as:&lt;br/&gt;
$test = Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags(array(&apos;ArticleTaggableTest&apos;, &apos;ArticleTaggableTest2&apos;));&lt;br/&gt;
Rather than:&lt;br/&gt;
$test = Doctrine::getTable(&apos;ArticleTaggableTest&apos;)-&amp;gt;getPopularTags();&lt;br/&gt;
which is what this problem is about.&lt;/p&gt;


&lt;p&gt;Although I do believe I&apos;ve nailed the source of the problem - as well as others I&apos;ve experienced.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Problems are introduced when using pear style model names. Indirectly fixed with: &lt;a href=&quot;http://pastebin.com/DKGcgAht&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/DKGcgAht&lt;/a&gt; - links to fix in Doctrine/Record/Generator.php&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using custom names for the taggable field. Such as: &lt;a href=&quot;http://pastebin.com/JdhqeG38&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/JdhqeG38&lt;/a&gt; - example&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using inheritance for models.  Such as: &lt;a href=&quot;http://pastebin.com/Qwuwk0z1&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/Qwuwk0z1&lt;/a&gt; - example&lt;/li&gt;
	&lt;li&gt;Problems are introduced when using taggable relations when the record has not been inserted yet. Such as: &lt;a href=&quot;http://pastebin.com/ahPpqTdK&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/ahPpqTdK&lt;/a&gt; - example&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Having either of the above causes the system to fall down. I&apos;ve applied a bunch of fixes/changes to taggable to ensure it works with my systems, such as &lt;a href=&quot;http://sos.7dots.co.uk/&quot; class=&quot;external-link&quot;&gt;http://sos.7dots.co.uk/&lt;/a&gt; (still in staging) which uses all of the above mentioned problems, not sure how to do a diff but here is the file:&lt;br/&gt;
&lt;a href=&quot;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&quot; class=&quot;external-link&quot;&gt;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope that helps some people. Any changes I&apos;ve made code can come under the same licence as doctrine, so no worries there.&lt;/p&gt;</comment>
                    <comment id="12672" author="admirau" created="Thu, 15 Apr 2010 11:12:28 +0000"  >&lt;p&gt;With 1.2.2 there is some progress.&lt;br/&gt;
There was still 1 test failing (CASCADE),&lt;br/&gt;
but with the version:&lt;br/&gt;
&lt;a href=&quot;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&quot; class=&quot;external-link&quot;&gt;http://www.2shared.com/file/12385197/c5911e42/Taggable.html&lt;/a&gt;&lt;br/&gt;
provided by Benjamin Arthur Lupton &lt;br/&gt;
all test are passing now.&lt;/p&gt;

&lt;p&gt;But now when I run:&lt;br/&gt;
getTable(&apos;ArticleTaggableTest&apos;)-&amp;gt;getPopularTags();&lt;br/&gt;
I get: ERROR: column &quot;i2__1&quot; does not exist&lt;/p&gt;


&lt;p&gt;The failing query on PostgreSql is:&lt;/p&gt;

&lt;p&gt;SELECT t.id AS t_&lt;em&gt;id, t.name AS t&lt;/em&gt;&lt;em&gt;name, COUNT(DISTINCT i.id) AS i&lt;/em&gt;_0,&lt;br/&gt;
                                                          (COUNT(DISTINCT i.id)) AS i__1&lt;br/&gt;
FROM taggable_tag t&lt;br/&gt;
LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c ON (t.id = c.tag_id)&lt;br/&gt;
LEFT JOIN image i ON i.id = c.id&lt;br/&gt;
WHERE t.id IN&lt;br/&gt;
    (SELECT doctrine_subquery_alias.id&lt;br/&gt;
     FROM&lt;br/&gt;
       (SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1&lt;br/&gt;
        FROM taggable_tag t2&lt;br/&gt;
        LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c2 ON (t2.id = c2.tag_id)&lt;br/&gt;
        LEFT JOIN image i2 ON i2.id = c2.id&lt;br/&gt;
        GROUP BY t2.id HAVING i2__1 &amp;gt; 0&lt;br/&gt;
        ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)&lt;br/&gt;
GROUP BY t.id HAVING i__1 &amp;gt; 0&lt;br/&gt;
ORDER BY i__1 DESC&lt;/p&gt;


&lt;p&gt;Seems that this just a PostgreSql issue.&lt;br/&gt;
On Mysql it runs just fine.&lt;/p&gt;</comment>
                    <comment id="12680" author="ivarne" created="Thu, 15 Apr 2010 14:28:58 +0000"  >&lt;p&gt;The last comment is concerning how the poular tags are found and rated (on PostgreSql). I think this is unrelated to the rest of this issue and should be moved to a separate issue. (also I only got junk ads when I tried to get the file you are linking to).&lt;/p&gt;</comment>
                    <comment id="12681" author="admirau" created="Thu, 15 Apr 2010 14:40:28 +0000"  >&lt;p&gt;I have created separated issue for this:&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-634&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-634&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And yes, this link is quite odd...&lt;br/&gt;
There is a lot of crap,&lt;br/&gt;
however there is a small link, to download improved code:&lt;/p&gt;

&lt;p&gt;Look for: &quot;Save file to your PC: click here&quot;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-81] Using WITH in combinations with LIMIT returns unexpected results</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-81</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When I try to limit left joined records with an additional WITH clause, it seems to be bugged when also specifying a LIMIT.&lt;/p&gt;

&lt;p&gt;My DQL:&lt;/p&gt;

&lt;p&gt;FROM Transporter t LEFT JOIN t.Profile p LEFT JOIN t.Requests r WITH (r.distributor_id = ?) WHERE t.is_active = ? ORDER BY p.company_country, p.company_name LIMIT 20&lt;/p&gt;

&lt;p&gt;This returns me 0 results, while removing the LIMIT (or the WITH) will return me 2 results.&lt;/p&gt;</description>
                <environment>Mac OS X 10.6.1</environment>
            <key id="10143">DC-81</key>
            <summary>Using WITH in combinations with LIMIT returns unexpected results</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="gerryvdm">Gerry Vandermaesen</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Oct 2009 07:59:08 +0000</created>
                <updated>Tue, 15 Jun 2010 10:15:33 +0000</updated>
                                    <version>1.2.0-ALPHA1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10420" author="jwage" created="Mon, 2 Nov 2009 22:35:55 +0000"  >&lt;p&gt;Sorry this is just not enough information to produce the problem. I ran some basic tests looking for what you pointed out but I didn&apos;t see any issues. Plus our tests cover this functionality so I imagine that if it were broke we&apos;d get some failures. However, I could be wrong so if you could re-open and provide a failing test case for us that would help with getting it fixed.&lt;/p&gt;</comment>
                    <comment id="12688" author="gerryvdm" created="Fri, 16 Apr 2010 05:27:46 +0000"  >&lt;p&gt;I actually ran into this problem once again in another problem.&lt;/p&gt;

&lt;p&gt;Schema:&lt;/p&gt;

&lt;p&gt;Story:&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;/p&gt;

&lt;p&gt;Picture:&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    story_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    is_selected:&lt;br/&gt;
      type: boolean&lt;br/&gt;
      notnull: true&lt;br/&gt;
      default: false&lt;br/&gt;
  relations:&lt;br/&gt;
    Story:&lt;br/&gt;
      foreignAlias: Pictures&lt;br/&gt;
      local: story_id&lt;br/&gt;
      foreign: id&lt;br/&gt;
      type: one&lt;br/&gt;
      foreignType: many&lt;br/&gt;
      onDelete: CASCADE&lt;/p&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;Doctrine_Query::create()&lt;br/&gt;
	-&amp;gt;from(&apos;Story s&apos;)&lt;br/&gt;
	-&amp;gt;leftJoin(&apos;s.Pictures p WITH p.is_selected = ?&apos;, true)&lt;br/&gt;
	-&amp;gt;where(&apos;s.id = ?&apos;, 5)&lt;br/&gt;
	-&amp;gt;limit(10);&lt;/p&gt;

&lt;p&gt;Outputted SQL:&lt;/p&gt;

&lt;p&gt;SELECT  &quot;s&quot;.&quot;id&quot; AS &quot;s_&lt;em&gt;id&quot;, &quot;s&quot;.&quot;first_name&quot; AS &quot;s&lt;/em&gt;&lt;em&gt;first_name&quot;, &quot;s&quot;.&quot;last_name&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;last_name&quot;, &quot;s&quot;.&quot;country&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;country&quot;, &quot;s&quot;.&quot;email&quot; AS &quot;s&lt;/em&gt;&lt;em&gt;email&quot;, &quot;s&quot;.&quot;content&quot; AS &quot;s&lt;/em&gt;&lt;em&gt;content&quot;, &quot;s&quot;.&quot;title&quot; AS &quot;s&lt;/em&gt;&lt;em&gt;title&quot;, &quot;s&quot;.&quot;summary&quot; AS &quot;s&lt;/em&gt;&lt;em&gt;summary&quot;, &quot;s&quot;.&quot;is_published&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;is_published&quot;, &quot;s&quot;.&quot;is_rejected&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;is_rejected&quot;, &quot;s&quot;.&quot;is_promoted&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;is_promoted&quot;, &quot;s&quot;.&quot;published_at&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;published_at&quot;, &quot;s&quot;.&quot;created_at&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;created_at&quot;, &quot;s&quot;.&quot;updated_at&quot; AS  &quot;s&lt;/em&gt;&lt;em&gt;updated_at&quot;, &quot;p&quot;.&quot;id&quot; AS &quot;p&lt;/em&gt;&lt;em&gt;id&quot;, &quot;p&quot;.&quot;story_id&quot; AS &quot;p&lt;/em&gt;&lt;em&gt;story_id&quot;, &quot;p&quot;.&quot;filename_original&quot; AS  &quot;p&lt;/em&gt;&lt;em&gt;filename_original&quot;, &quot;p&quot;.&quot;filename_large&quot; AS &quot;p&lt;/em&gt;&lt;em&gt;filename_large&quot;, &quot;p&quot;.&quot;filename_thumb&quot; AS &quot;p&lt;/em&gt;&lt;em&gt;filename_thumb&quot;, &quot;p&quot;.&quot;mime_type&quot; AS  &quot;p&lt;/em&gt;&lt;em&gt;mime_type&quot;, &quot;p&quot;.&quot;is_selected&quot; AS  &quot;p&lt;/em&gt;&lt;em&gt;is_selected&quot;, &quot;p&quot;.&quot;created_at&quot; AS  &quot;p&lt;/em&gt;&lt;em&gt;created_at&quot;, &quot;p&quot;.&quot;updated_at&quot; AS  &quot;p&lt;/em&gt;_updated_at&quot; FROM &quot;story&quot; &quot;s&quot; LEFT JOIN &quot;picture&quot; &quot;p&quot; ON &quot;s&quot;.&quot;id&quot; = &quot;p&quot;.&quot;story_id&quot; AND (&quot;p&quot;.&quot;is_selected&quot; = &apos;1&apos;) WHERE &quot;s&quot;.&quot;id&quot; IN (SELECT  DISTINCT &quot;s2&quot;.&quot;id&quot; FROM &quot;story&quot; &quot;s2&quot; LEFT JOIN &quot;picture&quot; &quot;p2&quot; ON &quot;s2&quot;.&quot;id&quot; = &quot;p2&quot;.&quot;story_id&quot; AND (&quot;p2&quot;.&quot;is_selected&quot; = &apos;5&apos;) WHERE &quot;s2&quot;.&quot;id&quot; = &apos;1&apos; ORDER BY &quot;s2&quot;.&quot;published_at&quot; DESC LIMIT  10) AND (&quot;s&quot;.&quot;id&quot; = &apos;5&apos;) ORDER BY  &quot;s&quot;.&quot;published_at&quot; DESC&lt;/p&gt;

&lt;p&gt;Notice the WHERE &quot;s2&quot;.&quot;id&quot; = &apos;1&apos; !&lt;/p&gt;</comment>
                    <comment id="13194" author="jwage" created="Tue, 8 Jun 2010 15:01:06 +0000"  >&lt;p&gt;Can you provide a test case we can run?&lt;/p&gt;</comment>
                    <comment id="13327" author="gerryvdm" created="Tue, 15 Jun 2010 10:15:33 +0000"  >&lt;p&gt;I could not figure out what test to write but I did narrow the problem down.&lt;/p&gt;

&lt;p&gt;It seems that the order of the generated SQL clauses does not match the order of the passed parameters, so in the final SQL query the values are mixed up. You can actually see that happening in the SQL query above. I also noticed there a special cases hardcoded in the code for MySQL and PgSQL as far as these &quot;limit subqueries&quot; go, so that might be another reason why you havent bumped into problem before. I was using an SQLite driver.&lt;/p&gt;

&lt;p&gt;I suppose something goes wrong in the SQL generation, but I don&apos;t know the core good enough to find out where exactly it does go wrong, so I&apos;m afraid I can&apos;t attach a test case, but it should be easy to reproduce now anyway.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-185] The pessimistic offline locking manager locks the entire table</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-185</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Scenario: &lt;br/&gt;
    $entity = Doctrine::getTable(&apos;Steps&apos;)-&amp;gt;find($pID);&lt;br/&gt;
    $lockingManager = new Doctrine_Locking_Manager_Pessimistic( Doctrine_Manager::connection()  );&lt;br/&gt;
    $lockingManager-&amp;gt;releaseAgedLocks(300);&lt;br/&gt;
    $gotLock = $lockingManager-&amp;gt;getLock($entity, &apos;user1&apos; ); &lt;/p&gt;

&lt;p&gt;Running this code locks the entire table &quot;Steps&quot;, and not just the record. &lt;/p&gt;

&lt;p&gt;in the table &quot;doctrine_lock_tracking&quot;, in the fields: &quot;object_type&quot; and &quot;object_key&quot;  are saved in this case: &quot;Steps&quot; and &quot;IDStep&quot;. &lt;br/&gt;
I think that here must be saved &quot;Steps&quot; and &quot;120&quot; (the value of IDStep). &lt;/p&gt;
</description>
                <environment>Windows XP, WampServer Version 2.0&lt;br/&gt;
</environment>
            <key id="10336">DC-185</key>
            <summary>The pessimistic offline locking manager locks the entire table</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="fbrussa">Fabian Brussa</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Nov 2009 18:33:58 +0000</created>
                <updated>Thu, 13 Dec 2012 13:12:52 +0000</updated>
                                    <version>1.1.4</version>
                <version>1.1.5</version>
                <version>1.2.3</version>
                                                        <due></due>
                    <votes>7</votes>
                        <watches>7</watches>
                        <comments>
                    <comment id="10736" author="fbrussa" created="Wed, 18 Nov 2009 16:01:48 +0000"  >&lt;p&gt;Is anybody looking into this issue ?&lt;/p&gt;</comment>
                    <comment id="10755" author="jwage" created="Wed, 18 Nov 2009 22:05:55 +0000"  >&lt;p&gt;Can you provide a test case that shows the issue? It is hard to look into the issue without a test to run &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; When I look at the code and our tests everything is passing and fine so I am not sure what your issue could be. Re-open if you have more information to provide.&lt;/p&gt;</comment>
                    <comment id="10774" author="fbrussa" created="Thu, 19 Nov 2009 12:14:42 +0000"  >&lt;p&gt;ok, I attach the test case&lt;/p&gt;</comment>
                    <comment id="10994" author="fbrussa" created="Thu, 3 Dec 2009 19:51:20 +0000"  >&lt;p&gt;Have you already been able to look at the testcase ??&lt;/p&gt;</comment>
                    <comment id="11385" author="fbrussa" created="Thu, 14 Jan 2010 19:48:41 +0000"  >&lt;p&gt;Any news ??&lt;/p&gt;</comment>
                    <comment id="13413" author="leszczu" created="Fri, 25 Jun 2010 10:15:21 +0000"  >&lt;p&gt;This issue is still valid for Doctrine 1.2. Doctrine_Locking_Manager_Pessimistic is &lt;b&gt;UNUSABLE&lt;/b&gt; without this bug fixed!&lt;/p&gt;</comment>
                    <comment id="13496" author="markus.woessner" created="Fri, 2 Jul 2010 05:26:05 +0000"  >&lt;p&gt;Having a look at &quot;Doctrine_Locking_Manager_Pessimistic::getLock()&quot; it becomes clear what causes this misbehaviour:&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 getLock(Doctrine_Record $record, $userIdent)
    {
        $objectType = $record-&amp;gt;getTable()-&amp;gt;getComponentName();
        $key        = $record-&amp;gt;getTable()-&amp;gt;getIdentifier();

        $gotLock = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        $time = time();

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_array($key)) {
            &lt;span class=&quot;code-comment&quot;&gt;// Composite key
&lt;/span&gt;            $key = implode(&apos;|&apos;, $key);
        }

        &lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt; {
            $dbh = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getDbh();
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;beginTransaction();

            $stmt = $dbh-&amp;gt;prepare(&apos;INSERT INTO &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_lockTable
                                  . &apos; (object_type, object_key, user_ident, timestamp_obtained)&apos;
                                  . &apos; VALUES (:object_type, :object_key, :user_ident, :ts_obtained)&apos;);

            $stmt-&amp;gt;bindParam(&apos;:object_type&apos;, $objectType);
            $stmt-&amp;gt;bindParam(&apos;:object_key&apos;, $key);
            $stmt-&amp;gt;bindParam(&apos;:user_ident&apos;, $userIdent);
            $stmt-&amp;gt;bindParam(&apos;:ts_obtained&apos;, $time);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There is NO hint about the Record&apos;s identifier VALUE but only about the identifier&apos;s NAME (mostly &quot;id&quot;) which appears to be redundant information. Instead of ...&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;        $key = $record-&amp;gt;getTable()-&amp;gt;getIdentifier();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;..there should be something like ..&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;        $key = $record-&amp;gt;get($record-&amp;gt;getTable()-&amp;gt;getIdentifier());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In case of composite keys a string concatenation, prefixed by identifier&apos;s name might work but I would recommend using &quot;md5()&quot; on resulting value to limit its length since field &quot;object_key&quot; is limited to 250 chars.&lt;/p&gt;</comment>
                    <comment id="13497" author="branleb" created="Fri, 2 Jul 2010 10:49:03 +0000"  >&lt;p&gt;Based on the previous comment by Markus W&#246;&#223;ner i created a patch for  row based locking.&lt;/p&gt;

&lt;p&gt;It concatenates the PK fields and their values to a string and calculates the sha-1 hash as a unique string representing that record. This string is then used as key so that we&apos;ll only lock the single Record and not the whole table.&lt;/p&gt;

&lt;p&gt;I hope you&apos;ll give this patch a try - It solved this problem for me.&lt;/p&gt;</comment>
                    <comment id="13498" author="markus.woessner" created="Fri, 2 Jul 2010 17:18:56 +0000"  >&lt;p&gt;I applied patch from Mr. Florian Zumkeller-Quast and provided testcase didn&apos;t fail anymore. I think this should do it. By the way I find it strange that this issue isn&apos;t already fixed. I guess locking is not very much used by Doctrine users.&lt;/p&gt;</comment>
                    <comment id="16895" author="jeromeweb" created="Mon, 21 Nov 2011 10:29:51 +0000"  >&lt;p&gt;I applied patch too and it works now. I guess too that nobody use Lockings but when you use it ... without the patch it fails.&lt;/p&gt;</comment>
                    <comment id="19131" author="greg0ire" created="Thu, 13 Dec 2012 13:12:52 +0000"  >&lt;p&gt;Duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-984&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-984&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10174" name="DC185TestCase.php" size="1952" author="fbrussa" created="Thu, 19 Nov 2009 12:15:52 +0000" />
                    <attachment id="10688" name="row_based_locking.patch" size="3262" author="branleb" created="Fri, 2 Jul 2010 10:49:03 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-188] Pager breaks when HAVING clause references existing table column</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-188</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Pager breaks when HAVING clause references any existing table column.&lt;/p&gt;

&lt;p&gt;Query used:&lt;/p&gt;

&lt;p&gt;        $q = Doctrine_Query::create()&lt;br/&gt;
             -&amp;gt;select(&quot;u.id, u.first_name, u.last_name, u.is_active&quot;)&lt;br/&gt;
             -&amp;gt;addSelect(&apos;COUNT(u.id) as rolecount&apos;)&lt;br/&gt;
             -&amp;gt;from(&apos;User u&apos;)&lt;br/&gt;
             -&amp;gt;leftJoin(&apos;u.Roles r&apos;)&lt;br/&gt;
             -&amp;gt;groupBy(&apos;u.id&apos;)&lt;br/&gt;
             -&amp;gt;having(&quot;rolecount &amp;gt; 2 and u.is_active = 1&quot;);&lt;/p&gt;

&lt;p&gt;Execution of query by itself works fine (eg via execute(), fetch...)&lt;/p&gt;

&lt;p&gt;When putting this query in a Doctrine_Pager, error outputs:&lt;/p&gt;

&lt;p&gt;        $pager = new Doctrine_Pager(&lt;br/&gt;
              $q,&lt;br/&gt;
              $currentPage, &lt;br/&gt;
              $resultsPerPage &lt;br/&gt;
        );&lt;/p&gt;

&lt;p&gt;        $pager-&amp;gt;execute();&lt;/p&gt;


&lt;p&gt;Error Received:&lt;br/&gt;
SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S22&amp;#93;&lt;/span&gt;: Column not found: 1054 Unknown column &apos;u.is_active&apos; in &apos;having clause&apos;&lt;/p&gt;</description>
                <environment>Local: Windows/Cygwin/XAMPP&lt;br/&gt;
Stage &amp;amp; Prod:  CentOS&lt;br/&gt;
Apache / MySQL&lt;br/&gt;
Framework:  Zend&lt;br/&gt;
</environment>
            <key id="10340">DC-188</key>
            <summary>Pager breaks when HAVING clause references existing table column</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="benbac">Benedict Bacayon</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Nov 2009 21:50:18 +0000</created>
                <updated>Tue, 20 Jul 2010 01:14:31 +0000</updated>
                                    <version>1.1.5</version>
                                                <component>Pager</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13615" author="ryan" created="Tue, 20 Jul 2010 01:12:54 +0000"  >&lt;p&gt;a quick fix for this is to enclose the field in parentheses when selecting it, then use an alias to reference it inside the having clause. eg &lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;select(&quot;u.id, u.first_name, u.last_name, (u.is_active) u_is_active&quot;)&lt;br/&gt;
-&amp;gt;addSelect(&apos;COUNT(u.id) as rolecount&apos;)&lt;br/&gt;
-&amp;gt;from(&apos;User u&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;u.Roles r&apos;)&lt;br/&gt;
-&amp;gt;groupBy(&apos;u.id&apos;)&lt;br/&gt;
-&amp;gt;having(&quot;rolecount &amp;gt; 2 and u_is_active = 1&quot;);&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </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-278] Invalid qubquery generated if using oracle adapter instead of pdo_oci</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-278</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine generates the following invalid subquery if oracle adapter is used (same query is generated corret if pdo_oci is used):&lt;/p&gt;

&lt;p&gt;SELECT DISTINCT &quot;s2&quot;.&quot;code&quot; &lt;br/&gt;
FROM &quot;spend_category&quot; &quot;s2&quot; &lt;br/&gt;
INNER JOIN &quot;company_spend_category&quot; &quot;c4&quot; ON (&quot;s2&quot;.&quot;code&quot; = &quot;c4&quot;.&quot;spendcategory_code&quot;) &lt;br/&gt;
INNER JOIN &quot;company&quot; &quot;c3&quot; ON &quot;c3&quot;.&quot;code&quot; = &quot;c4&quot;.&quot;company_code&quot; &lt;br/&gt;
WHERE &quot;s2&quot;.&quot;code&quot; = &apos;19000000&apos; &lt;br/&gt;
AND &quot;c3&quot;.&quot;is_deleted&quot; IS NOT NULL &lt;br/&gt;
AND &quot;s2&quot;.&quot;is_deleted&quot; IS NOT NULL &lt;br/&gt;
ORDER BY &quot;c3&quot;.&quot;name&quot; desc&lt;/p&gt;

&lt;p&gt;The problem is that the order by column is not part of the selected columns.&lt;/p&gt;

&lt;p&gt;Sample dql statement to reproduce this error:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;pageAllPager = new Doctrine_Pager(&lt;br/&gt;
        $q = Doctrine_Query::create()&lt;br/&gt;
                -&amp;gt;select(&apos;c.code, c.name, c.is_activated, c.is_deleted, sc.code&apos;)&lt;br/&gt;
                -&amp;gt;from(&apos;SpendCategory sc&apos;)&lt;br/&gt;
                -&amp;gt;innerJoin(&apos;sc.Companies c&apos;)&lt;br/&gt;
                -&amp;gt;where(&quot;sc.code = &apos;$spendcategory&apos;&quot;)&lt;br/&gt;
                -&amp;gt;addWhere(&apos;c.is_deleted IS NOT NULL&apos;)&lt;br/&gt;
                -&amp;gt;addWhere(&apos;sc.is_deleted IS NOT NULL&apos;)&lt;br/&gt;
                -&amp;gt;orderBy($orderBy)&lt;br/&gt;
                -&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY),&lt;br/&gt;
                $page,&lt;br/&gt;
                $resultsPerPage);&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10491">DC-278</key>
            <summary>Invalid qubquery generated if using oracle adapter instead of pdo_oci</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Mon, 23 Nov 2009 18:03:28 +0000</created>
                <updated>Wed, 9 Jun 2010 13:02:31 +0000</updated>
                                                    <fixVersion>1.2.0</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10827" author="jwage" created="Mon, 23 Nov 2009 23:37:04 +0000"  >&lt;p&gt;I believe this is fixed now in the latest Doctrine 1.2. Can you test and confirm?&lt;/p&gt;</comment>
                    <comment id="10855" author="tom808" created="Tue, 24 Nov 2009 21:51:23 +0000"  >&lt;p&gt;It is not fixed with 1.2 RC1&lt;/p&gt;

&lt;p&gt;Same sql wich work fine with pdo_oci generates an error using the oracle adapter&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&lt;br/&gt;
    &amp;lt;b&amp;gt;Message:&amp;lt;/b&amp;gt; ORA-01791: Kein mit SELECT ausgew&#228;hlter Ausdruck : SELECT s.code AS s_&lt;em&gt;code, c.code AS c&lt;/em&gt;&lt;em&gt;code, c.name AS c&lt;/em&gt;&lt;em&gt;name, c.is_activated AS c&lt;/em&gt;&lt;em&gt;is_activated, c.is_deleted AS c&lt;/em&gt;_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = &apos;37000000&apos; AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM &amp;lt;= 10) AND (s.code = &apos;37000000&apos; AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc. &lt;/p&gt;

&lt;p&gt;Failing Query: &quot;SELECT s.code AS s_&lt;em&gt;code, c.code AS c&lt;/em&gt;&lt;em&gt;code, c.name AS c&lt;/em&gt;&lt;em&gt;name, c.is_activated AS c&lt;/em&gt;&lt;em&gt;is_activated, c.is_deleted AS c&lt;/em&gt;_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = &apos;37000000&apos; AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM &amp;lt;= 10) AND (s.code = &apos;37000000&apos; AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc&quot;&amp;lt;/p&amp;gt;&lt;/p&gt;</comment>
                    <comment id="10856" author="jwage" created="Tue, 24 Nov 2009 21:53:02 +0000"  >&lt;p&gt;I can&apos;t reproduce the issue in a test case. Can you help me with that? When I test what you&apos;re describing I get the results that are expected.&lt;/p&gt;</comment>
                    <comment id="10862" author="tom808" created="Wed, 25 Nov 2009 09:39:55 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;if i undestand the last comment correctly this issue will be fixed in 1.2 RC2.&lt;/p&gt;

&lt;p&gt;I have reviewed lots of existing test cases but did not find an example where pdo_oci or oracle adapter is used.&lt;/p&gt;

&lt;p&gt;Can you please forward the test case you have created for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-278&quot; title=&quot;Invalid qubquery generated if using oracle adapter instead of pdo_oci&quot;&gt;DC-278&lt;/a&gt; to me? I will  use this as a template for any further issues and hopefuly reduce your efforts.&lt;/p&gt;

&lt;p&gt;Kind regards&lt;br/&gt;
Tom&lt;/p&gt;

&lt;p&gt;&amp;gt; Jonathan H. Wage updated &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-278&quot; title=&quot;Invalid qubquery generated if using oracle adapter instead of pdo_oci&quot;&gt;DC-278&lt;/a&gt;:&lt;br/&gt;
&amp;gt; --------------------------------&lt;br/&gt;
&amp;gt;&lt;br/&gt;
&amp;gt;    Fix Version/s: 1.2.0-RC2&lt;br/&gt;
&amp;gt;                       (was: 1.2.0-RC1)&lt;/p&gt;

</comment>
                    <comment id="11160" author="tom808" created="Thu, 10 Dec 2009 14:50:55 +0000"  >&lt;p&gt;I do believe that I have found the reason and it is still an issue with Doctrine 1.2.1 &lt;/p&gt;

&lt;p&gt;Doctrine generate the following subquery which is processed in Doctrine_Query:: getLimitSubquery(). &lt;/p&gt;

&lt;p&gt;SELECT b.id FROM &lt;br/&gt;
	(&lt;br/&gt;
		SELECT a.*, ROWNUM AS doctrine_rownum FROM	&lt;br/&gt;
		(&lt;br/&gt;
			SELECT DISTINCT i.id, i.lft &lt;br/&gt;
			FROM item i &lt;br/&gt;
			INNER JOIN oum o ON i.oum_id = o.id AND (o.is_deleted IS NOT NULL) &lt;br/&gt;
			INNER JOIN item_type i2 ON i.type_id = i2.id AND (i2.is_deleted IS NOT NULL)&lt;br/&gt;
			INNER JOIN item_translation i3 ON i.id = i3.id &lt;br/&gt;
			LEFT JOIN attachment a ON i.id = a.item_id AND (a.is_deleted = 0) &lt;br/&gt;
			WHERE i.bundling_id = ? &lt;br/&gt;
			ORDER BY i.lft &lt;br/&gt;
		) a  &lt;br/&gt;
	) b &lt;br/&gt;
WHERE doctrine_rownum BETWEEN 3 AND 4&lt;/p&gt;


&lt;p&gt;This function replaces the table alias names. It looks like that the first occurance of &quot;a&quot; is detected and the inner alias for table attachment &quot;a&quot; is replaced by &quot;a2&quot; - that&apos;s fine. But also the outer table alias &quot;a&quot; is replaced by &quot;a2&quot; The result will be&lt;/p&gt;

&lt;p&gt;SELECT b.id FROM &lt;br/&gt;
	(&lt;br/&gt;
		SELECT a.*, ROWNUM AS doctrine_rownum FROM	&lt;br/&gt;
		(&lt;br/&gt;
			&lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt;&lt;br/&gt;
			LEFT JOIN attachment a2 ON i.id = a2.item_id AND (a2.is_deleted = 0) &lt;br/&gt;
			WHERE i.bundling_id = ? &lt;br/&gt;
			ORDER BY i.lft &lt;br/&gt;
		) a2 &#61663; !!!!!!  &lt;br/&gt;
	) b &lt;/p&gt;

&lt;p&gt;&#8222;a&quot; is selected but the alias has been changed to &#8222;a2&quot; and this will cause an sql error.&lt;/p&gt;

&lt;p&gt;It looks like that this bug will only raise if a table is used in the subquery which starts with an &quot;a&quot;&lt;/p&gt;</comment>
                    <comment id="11176" author="tom808" created="Fri, 11 Dec 2009 16:47:18 +0000"  >&lt;p&gt;As a workaround i have change &quot;a&quot; to &quot;x&quot; in the Doctrine_Connection_Oracle::_createLimitSubquery()&lt;/p&gt;

&lt;p&gt;As far as no table in our projekt starts with character &quot;x&quot; this works fine for me.&lt;/p&gt;

&lt;p&gt;By the way: Shouldn&apos;t it be $this-&amp;gt;quoteIdentifier(&apos;a&apos;) . &apos;.&lt;b&gt;&apos; instead of just a.&lt;/b&gt; ??&lt;/p&gt;

&lt;p&gt;original code:&lt;br/&gt;
                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM ( &apos;.&lt;br/&gt;
                                 &apos;SELECT a.*, ROWNUM AS doctrine_rownum FROM ( &apos;&lt;br/&gt;
                                   . $query . &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;a&apos;) . &apos; &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;

&lt;p&gt;modified code:&lt;br/&gt;
                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM ( &apos;.&lt;br/&gt;
                                 &apos;SELECT x.*, ROWNUM AS doctrine_rownum FROM ( &apos;&lt;br/&gt;
                                   . $query . &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;x&apos;) . &apos; &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;</comment>
                    <comment id="13195" author="jwage" created="Tue, 8 Jun 2010 15:01:45 +0000"  >&lt;p&gt;Can you provide the change that fixes the problem for you as a diff so we can test it?&lt;/p&gt;</comment>
                    <comment id="13244" author="tom808" created="Wed, 9 Jun 2010 03:37:49 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;long time with no hear from you. Hope you are well!&lt;/p&gt;

&lt;p&gt;I am sorry, we did not fix this bug really. As writte above we have just implemented a work around by choosing a different character (&quot;x&quot; instead of &quot;a&quot;) for the name of the generated sub query alias. This works fine with our data model (no table starts with &quot;x&quot;) but may cause the same error with other data models.&lt;/p&gt;

&lt;p&gt;At all: There was too much trouble in this project last year. Due to this we made the decision to go ahead with pdo_oci to finish the project in time.&lt;/p&gt;

&lt;p&gt;Kind regards&lt;br/&gt;
Thomas&lt;/p&gt;</comment>
                    <comment id="13254" author="jwage" created="Wed, 9 Jun 2010 13:02:31 +0000"  >&lt;p&gt;I&apos;ll leave this open if someone runs across the same problem, a test case showing the issue would help with pin pointing the problem area in the code.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-280] Add pre/postHydrateResultSet() events</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-280</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Over the last several weeks I&apos;ve been working on streamlining the access control logic in the application I&apos;m working on, and I realized that Doctrine&apos;s event listeners might be able to help.  For more detailed background information take a look at &lt;a href=&quot;http://groups.google.com:80/group/dallasphp/browse_thread/thread/91e3f107cd611adf&quot; class=&quot;external-link&quot;&gt;http://groups.google.com:80/group/dallasphp/browse_thread/thread/91e3f107cd611adf&lt;/a&gt; ...but here&apos;s the problem in a nutshell:&lt;/p&gt;

&lt;p&gt;Since my application&apos;s access control logic is all implemented in PHP rather than in the database (i.e., I can&apos;t add access control to my queries as a simple WHERE clause), I&apos;m looking for a way to hook into the query process just after the records have been hydrated and actually modify the result set that gets returned, such that only permissible records show up in the final result set.&lt;/p&gt;

&lt;p&gt;Unfortunately, although there are several listener methods that look promising for this, none of them seem to have access to the data being returned.  For instance, if I run a custom query via Doctrine_Query::execute(), the postQuery() hook definitely runs ...but it doesn&apos;t give me access to anything but the query string itself.&lt;/p&gt;

&lt;p&gt;Since, in some instances (e.g., hydration listeners), the Doctrine_Event object is assigned arbitrary data that the listener can modify, I&apos;m wondering if the same thing couldn&apos;t be done more universally?&lt;/p&gt;</description>
                <environment></environment>
            <key id="10495">DC-280</key>
            <summary>Add pre/postHydrateResultSet() events</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jazzslider">Adam Jensen</reporter>
                        <labels>
                    </labels>
                <created>Mon, 23 Nov 2009 23:38:02 +0000</created>
                <updated>Tue, 8 Jun 2010 16:09:38 +0000</updated>
                                                                    <component>Connection</component>
                <component>Query</component>
                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10829" author="jwage" created="Tue, 24 Nov 2009 00:01:06 +0000"  >&lt;p&gt;In Doctrine 1.2 you can create custom hydrators. You can extend the core hydrators to remove the data you want? I think that would work.&lt;/p&gt;</comment>
                    <comment id="10846" author="jazzslider" created="Tue, 24 Nov 2009 19:45:06 +0000"  >&lt;p&gt;Sure enough, that does the trick!&lt;/p&gt;

&lt;p&gt;There are a couple of downsides, though, that might be worth considering in terms of future development:&lt;/p&gt;

&lt;p&gt;1. It would be nice to be able to specify constructor arguments for the hydrator, so that collaborators can be injected.  In my example, the hydrator needs access to the application&apos;s access control list object; currently it&apos;s simply retrieving it from a global registry, but it would be nice for testing&apos;s sake to be able to inject it instead.&lt;br/&gt;
2. It would also be nice to be able to chain multiple hydrators together; that&apos;s one reason I was looking at listeners, since they&apos;ve got that capability already.  That approach allows you to keep distinct behavior distinct a lot more easily.&lt;/p&gt;

&lt;p&gt;Ultimately, I&apos;d still kind of like to see another listener method available ...say, preHydrateResultSet() and postHydrateResultSet()?  I think that would be a more flexible approach, even though the custom hydrator solution works quite well.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;br/&gt;
Adam&lt;/p&gt;</comment>
                    <comment id="10847" author="jwage" created="Tue, 24 Nov 2009 19:49:31 +0000"  >&lt;p&gt;I like the idea. I&apos;ll move this to 1.3. I don&apos;t think we&apos;re gonna have a 1.3 version but if we do, it&apos;ll be there.&lt;/p&gt;</comment>
                    <comment id="12211" author="jwage" created="Mon, 15 Mar 2010 14:22:57 +0000"  >&lt;p&gt;We can include this in a 1.2.x release if you would like to provide a patch and some tests. Thanks, Jon&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-287] Schema: package property for model</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-287</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;There is a property &quot;package&quot; for the schema.yml file.&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_0/en/yaml-schema-files#features-examples:packages&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_0/en/yaml-schema-files#features-examples:packages&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But this should be used only for plugin symfony.&lt;/p&gt;

&lt;p&gt;It will be good to have the same feature for classic model (not plugin), to be available to organize the model inside of the model folder.&lt;/p&gt;

&lt;p&gt;This feature is critical for huge project. Indeed having 200 files at the root of the folder model/doctrine is very difficult to maintain.&lt;/p&gt;
</description>
                <environment></environment>
            <key id="10503">DC-287</key>
            <summary>Schema: package property for model</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="titang">Mickael HOAREAU</reporter>
                        <labels>
                    </labels>
                <created>Wed, 25 Nov 2009 04:03:02 +0000</created>
                <updated>Tue, 8 Jun 2010 16:19:51 +0000</updated>
                                                                    <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11294" author="titang" created="Fri, 25 Dec 2009 03:05:58 +0000"  >&lt;p&gt;Here a possible patch for doctrine 1.2, it is working for the basic cases.&lt;/p&gt;

&lt;p&gt;It probably needs to be improved.&lt;/p&gt;</comment>
                    <comment id="12195" author="jwage" created="Mon, 15 Mar 2010 11:41:05 +0000"  >&lt;p&gt;I agree this is a problem, but your patch is not good. It doesn&apos;t follow the coding standards and has some formatting problems. Also, it doesn&apos;t seem like a good solution. What do you think?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10259" name="DC-287.patch" size="4117" author="titang" created="Fri, 25 Dec 2009 03:05:58 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-290] Relations need alias</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-290</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;While implementing a Record_Template and manipulating a query by using the preDqlSelect Event, i got massive problems if the query was generated by a refresh() or refreshRelated() call. I found out that the issue appears because the query has no alias for the table then. This makes it hard to add forther (sub-)selects to the query via preDqlSelect, e.g.&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;$params = $event-&amp;gt;getParams();
		$alias = $params[&apos;alias&apos;];

                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;(!$query-&amp;gt;isSubquery() &amp;amp;&amp;amp; $alias == $queryClone-&amp;gt;getRootAlias()) {	
				
				
				$countQuery = &apos;(SELECT COUNT(&apos;.$alias.&apos;_tcount.uid) FROM &apos;.$modelName.&apos; &apos;.$alias.&apos;_tcount WHERE &apos;.$alias.&apos;.&apos;.$groupId.&apos;=&apos;.$alias.&apos;_tcount.&apos;.$groupId.&apos;) AS &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_options[&apos;terminationCount&apos;];
				
				$query-&amp;gt;addSelect($countQuery);
			}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;



&lt;p&gt;The issue is solved by adding an alias in the foreignKey and localKey relation types&apos; fetchRelatedFor methods (at least that&apos;s sufficient for my issue, maybe there is a need to add similar lines to the other relation types).&lt;/p&gt;



&lt;p&gt;Doctrine_Relation_ForeignKey (from line 60):&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;$alias = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName().&apos;_rel&apos;;
            	
                $dql  = &apos;FROM &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName()
                      .&apos; &apos;.$alias. &apos; WHERE &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getCondition($alias) . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getOrderBy(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;



&lt;p&gt;Doctrine_Relation_LocalKey (from line 58):&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;$alias = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName().&apos;_rel&apos;;
        	
            $dql  = &apos;FROM &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName()
                 .&apos; &apos;.$alias. &apos; WHERE &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getCondition($alias) . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getOrderBy(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="10506">DC-290</key>
            <summary>Relations need alias</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jensen83">Christian Jaentsch</reporter>
                        <labels>
                    </labels>
                <created>Wed, 25 Nov 2009 13:24:48 +0000</created>
                <updated>Wed, 9 Jun 2010 16:08:24 +0000</updated>
                                    <version>1.2.0-RC1</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10921" author="jwage" created="Mon, 30 Nov 2009 17:45:00 +0000"  >&lt;p&gt;If no alias is explicitly defined, the alias is automatically set to the model name. So in your code change you changed it from &quot;ModelName&quot; to &quot;ModelName_rel&quot;. If you had the following:&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 * FROM User
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The alias would be &quot;User&quot; and it is the same as if you did:&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 * FROM User User
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="10938" author="jensen83" created="Tue, 1 Dec 2009 10:37:50 +0000"  >&lt;p&gt;unfortunately this does not solve my problem... i narrowed it down to be a problem with addPendingJoinCondition in such a case.&lt;/p&gt;

&lt;p&gt;here is a short scenario of what i want to do...&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;$modelName = &apos;Exhibition&apos;;
$alias = &lt;span class=&quot;code-quote&quot;&gt;&quot;exhibitionalias&quot;&lt;/span&gt;;
$subAlias = &apos;exhibitionsub&apos;;
		
$query = Doctrine_Query::create()
-&amp;gt;from($modelName.&apos; &apos;.$alias);
		
$subQuery .= &apos;SELECT &apos;.$subAlias.&apos;.id FROM &apos;.$modelName.&apos; &apos;.$subAlias.&apos; WHERE &apos;.$subAlias.&apos;.id = &apos;.$alias.&apos;.id&apos;;
$query-&amp;gt;addPendingJoinCondition($alias, $alias.&apos;.id IN (&apos;.$subQuery.&apos;)&apos;);
		
$query-&amp;gt;execute();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;this works so far as the alias is different from the model name... but if i change&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;$alias = &lt;span class=&quot;code-quote&quot;&gt;&quot;Exhibition&quot;&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;i get the exception&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;exception &apos;Doctrine_Exception&apos; with message &apos;Couldn&apos;t find class exhibitionsub&apos; in /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Table.php:299
Stack trace:
#0 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Table.php(249): Doctrine_Table-&amp;gt;initDefinition()
#1 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Connection.php(1126): Doctrine_Table-&amp;gt;__construct(&apos;exhibitionsub&apos;, &lt;span class=&quot;code-object&quot;&gt;Object&lt;/span&gt;(Doctrine_Connection_Mysql), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
#2 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1924): Doctrine_Connection-&amp;gt;getTable(&apos;exhibitionsub&apos;)
#3 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1722): Doctrine_Query-&amp;gt;loadRoot(&apos;exhibitionsub&apos;, &apos;exhibitionsub&apos;)
#4 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Where.php(76): Doctrine_Query-&amp;gt;load(&apos;exhibitionsub&apos;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
#5 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Condition.php(92): Doctrine_Query_Where-&amp;gt;load(&apos;exhibitionsub.i...&apos;)
#6 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition-&amp;gt;parse(&apos;exhibitionsub.i...&apos;)
#7 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1156): Doctrine_Query_Abstract-&amp;gt;_processDqlQueryPart(&apos;where&apos;, Array)
#8 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1122): Doctrine_Query-&amp;gt;buildSqlQuery(&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
#9 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(1137): Doctrine_Query-&amp;gt;getSqlQuery(Array, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
#10 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(1106): Doctrine_Query_Abstract-&amp;gt;_getDqlCallbackComponents(Array)
#11 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1143): Doctrine_Query_Abstract-&amp;gt;_preQuery()
#12 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1122): Doctrine_Query-&amp;gt;buildSqlQuery(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
#13 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/JoinCondition.php(87): Doctrine_Query-&amp;gt;getSqlQuery()
#14 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Condition.php(92): Doctrine_Query_JoinCondition-&amp;gt;load(&apos;Exhibition.id I...&apos;)
#15 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1089): Doctrine_Query_Condition-&amp;gt;parse(&apos;Exhibition.id I...&apos;)
#16 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1013): Doctrine_Query-&amp;gt;_processPendingJoinConditions(&apos;Exhibition&apos;)
#17 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1228): Doctrine_Query-&amp;gt;_buildSqlFromPart()
#18 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query.php(1122): Doctrine_Query-&amp;gt;buildSqlQuery(&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
#19 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(1137): Doctrine_Query-&amp;gt;getSqlQuery(Array, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
#20 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(1106): Doctrine_Query_Abstract-&amp;gt;_getDqlCallbackComponents(Array)
#21 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/core/lib/Doctrine/Doctrine/Query/Abstract.php(1001): Doctrine_Query_Abstract-&amp;gt;_preQuery(Array)
#22 /&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;/www/erh_eeecore/app/modules/&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;/controllers/ExhibitionsController.php(75): Doctrine_Query_Abstract-&amp;gt;execute()
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="11057" author="jwage" created="Mon, 7 Dec 2009 19:50:11 +0000"  >&lt;p&gt;Hmm. Christian, your issue doesn&apos;t seem at all related to the original issue. It seems like an entirely different problem, no?&lt;/p&gt;</comment>
                    <comment id="11081" author="jensen83" created="Tue, 8 Dec 2009 13:38:21 +0000"  >&lt;p&gt;Well, I don&apos;t know where the reason for the problem is exactly... I just solved my problem by adding an alias to the foreignKey and localKey relations. The actual problem seems to be located in how the query is processed if the alias is equal to the name of the &quot;from&quot;-model. this causes problems while adding pending join conditions.&lt;/p&gt;</comment>
                    <comment id="11098" author="jwage" created="Tue, 8 Dec 2009 18:04:42 +0000"  >&lt;p&gt;Ok, well what you described is totally un-related to this issue. If you have found a bug you can open another ticket with detailed information and a failing test case. Thanks, Jon&lt;/p&gt;</comment>
                    <comment id="13197" author="jwage" created="Tue, 8 Jun 2010 15:07:07 +0000"  >&lt;p&gt;Can you show a patch with your changes?&lt;/p&gt;</comment>
                    <comment id="13260" author="jensen83" created="Wed, 9 Jun 2010 16:08:24 +0000"  >&lt;p&gt;My patch is as shown in the description of this issue:&lt;/p&gt;

&lt;p&gt;Doctrine_Relation_ForeignKey (from line 60):&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;$alias = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName().&apos;_rel&apos;;
            	
                $dql  = &apos;FROM &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName()
                      .&apos; &apos;.$alias. &apos; WHERE &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getCondition($alias) . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getOrderBy(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;



&lt;p&gt;Doctrine_Relation_LocalKey (from line 58):&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;$alias = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName().&apos;_rel&apos;;
        	
            $dql  = &apos;FROM &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getTable()-&amp;gt;getComponentName()
                 .&apos; &apos;.$alias. &apos; WHERE &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getCondition($alias) . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getOrderBy(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-292] no migrations diff on template change</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-292</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;the generate-migrations-diff does not create migrations if the template changes fields on the model.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;File:&lt;br/&gt;
  tableName: files&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Eeecore_Record_File&lt;br/&gt;
  actAs:&lt;br/&gt;
    Fileable:&lt;/p&gt;


&lt;p&gt;The Fileable Template does the following... (the &quot;fileFields&quot; option stores a couple of fields to add to the model)&lt;/p&gt;

&lt;p&gt;public function setTableDefinition()&lt;br/&gt;
	{&lt;/p&gt;

&lt;p&gt;			foreach ($this-&amp;gt;_options&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;fileFields&amp;#39;&amp;#93;&lt;/span&gt; as $key =&amp;gt; $field)&lt;/p&gt;
{
				$this-&amp;gt;hasColumn($field[&apos;name&apos;], $field[&apos;type&apos;], $field[&apos;length&apos;], $field[&apos;options&apos;]);
                         }
&lt;p&gt;}&lt;/p&gt;


&lt;p&gt;everything works fine on generate-migrations-models (the initial migrations)... but if we change something on the &quot;fileFields&quot; the generate-migrations-diff call doesn&apos;t do anything. We have to rebuild all migrations or write a new migration by hand.&lt;/p&gt;

</description>
                <environment></environment>
            <key id="10508">DC-292</key>
            <summary>no migrations diff on template change</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jensen83">Christian Jaentsch</reporter>
                        <labels>
                    </labels>
                <created>Wed, 25 Nov 2009 13:45:09 +0000</created>
                <updated>Mon, 1 Mar 2010 19:44:09 +0000</updated>
                                    <version>1.2.0-RC1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11061" author="jwage" created="Mon, 7 Dec 2009 19:59:56 +0000"  >&lt;p&gt;I added coverage for this issue and it is working as expected. I compare two schemas:&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;Article:
  columns:
    title: string(255)
    body: clob
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and I compare it to this one:&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;Article:
  actAs: [Timestampable]
  columns:
    title: string(255)
    body: clob
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now I do 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;        $migration = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Migration(dirname(__FILE__) . &apos;/DC292/migrations&apos;);
        $diff = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Migration_Diff(dirname(__FILE__) . &apos;/DC292/from.yml&apos;, dirname(__FILE__) . &apos;/DC292/to.yml&apos;, $migration);
        $changes = $diff-&amp;gt;generateChanges();
        print_r($changes);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It has this in the array:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    [created_columns] =&amp;gt; Array
        (
            [article] =&amp;gt; Array
                (
                    [created_at] =&amp;gt; Array
                        (
                            [notnull] =&amp;gt; 1
                            [type] =&amp;gt; timestamp
                            [length] =&amp;gt; 25
                        )

                    [updated_at] =&amp;gt; Array
                        (
                            [notnull] =&amp;gt; 1
                            [type] =&amp;gt; timestamp
                            [length] =&amp;gt; 25
                        )

                )

        )

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="11082" author="jensen83" created="Tue, 8 Dec 2009 13:42:45 +0000"  >&lt;p&gt;The problem does not occur if you compare 2 schemas while one has a certain template and the other not.&lt;/p&gt;

&lt;p&gt;In my case the problem occurs when the 2 schemas both already have the same template definition but in one case the template itself has changed (e.g. injects one more field into the database table of a certain model via setTableDefinition).&lt;/p&gt;</comment>
                    <comment id="11097" author="jwage" created="Tue, 8 Dec 2009 18:03:35 +0000"  >&lt;p&gt;When I test that it works as well. Can you show some kind of reproducible test case?&lt;/p&gt;</comment>
                    <comment id="11930" author="jwage" created="Mon, 1 Mar 2010 19:44:09 +0000"  >&lt;p&gt;Maybe you could add a test case for this?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-293] Implement a self-reference class mechanism without the usage of associative classes</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-293</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Equals to summary&lt;/p&gt;</description>
                <environment>Ubuntu 9.10, Eclipse</environment>
            <key id="10511">DC-293</key>
            <summary>Implement a self-reference class mechanism without the usage of associative classes</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ruigoncalves">Rui Miguel Gon&#231;alves</reporter>
                        <labels>
                    </labels>
                <created>Wed, 25 Nov 2009 17:59:51 +0000</created>
                <updated>Wed, 25 Nov 2009 17:59:51 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-312] Doctrine_Pager query &quot;influences&quot; Doctrine::getTable() query</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-312</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When I use the same procedure without Doctrine_Pager everything works fine, with Doctrine_Pager the behavior of later queries is strange. Example:&lt;br/&gt;
----------------WORKING:&lt;br/&gt;
1. I fetch list &lt;br/&gt;
Doctrine_Query::create()&lt;del&gt;&amp;gt;select(&apos;z.&lt;b&gt;,s.&lt;/b&gt;,o.*,u.jmeno as Vlo&#382;il,k.nazev_cs as Kategorie&apos;)&lt;/del&gt;&amp;gt;from(&apos;ShopZbozi z,z.Obrazek o,z.Soubor s,z.Uzivatel u,z.ShopKategorie k&apos;)&lt;del&gt;&amp;gt;orderby(&apos;z.nazev_cs ASC&apos;)&lt;/del&gt;&amp;gt;fetchArray(); &lt;/p&gt;

&lt;p&gt;2. I fetch a row to edit independently on the list above&lt;br/&gt;
$object = Doctrine::getTable(&apos;ShopZbozi&apos;)-&amp;gt;find(123);&lt;/p&gt;

&lt;p&gt;3. edit properties of the object...&lt;/p&gt;

&lt;p&gt;4. $object-&amp;gt;replace();&lt;br/&gt;
the object is fetched with no related objects like &lt;span class=&quot;error&quot;&gt;&amp;#91;Uzivatel&amp;#93;&lt;/span&gt; or &lt;span class=&quot;error&quot;&gt;&amp;#91;Soubor&amp;#93;&lt;/span&gt;, so when I change for example $object-&amp;gt;iduzivatel (related Uzivatel object id) and save it is OK&lt;/p&gt;

&lt;p&gt;----------------BROKEN:&lt;br/&gt;
1. I fetch list in Pager&lt;br/&gt;
new Doctrine_Pager(Doctrine_Query::create()&lt;del&gt;&amp;gt;select(&apos;z.&lt;b&gt;,s.&lt;/b&gt;,o.*,u.jmeno as Vlo&#382;il,k.nazev_cs as Kategorie&apos;)&lt;/del&gt;&amp;gt;from(&apos;ShopZbozi z,z.Obrazek o,z.Soubor s,z.Uzivatel u,z.ShopKategorie k&apos;)&lt;del&gt;&amp;gt;orderby(&apos;z.nazev_cs ASC&apos;),$this&lt;/del&gt;&amp;gt;page,$this-&amp;gt;perpage);&lt;/p&gt;

&lt;p&gt;2. I fetch a row to edit independently on the list above    (in contrast to the first working example this $object is fetched with EMPTY RELATION OBJECTS, which causes inserting empty new rows when calling -&amp;gt;replace())&lt;br/&gt;
$object = Doctrine::getTable(&apos;ShopZbozi&apos;)-&amp;gt;find(123);&lt;/p&gt;

&lt;p&gt;3. edit properties of the object...&lt;/p&gt;

&lt;p&gt;4. $object-&amp;gt;replace(); &lt;br/&gt;
-&amp;gt; the $object has all the related object fetched as it was defined in the list in Pager - like it was used as a template for getTable and when -&amp;gt;replace() - new empty related objects are inserted in DB.&lt;/p&gt;


&lt;p&gt;I&apos;ve been using Doctrine for I guess 2 years now and I believe this bug/strange behavior has always been there.&lt;br/&gt;
Maybe I&apos;m wrong and it is not a bug, but the behavior is strange and it took me really long to find where the problem is and I still don&apos;t know how to use pager without influencing the later queries.&lt;br/&gt;
Thanx John Mathew&lt;/p&gt;</description>
                <environment>Debian testing squeeze 32 bit.</environment>
            <key id="10544">DC-312</key>
            <summary>Doctrine_Pager query &quot;influences&quot; Doctrine::getTable() 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="seiffs">Jan Matousek</reporter>
                        <labels>
                    </labels>
                <created>Wed, 2 Dec 2009 10:19:08 +0000</created>
                <updated>Wed, 2 Dec 2009 10:20:19 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Pager</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-321] Doctrine/Import/Mssql.php does not handle default values</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-321</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If I generate models from sql server I notice that the default values are empty although some columns in the database do have default values.&lt;/p&gt;

&lt;p&gt;I did &apos;EXEC sp_columns @table_name = &apos;page&apos;;&apos; in sql server and I could clearly see default values in &apos;column_def&apos; so somehow the default values get lost.&lt;/p&gt;
</description>
                <environment>using odbc connection to sql server. (SQL Native Client)</environment>
            <key id="10558">DC-321</key>
            <summary>Doctrine/Import/Mssql.php does not handle default values</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="aiso">aiso haikens</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Dec 2009 16:09:00 +0000</created>
                <updated>Thu, 3 Dec 2009 20:16:02 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-322] Data dump fails on tables with quoted identifiers</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-322</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;While dumping a table with a quoted identifier `numeric`, doctrine failed because the constructed query had an invalid alias the field:  c__`numeric`.&lt;/p&gt;

&lt;p&gt;Output:&lt;br/&gt;
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;`numeric`, c.alpha3 AS c_&lt;em&gt;alpha3, c.alpha2 AS c&lt;/em&gt;&lt;em&gt;alpha2 FROM country_codes c&apos; at line 1. Failing Query: &quot;SELECT c.country AS c&lt;/em&gt;&lt;em&gt;country, c.`numeric` AS c&lt;/em&gt;&lt;em&gt;`numeric`, c.alpha3 AS c&lt;/em&gt;&lt;em&gt;alpha3, c.alpha2 AS c&lt;/em&gt;_alpha2 FROM country_codes c&quot;&lt;/p&gt;

&lt;p&gt;I know that using quoted identifiers is discouraged but I think this could be easily solvable.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</description>
                <environment>linux, apache 2, mysql 5.1, php 5.2</environment>
            <key id="10559">DC-322</key>
            <summary>Data dump fails on tables with quoted identifiers</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mtorromeo">Massimiliano Torromeo</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Dec 2009 16:18:33 +0000</created>
                <updated>Fri, 4 Dec 2009 17:03:56 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Data Fixtures</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="10998" author="juokaz" created="Thu, 3 Dec 2009 21:24:13 +0000"  >&lt;p&gt;In which code part are you quoting that column? Because just enabling identifiers quoting would result in completely different results (at least there will be all columns quotes or none).&lt;/p&gt;</comment>
                    <comment id="11003" author="mtorromeo" created="Fri, 4 Dec 2009 08:58:44 +0000"  >&lt;p&gt;I&apos;m not using Doctrine::ATTR_QUOTE_IDENTIFIER, I generated a yaml from a preexisting db and then adapted it.&lt;/p&gt;

&lt;p&gt;It generated the following definition:&lt;br/&gt;
CountryCodes:&lt;br/&gt;
  columns:&lt;br/&gt;
    country:&lt;br/&gt;
      type: string(32)&lt;br/&gt;
      notnull: true&lt;br/&gt;
    `numeric`:&lt;br/&gt;
      type: integer(2)&lt;br/&gt;
      unsigned: 1&lt;br/&gt;
      primary: true&lt;br/&gt;
    alpha3:&lt;br/&gt;
      type: string(3)&lt;br/&gt;
      fixed: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    alpha2:&lt;br/&gt;
      type: string(2)&lt;br/&gt;
      fixed: true&lt;br/&gt;
      notnull: true&lt;/p&gt;

&lt;p&gt;but it was with an old version of Doctrine and this is not the case anymore (I tried regenerating it). I assumed it was correct to quote one single identifier, but I now guess it wasn&apos;t.&lt;/p&gt;

&lt;p&gt;I think this can be closed as NotBug.&lt;/p&gt;

&lt;p&gt;Sorry for the trouble.&lt;br/&gt;
Regards.&lt;/p&gt;</comment>
                    <comment id="11011" author="juokaz" created="Fri, 4 Dec 2009 17:03:56 +0000"  >&lt;p&gt;However, variables cannot be quoted like that - quoting happens after actual columns are constructed, so now Doctrine needs to unquote it and do it&apos;s stuff. If you want quoting - enable that option and it will do it for you, or the best - don&apos;t use reserved words in your schema &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.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;

&lt;p&gt;This issue can be closed as Invalid.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-325] doctrine  pager  class  with   sql server  stored procedure</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-325</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;i am using doctrine pager  class  for pagination in symfony   but not able to find any help  how i can i use   it&lt;/p&gt;

&lt;p&gt;i am using sql server  stored  procedures for  fetching databasae .&lt;/p&gt;

&lt;p&gt;Thnaks&lt;/p&gt;

&lt;p&gt;Khurram &lt;/p&gt;</description>
                <environment>php 5.3.0  sql server 2000  symfony 1.2.9</environment>
            <key id="10562">DC-325</key>
            <summary>doctrine  pager  class  with   sql server  stored procedure</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="alityagi2008@gmail.com">khurram Ali</reporter>
                        <labels>
                    </labels>
                <created>Fri, 4 Dec 2009 04:46:11 +0000</created>
                <updated>Fri, 4 Dec 2009 04:46:11 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-326] Running out of memory while executing single record lookup.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-326</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have the model class as follows:&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;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;options:
  collate: utf8_unicode_ci
  charset: utf8
  type: INNODB
Identity:
  tableName: Identity
  columns:
    id:
      type: integer(4)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      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;
    username:
      type: string(50)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    email:
      type: string(50)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    password:
      type: string(100)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    created_at:
      name: created_at
      type: timestamp
      # &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;: CURRENT_TIMESTAMP
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    updated_at:
      name: updated_at
      type: timestamp
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;: &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
  relations:
    Roles:
      class: Role
      local: id
      foreign: ident_id
      type: many
    Token:
      local: id
      foreign: entity_id
      type: many
    Devices:
      class: Device
      local: id
      foreign: account_id
      type: many
    Rides:
      class: Ride
      local: id
      foreign: account_id
      type: many
    OwnGroups:
      class: CoachGroup
      local: id
      foreign: owner_id
      type: many
    GroupMemberships:
      class: GroupMembership
      local: id
      foreign: ident_id
      type: many
  actAs:
    Timestampable:
      created:
        name: created_at
        type: timestamp
        expression: NOW()
      update:
        onInsert: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
Role:
  tableName: Role
  columns:
    identId:
      name: ident_id
      type: integer(4)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    role:
      type: string(50)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
  relations:
    Identity:
      onDelete: CASCADE
      onUpdate: CASCADE
      local: ident_id
      foreign: id
      foreignAlias: Roles
Token:
  tableName: Token
  columns:
    entity_id:
      name: entity_id
      type: integer(4)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    token:
      name: token
      type: string(50)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;: &apos;&apos;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    type:
      type: &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt;(50)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      values:
        - EMAIL_VERIFICATION
        - PASS_RESET
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;: EMAIL_VERIFICATION
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    created_at:
      type: timestamp(25)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
    expires_at:
      type: timestamp(25)
      fixed: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      primary: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
  indexes:
    entity:
      fields: [entity_id]
  relations:
    Identity:
      onDelete: CASCADE
      onUpdate: CASCADE
      local: entity_id
      foreign: id
      type: one
  actAs:
    Timestampable:
      created:
        name: created_at
        type: timestamp
      updated:
        disabled: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and my unit test for the model:&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;TokenModelTest.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$t = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; lime_test(3);
$t-&amp;gt;diag(&lt;span class=&quot;code-quote&quot;&gt;&quot;=== Token model test ===&quot;&lt;/span&gt;);

$t-&amp;gt;info(&apos;Token creation =&amp;gt;&apos;);
$token = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Token();
$token-&amp;gt;setEntityId(1);
$token-&amp;gt;generateUniqueToken();

$t-&amp;gt;info(&apos;Set valid token type...&apos;);
$token-&amp;gt;setType(Token::TYPE_EMAIL_VERIFICATION);
&lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt;{
  $t-&amp;gt;info(&apos;Saving the token...&apos;);
  $token-&amp;gt;save();
  $t-&amp;gt;pass(&apos;Token was saved successfully...&apos;);
}
&lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt;(Exception $e){
  $t-&amp;gt;is(($e &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Exception), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, $e-&amp;gt;getMessage());
}

$t-&amp;gt;isnt($token-&amp;gt;getCreatedAt(), &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &apos; Creation datetime is set to &apos;.$token-&amp;gt;getCreatedAt().&apos;...&apos;);

$t-&amp;gt;info(&apos;Get &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; token from DB...&apos;);
$tokenFromDb = Doctrine::getTable(&apos;Token&apos;)-&amp;gt;findOneByToken($token-&amp;gt;getToken());

$t-&amp;gt;info(&apos;Compare the two...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getEntityId(), $token-&amp;gt;getEntityId(), &apos;Entity ID...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getToken(), $token-&amp;gt;getToken(), &apos;Token string...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getType(), $token-&amp;gt;getType(), &apos;Token string...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getCreatedAt(), $token-&amp;gt;getCreatedAt(), &apos;Token creation date...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getExpiresAt(), $token-&amp;gt;getExpiresAt(), &apos;Token expration date...&apos;);
$t-&amp;gt;is($tokenFromDb-&amp;gt;getExpiresAt(), &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, &apos;Token expration date is &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;...&apos;);

$t-&amp;gt;info(&apos;Delete token...&apos;);
$t-&amp;gt;is($token-&amp;gt;delete(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, &apos;Successful deletion...&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On test execution on this line:&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;$tokenFromDb = Doctrine::getTable(&apos;Token&apos;)-&amp;gt;findOneByToken($token-&amp;gt;getToken());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;m getting a fatal error:&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;ERROR&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;# === Token model test ===
&amp;gt; Token creation =&amp;gt;
&amp;gt; Set valid token type...
&amp;gt; Saving the token...
ok 1 - Token was saved successfully...
ok 2 -  Creation datetime is set to 2009-12-04 01:13:31...
&amp;gt; Get &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; token from DB...
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 261900 bytes) in /ApacheWebServer/htdocs/Clients/enki/enkiweb/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 550

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 261900 bytes) in /ApacheWebServer/htdocs/Clients/enki/enkiweb/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 550
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Mac OS 10.5, Zend Server CE, PHP 5.3&lt;br/&gt;
Symfony 1.4</environment>
            <key id="10563">DC-326</key>
            <summary>Running out of memory while executing single record lookup.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="shurikag">Alex Agulyansky</reporter>
                        <labels>
                    </labels>
                <created>Fri, 4 Dec 2009 09:15:16 +0000</created>
                <updated>Mon, 7 Dec 2009 21:06:03 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11067" author="jwage" created="Mon, 7 Dec 2009 21:06:03 +0000"  >&lt;p&gt;Anymore information? Not much I can really do right now. If you have some more information to help I can look at the problem again. A Doctrine test case would be helpful.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-328] Multi-table query (left-join) problem in the Doctrine_Hydrator_Graph class</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-328</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I tried below code. It must be return 2 records, but It returned 1 record. I traced  Doctrine and found to reason in &lt;br/&gt;
Doctrine_Hydrator_Graph class line 165 ( $identifierMap&lt;span class=&quot;error&quot;&gt;&amp;#91;$rootAlias&amp;#93;&lt;/span&gt;[$id&lt;span class=&quot;error&quot;&gt;&amp;#91;$rootAlias&amp;#93;&lt;/span&gt;] = $this-&amp;gt;getLastKey($result); ) When couple $rootAlias not get record.&lt;/p&gt;

&lt;p&gt;I attached my data and code. Is it problem?!&lt;/p&gt;

&lt;p&gt;  77         $q = Doctrine_Query::create();&lt;br/&gt;
  78         $q-&amp;gt;select(&quot;r.post_id as id, p.title as title, p.slug as slug, p.created_on as created_on&quot;)-&amp;gt;&lt;br/&gt;
  79             from(&quot;Relations r&quot;)-&amp;gt;&lt;br/&gt;
  80                 leftJoin(&quot;r.Taxonomies t&quot;)-&amp;gt;&lt;br/&gt;
  81                 leftJoin(&quot;t.Marks m&quot;)-&amp;gt;&lt;br/&gt;
  82                 leftJoin(&quot;r.Posts p&quot;)-&amp;gt;&lt;br/&gt;
  83             where(&quot;m.slug = ?&quot;, $slug)-&amp;gt;&lt;br/&gt;
  84                 andWhere(&quot;m.status = ?&quot;, self::PUBLISH)-&amp;gt;&lt;br/&gt;
  85                 andWhere(&quot;p.status = ?&quot;, self::PUBLISH)-&amp;gt;&lt;br/&gt;
  86                 andWhere(&quot;t.status = ?&quot;, self::PUBLISH)-&amp;gt;&lt;br/&gt;
  87                 andWhere(&quot;t.type = ?&quot;, self::CATEGORY)-&amp;gt;&lt;br/&gt;
  88             orderBy(&quot;p.created_on desc&quot;);&lt;/p&gt;

</description>
                <environment>Ubuntu 9.10 Linux / PHP 5.2.x / Apache2 / Mysql 5</environment>
            <key id="10565">DC-328</key>
            <summary>Multi-table query (left-join) problem in the Doctrine_Hydrator_Graph class</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="meddah">Hasan Ozgan</reporter>
                        <labels>
                    </labels>
                <created>Fri, 4 Dec 2009 18:13:37 +0000</created>
                <updated>Fri, 4 Dec 2009 18:13:37 +0000</updated>
                                    <version>1.2.0</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10212" name="hasanozgan_com.sql" size="116050" author="meddah" created="Fri, 4 Dec 2009 18:13:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-329] Problem saving Self Referencing (Nest Relations)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-329</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;There is a problem when you save Many to Many Self Referencing (Nest Relations).&lt;/p&gt;

&lt;p&gt;I used the same example that it&apos;s used on Doctrine 1.2 Self Referencing (Nest Relations) Documentation:&lt;/p&gt;

&lt;p&gt;My Schema:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;User:&lt;br/&gt;
  columns:&lt;br/&gt;
    name: &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { type}&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;  relations:&lt;br/&gt;
    Parents:&lt;br/&gt;
      class: User&lt;br/&gt;
      local: child_id&lt;br/&gt;
      foreign: parent_id&lt;br/&gt;
      refClass: UserReference&lt;br/&gt;
      foreignAlias: Children&lt;/p&gt;

&lt;p&gt;UserReference:&lt;br/&gt;
  columns:&lt;br/&gt;
    parent_id:&lt;br/&gt;
      type: integer&lt;br/&gt;
      primary: true&lt;br/&gt;
    child_id:&lt;br/&gt;
      type: integer&lt;br/&gt;
      primary: true&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Fixtures:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;User:&lt;br/&gt;
  james:&lt;br/&gt;
    name: James&lt;br/&gt;
  alexander:&lt;br/&gt;
    name: Alexander&lt;br/&gt;
  david:&lt;br/&gt;
    name: David&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The problem happens with the Children. The first time I assigned children and saved the User, there is no problem; but when I saved the User again (without any change on him) the values in the UserReference? table changes: the &quot;parent_id&quot; takes the value of the &quot;child_id&quot;.&lt;/p&gt;

&lt;p&gt;I test it with Sf 1.4 and with Sf 1.3 stable versions, and I&apos;ve got the same error.&lt;/p&gt;

&lt;p&gt;If it not clear to understand what I&apos;m saying, I put a &quot;very ilustrative&quot; image about the form and how change the values of the UserReference? table. Please see it, because it would be very usefull for understanding (explains better than my terrible English)&lt;/p&gt;

&lt;p&gt;Thanks for all your work! &lt;/p&gt;

&lt;p&gt;P. D. &lt;/p&gt;

&lt;p&gt;I forgot to to say that watching the stack trace I think that the problem is in:&lt;/p&gt;

&lt;p&gt;symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php&lt;/p&gt;

&lt;p&gt;In the line 429:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;public function saveAssociations(Doctrine_Record $record)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I would like to help more, but I couldn&apos;t figure out how this function works.&lt;/p&gt;</description>
                <environment>Mac OSX 10.5, Symfony 1.4 and MAMP</environment>
            <key id="10566">DC-329</key>
            <summary>Problem saving Self Referencing (Nest Relations)</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jaimesuez">Jaime Suez</reporter>
                        <labels>
                    </labels>
                <created>Sat, 5 Dec 2009 17:48:37 +0000</created>
                <updated>Fri, 3 Jun 2011 13:14:55 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>14</votes>
                        <watches>14</watches>
                        <comments>
                    <comment id="11033" author="jaimesuez" created="Mon, 7 Dec 2009 00:38:52 +0000"  >&lt;p&gt;This picture explains the error that it&apos;s done when you do an insert and then you save it again.&lt;/p&gt;</comment>
                    <comment id="11048" author="jwage" created="Mon, 7 Dec 2009 17:59:04 +0000"  >&lt;p&gt;Can you provide a failing Doctrine test case? This may be a problem with Symfony and not Doctrine.&lt;/p&gt;</comment>
                    <comment id="11079" author="jaimesuez" created="Tue, 8 Dec 2009 12:55:47 +0000"  >&lt;p&gt;First I published this bug on Symfony, because I thought that was a problem with Symfony, but you set it as invalid because it&apos;s belong to Doctrine.&lt;/p&gt;

&lt;p&gt;This is the ticket on symfony: &lt;br/&gt;
&lt;a href=&quot;http://trac.symfony-project.org/ticket/7690&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/ticket/7690&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could do the Doctrine test case, but in one more mounth, because tomorrow I go out for vacations.&lt;br/&gt;
When I come back I&apos;ll do them.&lt;/p&gt;</comment>
                    <comment id="11244" author="psylosss" created="Sun, 20 Dec 2009 20:01:08 +0000"  >&lt;p&gt;Yes, I have got the same problem. During hours of debugging and exploring Doctrine&apos;s code, I found that problem localized in Hydrator component. I cannot digg deeper, so I ask you to fix it very much&lt;/p&gt;</comment>
                    <comment id="11296" author="p16" created="Sat, 26 Dec 2009 15:09:43 +0000"  >&lt;p&gt;Hi,&lt;br/&gt;
I had this problem in the 1.0 version of doctrine as well.&lt;br/&gt;
Using symfony, I upgraded to symfony 1.3 and doctrine 1.2 and I&apos;ve found the same problem.&lt;/p&gt;

&lt;p&gt;Attached to this comment you can find the files containing the schema I used (it is the same as that describe on this ticket but with a different class naming), and 2 unit tests. One using the symfony form  and one using directly the doctrine objects. They report the bug discussed on this ticket and show another bug saving objects that already have one ore more relations.&lt;/p&gt;

&lt;p&gt;As fixtures I used a fixtures.yml file containing: &lt;/p&gt;

&lt;p&gt;Issue:&lt;br/&gt;
&amp;lt;?php for ($i = 1; $i &amp;lt;= 30; $i++): ?&amp;gt;&lt;br/&gt;
  Issue_&amp;lt;?php echo $i; ?&amp;gt;:&lt;br/&gt;
    title: &quot;new issue &amp;lt;?php echo $i ?&amp;gt;&quot;&lt;br/&gt;
&amp;lt;?php endfor; ?&amp;gt;&lt;/p&gt;


&lt;p&gt;The following are the tests results:&lt;/p&gt;

&lt;p&gt;&amp;#8211; testEqualNestRelationsTest.php (using the forms) &amp;#8211; &lt;/p&gt;

&lt;p&gt;&amp;gt; First form for first issue: creation of the relation &quot;issue 1 -&amp;gt; issue 2&quot;&lt;br/&gt;
ok 1 - the edit form for issue 1 is valid&lt;br/&gt;
ok 2 - form1 saved&lt;br/&gt;
ok 3 - issue 1 is related with another issue&lt;br/&gt;
ok 4 - issue 1 is really related with issue 2&lt;/p&gt;

&lt;p&gt;&amp;gt; Second form for first issue: saving the relation between &quot;issue 1&quot; and &quot;issue 2&quot; from &quot;issue 2&quot;&apos;s form&lt;br/&gt;
ok 5 - the edit form for issue 2 is valid&lt;br/&gt;
ok 6 - form2 saved&lt;br/&gt;
not ok 7 - issue 2 is related with another issue  ******** this is the problem reported on this ticket ********&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testEqualNestRelationsTest.php at line 57)&lt;/li&gt;
	&lt;li&gt;got: 0&lt;/li&gt;
	&lt;li&gt;expected: 1&lt;br/&gt;
not ok 8 - issue 2 is really related with issue 1&lt;/li&gt;
	&lt;li&gt;Failed test (./test/unit/testEqualNestRelationsTest.php at line 58)&lt;/li&gt;
	&lt;li&gt;got: NULL&lt;/li&gt;
	&lt;li&gt;expected: 1&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;ok 9 - issue 1 is related with another issue&lt;br/&gt;
not ok 10 - issue 1 is really related with issue 2  ******** this is the problem reported on this ticket ********&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testEqualNestRelationsTest.php at line 63)&lt;/li&gt;
	&lt;li&gt;got: &apos;1&apos;&lt;/li&gt;
	&lt;li&gt;expected: 2&lt;br/&gt;
&amp;gt; Checking the relation table IssueReference ...&lt;br/&gt;
ok 11 - There is only one relation saved on IssueReference&lt;br/&gt;
ok 12 - 1 is the issue1 field of the relation&lt;br/&gt;
not ok 13 - 2 is the issue2 field of the relation ******** this is the problem reported on this ticket ********&lt;/li&gt;
	&lt;li&gt;Failed test (./test/unit/testEqualNestRelationsTest.php at line 71)&lt;/li&gt;
	&lt;li&gt;got: &apos;1&apos;&lt;/li&gt;
	&lt;li&gt;expected: &apos;2&apos;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&amp;gt; multi selection proof&lt;br/&gt;
ok 14 - the edit form for issue 1 is valid&lt;br/&gt;
ok 15 - form1 saved&lt;br/&gt;
ok 16 - the edit form for issue 2 is valid&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;
		&lt;ul&gt;
			&lt;li&gt;
			&lt;ul&gt;
				&lt;li&gt;
				&lt;ul&gt;
					&lt;li&gt;
					&lt;ul&gt;
						&lt;li&gt;
						&lt;ul&gt;
							&lt;li&gt;
							&lt;ul&gt;
								&lt;li&gt;this is the other bug I&apos;ve found ********&lt;br/&gt;
not ok 17 - form2 exception catched : SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;1-1&apos; for key 1&lt;/li&gt;
							&lt;/ul&gt;
							&lt;/li&gt;
						&lt;/ul&gt;
						&lt;/li&gt;
					&lt;/ul&gt;
					&lt;/li&gt;
				&lt;/ul&gt;
				&lt;/li&gt;
			&lt;/ul&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testEqualNestRelationsTest.php at line 114)&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&amp;#8211; testNestedEqualRelationWithObjectsTest.php (test using the &quot;doctrine&quot; objects ) &amp;#8211;&lt;/p&gt;

&lt;p&gt;&amp;gt; Saving relation directly from the objects and not using the forms...&lt;br/&gt;
ok 1 - issue1 saved&lt;br/&gt;
&amp;gt; checking issue1 relations&lt;br/&gt;
ok 2 - issue 1 is related with another issue&lt;br/&gt;
ok 3 - issue 1 is really related with issue 2&lt;/p&gt;

&lt;p&gt;&amp;gt; checking &quot;reverse&quot; relation on issue2&lt;br/&gt;
ok 4 - issue 2 is related with another issue&lt;br/&gt;
ok 5 - issue 2 is really related with issue 1&lt;/p&gt;

&lt;p&gt;&amp;gt; adding a relation issue2-&amp;gt;issue1 directly&lt;br/&gt;
ok 6 - issue2 saved&lt;/p&gt;

&lt;p&gt;&amp;gt; checking issue2 relations&lt;br/&gt;
not ok 7 - issue 2 is related with another issue  ******** this is the problem reported on this ticket ********&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testNestedEqualRelationWithObjectsTest.php at line 56)&lt;/li&gt;
	&lt;li&gt;got: 0&lt;/li&gt;
	&lt;li&gt;expected: 1&lt;br/&gt;
not ok 8 - issue 2 is really related with issue 1&lt;/li&gt;
	&lt;li&gt;Failed test (./test/unit/testNestedEqualRelationWithObjectsTest.php at line 57)&lt;/li&gt;
	&lt;li&gt;got: NULL&lt;/li&gt;
	&lt;li&gt;expected: 1&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&amp;gt; checking issue1 relations&lt;br/&gt;
ok 9 - issue 1 is related with another issue&lt;br/&gt;
not ok 10 - issue 1 is really related with issue 2  ******** this is the problem reported on this ticket ********&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testNestedEqualRelationWithObjectsTest.php at line 63)&lt;/li&gt;
	&lt;li&gt;got: &apos;1&apos;&lt;/li&gt;
	&lt;li&gt;expected: 2&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&amp;gt; Checking the relation table IssueReference ...&lt;br/&gt;
ok 11 - There is only one relation saved on IssueReference&lt;br/&gt;
ok 12 - 1 is the issue1 field of the relation&lt;br/&gt;
not ok 13 - 2 is the issue2 field of the relation&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testNestedEqualRelationWithObjectsTest.php at line 71)&lt;/li&gt;
	&lt;li&gt;got: &apos;1&apos;&lt;/li&gt;
	&lt;li&gt;expected: &apos;2&apos;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&amp;gt; object multi adding relation proof&lt;br/&gt;
ok 14 - issue1 saved&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;
		&lt;ul&gt;
			&lt;li&gt;
			&lt;ul&gt;
				&lt;li&gt;
				&lt;ul&gt;
					&lt;li&gt;
					&lt;ul&gt;
						&lt;li&gt;
						&lt;ul&gt;
							&lt;li&gt;
							&lt;ul&gt;
								&lt;li&gt;this is the other bug I&apos;ve found ********&lt;br/&gt;
not ok 15 - issue2 exception catched : SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;1-1&apos; for key 1&lt;/li&gt;
							&lt;/ul&gt;
							&lt;/li&gt;
						&lt;/ul&gt;
						&lt;/li&gt;
					&lt;/ul&gt;
					&lt;/li&gt;
				&lt;/ul&gt;
				&lt;/li&gt;
			&lt;/ul&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
	&lt;li&gt;Failed test (./test/unit/testNestedEqualRelationWithObjectsTest.php at line 112)&lt;/li&gt;
&lt;/ol&gt;


</comment>
                    <comment id="11370" author="jaimesuez" created="Wed, 13 Jan 2010 15:27:21 +0000"  >&lt;p&gt;With the test provided by Filippo De Santis is any other thing needed??&lt;/p&gt;

&lt;p&gt;I still on vacations untill 3 of febrary, so then I could do any other thing needed.&lt;/p&gt;
</comment>
                    <comment id="11571" author="jaimesuez" created="Mon, 1 Feb 2010 15:54:37 +0000"  >&lt;p&gt;The necessary test have to be how are illustrated in this link???&lt;/p&gt;

&lt;p&gt;&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="11648" author="bgm" created="Tue, 9 Feb 2010 22:35:23 +0000"  >&lt;p&gt;What has happen with this bug?? I also have the same problem...&lt;/p&gt;</comment>
                    <comment id="11968" author="jwage" created="Tue, 2 Mar 2010 12:43:43 +0000"  >&lt;p&gt;Hi, yes. We still need a unit test case like described here: &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;

&lt;p&gt;So we can run it with all the other tests and reproduce the issue in Doctrine by itself. Not in Symfony.&lt;/p&gt;

&lt;p&gt;Thanks, Jon&lt;/p&gt;</comment>
                    <comment id="11988" author="psylosss" created="Tue, 2 Mar 2010 15:13:30 +0000"  >&lt;p&gt;Jon, here is the test for this bug: &lt;a href=&quot;http://gist.github.com/319856&quot; class=&quot;external-link&quot;&gt;http://gist.github.com/319856&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please, fix it.. my work has been stopped cause of it&lt;/p&gt;</comment>
                    <comment id="12203" author="jaimesuez" created="Mon, 15 Mar 2010 13:12:55 +0000"  >&lt;p&gt;Yes... please fix it... I&apos;m also stuck in my work since a lot of time that the bug it&apos;s open.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="12212" author="lilawolf" created="Mon, 15 Mar 2010 14:24:37 +0000"  >&lt;p&gt;I&apos;m affected with this bug as well, fortunately, I found a way to get over it, it&apos;s ugly and innefficient, but at least my work isn&apos;t stopped due to this bug. I&apos;ll try to explain what I did commenting here later. Anyway, I really need this bug fixed too before I can start betatesting my app.&lt;br/&gt;
Thanks!&lt;/p&gt;

&lt;p&gt;P.D: I&apos;m using Doctrine 1.2.1.&lt;/p&gt;</comment>
                    <comment id="12215" author="jwage" created="Mon, 15 Mar 2010 14:35:09 +0000"  >&lt;p&gt;I am trying to understand the issue but it just doesn&apos;t make much sense to me yet. The test case is wrong because you are dealing with instances of objects that have previously loaded references, then you try and re-fetch the same object instance. If you do $user1-&amp;gt;free(true); then re-fetch the object the test passes as expected. So, I don&apos;t really have a proper failing test case still that actually exposes the problem. I&apos;ll keep playing around see if I can understand. let me know if anyone else has more information or a patch to test.&lt;/p&gt;

&lt;p&gt;Thanks, Jon&lt;/p&gt;</comment>
                    <comment id="12296" author="p16" created="Tue, 16 Mar 2010 17:22:33 +0000"  >&lt;p&gt;Hi Jonathan,&lt;br/&gt;
This is the &quot;translated&quot; version of my unit test for symfony in &quot;doctrine unit test&quot;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/ideato/phpcollab3/blob/phpcollabsf13/test/doctrine_unit_test/DC329TestCase.php&quot; class=&quot;external-link&quot;&gt;http://github.com/ideato/phpcollab3/blob/phpcollabsf13/test/doctrine_unit_test/DC329TestCase.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first test is to show the error &quot;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 19 columns issue1, issue2 are not unique&quot;.&lt;br/&gt;
The second one is to show the fact that the relation are saved with wrong data.&lt;/p&gt;

&lt;p&gt;Sorry for the late translation.&lt;/p&gt;

&lt;p&gt;Filippo &lt;/p&gt;</comment>
                    <comment id="12299" author="hckurniawan" created="Tue, 16 Mar 2010 21:55:53 +0000"  >&lt;p&gt;Hi Jonathan,&lt;/p&gt;

&lt;p&gt;It seems that the problem is caused by Doctrine_Collection::add() method line 456 (I could be totally wrong).&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;if&lt;/span&gt; (isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;referenceField)) {
    $value = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;reference-&amp;gt;get($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;relation-&amp;gt;getLocalFieldName());
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($value !== &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
        $record-&amp;gt;set($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;referenceField, $value, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
        $record-&amp;gt;set($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;referenceField, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;reference, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
    }
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What is trying to do is to set the reference field value to the reference value that it&apos;s linked to.&lt;/p&gt;

&lt;p&gt;This only happens when you try to fetch record from the &quot;children&quot;.&lt;/p&gt;

&lt;p&gt;Consider the following:&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;Employees:
  tableName: employees
  columns:
    id:
      type: integer(4)
      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;
    name:
      type: string(100)
  relations:
    managing:
      class: Employees
      type: many
      local: manager_id
      foreign: employee_id
      foreignAlias: managedBy
      refClass: EmployeeManager

EmployeeManager:
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;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;// ----- The following will not give you any issues
&lt;/span&gt;  $manager = Doctrine::getTable(&apos;Issue&apos;)-&amp;gt;findOneBy(&apos;id&apos;, &apos;1&apos;); &lt;span class=&quot;code-comment&quot;&gt;// This is a manager
&lt;/span&gt;  foreach ($manager-&amp;gt;managing as $employee) {
    ....
  }

  &lt;span class=&quot;code-comment&quot;&gt;// This will not save anything
&lt;/span&gt;  $manager-&amp;gt;save();
&lt;span class=&quot;code-comment&quot;&gt;// -----
&lt;/span&gt;
&lt;span class=&quot;code-comment&quot;&gt;// ----- The following will
&lt;/span&gt;  $employee = Doctrine::getTable(&apos;Issue&apos;)-&amp;gt;findOneBy(&apos;id&apos;, &apos;2&apos;); &lt;span class=&quot;code-comment&quot;&gt;// This is an employee
&lt;/span&gt;  foreach ($employee-&amp;gt;managedBy as $manager) {
    ...
  }

  &lt;span class=&quot;code-comment&quot;&gt;// This will save the wrong data to the &lt;span class=&quot;code-quote&quot;&gt;&quot;EmployeeManager&quot;&lt;/span&gt; table
&lt;/span&gt;  &lt;span class=&quot;code-comment&quot;&gt;// because the code from Doctrine_Collection is overwriting &lt;span class=&quot;code-quote&quot;&gt;&quot;EmployeeManager&quot;&lt;/span&gt; records
&lt;/span&gt;  &lt;span class=&quot;code-comment&quot;&gt;// When they were being added to the collection by the Hydrator.
&lt;/span&gt;  $employee-&amp;gt;save();
&lt;span class=&quot;code-comment&quot;&gt;// -----&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Debug backtrace when this happens:&lt;/p&gt;
&lt;div class=&quot;panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelContent&quot;&gt;
&lt;p&gt;string(100) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Record.php @ line 1432&quot;&lt;br/&gt;
string(103) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Collection.php @ line 461&quot;&lt;br/&gt;
string(99) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Access.php @ line 131&quot;&lt;br/&gt;
string(107) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Hydrator/Graph.php @ line 229&quot;&lt;br/&gt;
string(101) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Hydrator.php @ line 137&quot;&lt;br/&gt;
string(108) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Query/Abstract.php @ line 1036&quot;&lt;br/&gt;
string(105) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Relation/Nest.php @ line 84&quot;&lt;br/&gt;
string(100) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Record.php @ line 1362&quot;&lt;br/&gt;
string(100) &quot;File: /Data/app/onlinevw-drupalvividwireless/libs/external-doctrine1/Doctrine/Record.php @ line 1333&quot;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12372" author="loops" created="Fri, 19 Mar 2010 12:33:35 +0000"  >&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;For people who are looking for a workaround, I&apos;ve found one that work for me.&lt;/p&gt;

&lt;p&gt;Get the doctrine extension h2aEqualable (h2aEqualable.zip), register it as a doctrine extension (see &lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_2/0_11/extensions&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_2/0_11/extensions&lt;/a&gt;) and make your refClass of every equal nest relation acting as h2aEqualable.&lt;/p&gt;

&lt;p&gt;In your PHP script :&lt;br/&gt;
{{&lt;br/&gt;
Doctrine::setExtensionsPath( &apos;path/to/unzip/place&apos; );&lt;br/&gt;
Doctrine_Manager::getInstance()-&amp;gt;registerExtension( &apos;h2aEqualable&apos; );&lt;br/&gt;
}}&lt;/p&gt;

&lt;p&gt;In your YAML schema :&lt;br/&gt;
{{&lt;br/&gt;
MyEqualNestRelationRefClassModel:&lt;br/&gt;
  actAs:&lt;br/&gt;
    h2aEqualable:&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;id_1,id_2&amp;#93;&lt;/span&gt;&lt;br/&gt;
}}&lt;/p&gt;

&lt;p&gt;As I&apos;ve said before, it works for me, so let me know if it solve your issues too...&lt;/p&gt;</comment>
                    <comment id="13365" author="pgueguin" created="Fri, 18 Jun 2010 12:57:55 +0000"  >&lt;p&gt;I have the very same issue with non equal nest relations.&lt;br/&gt;
It is stopping my project&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;87-87&apos; for key &apos;PRIMARY&apos;&lt;/p&gt;

&lt;p&gt;execute : UPDATE cop_job_stream_successor SET job_stream_destination_id = ?, updated_at = ? WHERE job_stream_source_id = ? AND job_stream_destination_id = ? - (87, 2010-06-18 18:55:32, 87, 94) &lt;/p&gt;

&lt;p&gt;CopJobStream:&lt;br/&gt;
  columns:&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
      notnull: false&lt;br/&gt;
....&lt;br/&gt;
  relations:&lt;br/&gt;
   SuccessorJobStreams:&lt;br/&gt;
     class: CopJobStream&lt;br/&gt;
     local: job_stream_source_id&lt;br/&gt;
     foreign: job_stream_destination_id    &lt;br/&gt;
     refClass: CopJobStreamSuccessor&lt;br/&gt;
     foreignAlias: PredecessorJobStreams&lt;br/&gt;
     onDelete: CASCADE &lt;br/&gt;
     onUpdate: CASCADE &lt;/p&gt;

&lt;p&gt;CopJobStreamSuccessor:&lt;br/&gt;
  columns:&lt;br/&gt;
   job_stream_source_id:&lt;br/&gt;
     type: integer&lt;br/&gt;
     primary: true&lt;br/&gt;
   job_stream_destination_id:&lt;br/&gt;
     type: integer&lt;br/&gt;
     primary: true&lt;br/&gt;
  relations:&lt;br/&gt;
    CopJobStream:&lt;br/&gt;
      local: job_stream_source_id&lt;br/&gt;
      foreignAlias: CopJobStreamSuccessors&lt;br/&gt;
      onDelete: CASCADE&lt;br/&gt;
      onUpdate: CASCADE    &lt;/p&gt;</comment>
                    <comment id="13367" author="pgueguin" created="Fri, 18 Jun 2010 14:20:28 +0000"  >&lt;p&gt;It works anyway with above   h2aEqualable extension&lt;/p&gt;</comment>
                    <comment id="15186" author="bigbadbassman" created="Wed, 26 Jan 2011 02:39:36 +0000"  >&lt;p&gt;after stumbling into the same pit as everyone, i created a fresh report as &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-958&quot; title=&quot;updating Models with Intra-Table Relations cascades strangely&quot;&gt;DC-958&lt;/a&gt;. Later I found out that it has been reported before, so please mark &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-958&quot; title=&quot;updating Models with Intra-Table Relations cascades strangely&quot;&gt;DC-958&lt;/a&gt; as duplicate of this. (or at least related, as I was using a Non-Equal Nested Set) also &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-952&quot; title=&quot;Non-Equal Nest Relations Not Working - from &amp;quot;Children&amp;quot; side&quot;&gt;DC-952&lt;/a&gt; refers to the same problem, but also with Non-Equal nestet sets.&lt;/p&gt;

&lt;p&gt;My Case:  Non-Equal-Nested-Set. Problems occur on saving Objects for 2nd or more time. Doctrine deletes all Child-Relations of the Object to be saved and updates Relations of the Childs to other Objects (other parents of the children objects) with references to the child itself!&lt;/p&gt;

&lt;p&gt;the proposed h2aEqualable extension does prevent the wrong update statements but not the initial delete of the child-relations.&lt;/p&gt;

&lt;p&gt;What exactly is missing on this bug to be fixed? It is now a year old, and clearly preventing people from using Self-Referencing relations with doctrine.&lt;/p&gt;

&lt;p&gt;How can we help? More sample data, schema definitions, test cases?&lt;/p&gt;</comment>
                    <comment id="15309" author="flevour" created="Tue, 15 Feb 2011 06:41:46 +0000"  >&lt;p&gt;Here is a better and simpler test case for the equal relation: &lt;a href=&quot;https://gist.github.com/827414&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/827414&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is clearly a memory problem here. I&apos;ll leave it up to Jonathan to decide whether it&apos;s a scenario which can be avoided in Doctrine itself or must be handled by Symfony (&lt;a href=&quot;http://trac.symfony-project.org/ticket/9398&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/ticket/9398&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;In the Symfony context calls to refresh() might not be an option when modifying an object (aka saving a form).&lt;/p&gt;</comment>
                    <comment id="15333" author="yitznewton" created="Thu, 17 Feb 2011 12:06:55 +0000"  >&lt;p&gt;h2aEqualable seems to work for me.&lt;/p&gt;</comment>
                    <comment id="15898" author="pavel.campr" created="Thu, 2 Jun 2011 07:48:44 +0000"  >&lt;p&gt;h2aEqualable works only partly for me (same as Daniel Reiche wrote).&lt;/p&gt;

&lt;p&gt;I tried to identify the problem. &lt;/p&gt;

&lt;p&gt;My usecase was: &lt;br/&gt;
1) I have an Article record in $article&lt;br/&gt;
2) I called $article-&amp;gt;RelatedArticles-&amp;gt;getPrimaryKeys() , where RelatedArticles is a name of my self reference&lt;br/&gt;
3) $article-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;The problem originates from step 2), during hydratation process for related articles, which are added to a collection of related articles, in Collection-&amp;gt;add() method (line 465) here:&lt;/p&gt;

&lt;p&gt;            if ($value !== null) &lt;/p&gt;
{
                $record-&amp;gt;set($this-&amp;gt;referenceField, $value, false);
            }
&lt;p&gt; else {&lt;/p&gt;

&lt;p&gt;but, $this-&amp;gt;referenceField contains wrong name of reference field. Self referenced model (Article) has two relations to the same class (one from &quot;owning&quot; side, second from &quot;referencing&quot; side). $this-&amp;gt;referenceField in the collection is somewhere filled with the wrong relation name (not the&quot;referencing&quot; one, but the &quot;owning&quot; one). &lt;/p&gt;

&lt;p&gt;When I save the $article, all referenced records are saved too and this is the problem, why the Doctrine tries to save corrupted data:&lt;/p&gt;

&lt;p&gt;In my example, I have this data:&lt;/p&gt;

&lt;p&gt;in Doctrine_Collection-&amp;gt;add on line 457: $record) is a RelatedArticle (&lt;br/&gt;
    article1 = string(1) &quot;4&quot;&lt;br/&gt;
    article2 = string(1) &quot;9&quot;&lt;br/&gt;
)&lt;br/&gt;
in Doctrine_Collection-&amp;gt;add on line 458: $this-&amp;gt;referenceField) = string(19) &quot;article1&quot;&lt;br/&gt;
in Doctrine_Collection-&amp;gt;add on line 459: $value) = string(1) &quot;9&quot;   &lt;/p&gt;

&lt;p&gt;BUT expected data is:&lt;/p&gt;

&lt;p&gt;in Doctrine_Collection-&amp;gt;add on line 458: $this-&amp;gt;referenceField) = string(19) &quot;article2&quot;&lt;/p&gt;


&lt;p&gt;This wrong behavior modified my RelatedArticle into this: RelatedArticle (&lt;br/&gt;
    article1 = string(1) &quot;9&quot;&lt;br/&gt;
    article2 = string(1) &quot;9&quot;&lt;br/&gt;
)&lt;/p&gt;


&lt;p&gt;I have no idea how to fix it, but maybe someone can, I hope &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;

&lt;p&gt;(&lt;br/&gt;
my schema is:&lt;/p&gt;

&lt;p&gt;Article&lt;br/&gt;
  relations:&lt;br/&gt;
    RelatedArticles:&lt;br/&gt;
      class: Article&lt;br/&gt;
      local: article1&lt;br/&gt;
      foreign: article2&lt;br/&gt;
      refClass: RelatedArticle&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;Maybe, when &quot;refClassRelationAlias&quot; option was invented to specifically point to a relation, instead of using &quot;refClass&quot;, which can be used more times for one record and thus is not unambiguous, something for self referenced relations should be added as well. My &quot;refClass: RelatedArticle&quot; creates (probably) a relation from the foreign side too and Article contains two relations, which uses same refClass. Doctrine then doesn&apos;t know, which one should be used. &lt;/p&gt;
</comment>
                    <comment id="15901" author="pavel.campr" created="Fri, 3 Jun 2011 13:14:55 +0000"  >&lt;p&gt;&lt;b&gt;Non-equal&lt;/b&gt; nest relations work properly, when &lt;b&gt;refClassRelationAlias&lt;/b&gt; undocumented option is used, e.g.&lt;/p&gt;


&lt;p&gt;Article:&lt;br/&gt;
  ...&lt;br/&gt;
  relations:&lt;br/&gt;
    RelatedArticles:&lt;br/&gt;
      class: Article&lt;br/&gt;
      local: article1&lt;br/&gt;
      foreign: article2&lt;br/&gt;
      refClass: RelatedArticle&lt;br/&gt;
      refClassRelationAlias: RelatedArticleAlias&lt;/p&gt;

&lt;p&gt;Anything can be used as a value for refClassRelationAlias.&lt;/p&gt;

&lt;p&gt;Unfortunately, &lt;b&gt;this doesn&apos;t fix equal nest relations&lt;/b&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10505" name="h2aEqualable.zip" size="3041" author="loops" created="Fri, 19 Mar 2010 12:33:52 +0000" />
                    <attachment id="10216" name="saving process.png" size="64255" author="jaimesuez" created="Mon, 7 Dec 2009 00:38:52 +0000" />
                    <attachment id="10260" name="schema.yml" size="443" author="p16" created="Sat, 26 Dec 2009 15:09:43 +0000" />
                    <attachment id="10261" name="testEqualNestRelationsTest.php" size="3598" author="p16" created="Sat, 26 Dec 2009 15:09:43 +0000" />
                    <attachment id="10262" name="testNestedEqualRelationWithObjectsTest.php" size="3391" author="p16" created="Sat, 26 Dec 2009 15:09:43 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-331] Wrong SQL output from Doctrine_Expression for pgsql with timestamp with time zone field</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-331</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;(1) pgsql connection&lt;br/&gt;
(2) timestamp with time zone column&lt;br/&gt;
(3) $doctrine_expression = new Doctrine_Expression(&apos;NOW()&apos;);&lt;br/&gt;
      echo $doctrine_expression-&amp;gt;getSQL();&lt;br/&gt;
 gives:&lt;br/&gt;
LOCALTIMESTAMP(0)&lt;/p&gt;

&lt;p&gt;What I&apos;d like to get access to using that Doctrine construct is the &lt;br/&gt;
functionality of &apos;CURRENT_TIMESTAMP&apos;, (has time zone,&lt;br/&gt;
stores time in TIMESTAMP WITH TIME ZONE columns in UTC time)&lt;/p&gt;

&lt;p&gt;Fortunately, all the databases that I want to use implement &lt;br/&gt;
&apos;CURRENT_TIMESTAMP&apos;, but not all PDO/Doctrine databases&lt;br/&gt;
support that construct, even though it&apos;s ANSI SQL standard, &lt;br/&gt;
(which ANSI I don&apos;t know.)&lt;/p&gt;</description>
                <environment>This is with Symfony 1.3 alpha (which is pretty good) Can&amp;#39;t tell you which Doctrine it comes with</environment>
            <key id="10568">DC-331</key>
            <summary>Wrong SQL output from Doctrine_Expression for pgsql with timestamp with time zone field</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="gearond">Dennis Gearon</reporter>
                        <labels>
                    </labels>
                <created>Sun, 6 Dec 2009 02:29:45 +0000</created>
                <updated>Tue, 5 Jan 2010 00:26:29 +0000</updated>
                                    <version>1.2.0-RC1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="11316" author="slig" created="Tue, 5 Jan 2010 00:26:29 +0000"  >&lt;p&gt;I&apos;m also seeing this with Symfony 1.4.1 (w/Doctrine 1.2).  Affects timestampable tables (created_at, updated_at).&lt;/p&gt;

&lt;p&gt;also, NOW() AT TIME ZONE &apos;UTC&apos; translates to LOCALTIMESTAMP(0) AT TIME ZONE &apos;UTC&apos; (via buildSqlQuery).&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-335] Oracle identifier too long in normal SELECT when using longer table name or column</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-335</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Unfortunatelly oracle has max identifier length for 30 characters. When using longer model names eg. misCompanyContributor with column names the generated aliases for selected columns mix tableized modelname with colum name joined by two __, and sometimes the generated alias should exceed the allowed 30 characters long identifiers, and oracle complains with:&lt;/p&gt;

&lt;p&gt;{{&lt;br/&gt;
ORA-00972: identifier is too long&lt;br/&gt;
}}&lt;/p&gt;

&lt;p&gt;An example of large select with alias:&lt;br/&gt;
{{&lt;br/&gt;
SELECT&lt;br/&gt;
...&lt;br/&gt;
mis_contributor.contributor_id AS mis_contributor__contributor_id&lt;br/&gt;
..&lt;br/&gt;
FROM mis_contributor  ...&lt;br/&gt;
}}&lt;/p&gt;</description>
                <environment>Oracle</environment>
            <key id="10579">DC-335</key>
            <summary>Oracle identifier too long in normal SELECT when using longer table name or column</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="adrive">Miloslav &quot;adrive&quot; Kmet</reporter>
                        <labels>
                    </labels>
                <created>Mon, 7 Dec 2009 23:59:18 +0000</created>
                <updated>Wed, 13 Oct 2010 18:28:25 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14562" author="mdhooge" created="Wed, 13 Oct 2010 17:12:31 +0000"  >&lt;p&gt;A workaround is available in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-72&quot; title=&quot;DQL Auto generated column aliases cause &amp;quot;ORA-00972: identifier is too long&amp;quot; on Oracle&quot;&gt;&lt;del&gt;DC-72&lt;/del&gt;&lt;/a&gt; for version 1.1.4&lt;/p&gt;</comment>
                    <comment id="14563" author="mdhooge" created="Wed, 13 Oct 2010 18:28:25 +0000"  >&lt;p&gt;I have applied the following patch to use aliases of identifiers (what is after the &quot;as&quot; when defining field name).&lt;/p&gt;

&lt;p&gt;So far, it seems to work... But I am quite sure I didn&apos;t take all possible cases into consideration.&lt;/p&gt;


&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;--- lib/vendor/doctrine/Doctrine/Hydrator/Graph.php.orig	2010-10-07 19:09:10.000000000 +0200
+++ lib/vendor/doctrine/Doctrine/Hydrator/Graph.php	2010-10-14 00:08:05.000000000 +0200
@@ -298,10 +298,10 @@
                 }
 
                 $e = explode(&apos;__&apos;, $key);
-                $last = strtolower(array_pop($e));
+                $fieldName = strtolower(array_pop($e));
                 $cache[$key][&apos;dqlAlias&apos;] = $this-&amp;gt;_tableAliases[strtolower(implode(&apos;__&apos;, $e))];
                 $table = $this-&amp;gt;_queryComponents[$cache[$key][&apos;dqlAlias&apos;]][&apos;table&apos;];
-                $fieldName = $table-&amp;gt;getFieldName($last);
+                $last = $table-&amp;gt;getColumnName($fieldName);
                 $cache[$key][&apos;fieldName&apos;] = $fieldName;
                 if ($table-&amp;gt;isIdentifier($fieldName)) {
                     $cache[$key][&apos;isIdentifier&apos;] = true;

--- lib/vendor/doctrine/Doctrine/Query.php.orig	2010-10-07 19:09:10.000000000 +0200
+++ lib/vendor/doctrine/Doctrine/Query.php	2010-10-14 00:03:28.000000000 +0200
@@ -494,12 +494,12 @@
                 $parentAlias = $this-&amp;gt;getSqlTableAlias($componentAlias . &apos;.&apos; . $parent-&amp;gt;getComponentName());
                 $sql[] = $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($parentAlias) . &apos;.&apos; . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($columnName)
                        . &apos; AS &apos;
-                       . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $columnName);
+                       . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $fieldName);
             } else {
-                $columnName = $table-&amp;gt;getColumnName($fieldName);
+                $columnName = $table-&amp;gt;getColumnName($fieldName); // Really needed?
                 $sql[] = $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias) . &apos;.&apos; . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($columnName)
                        . &apos; AS &apos;
-                       . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $columnName);
+                       . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $fieldName);
             }
         }
 
@@ -554,7 +554,7 @@
 
             return $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;.&apos; . $name)
                    . &apos; AS &apos;
-                   . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $name);
+                   . $this-&amp;gt;_conn-&amp;gt;quoteIdentifier($tableAlias . &apos;__&apos; . $field);
         }
     }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-338] Add setting charset to sandbox</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-338</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I try set charset  adding to config.php in sandbox:&lt;br/&gt;
$manager = Doctrine_Manager::getInstance();&lt;br/&gt;
$manager-&amp;gt;openConnection(DSN, &apos;doctrine&apos;);&lt;br/&gt;
$manager-&amp;gt;setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_PEAR);&lt;br/&gt;
$manager-&amp;gt;setCharset(&apos;utf8&apos;);&lt;/p&gt;

&lt;p&gt;and this doesn&apos;t work.&lt;/p&gt;

&lt;p&gt;Please update sandbox and give the how to right setCharset in this example. Almost used utf8.&lt;/p&gt;</description>
                <environment>mysql 5, ubuntu 9.04, php 5.2.10</environment>
            <key id="10582">DC-338</key>
            <summary>Add setting charset to sandbox</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="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="abtris">Ladislav Prskavec</reporter>
                        <labels>
                    </labels>
                <created>Tue, 8 Dec 2009 08:18:18 +0000</created>
                <updated>Thu, 10 Dec 2009 19:23:51 +0000</updated>
                                                                    <component>Sandbox</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11099" author="jwage" created="Tue, 8 Dec 2009 18:09:38 +0000"  >&lt;p&gt;This works properly. I test setCharset(&apos;utf8&apos;) and SET NAMES &apos;utf8&apos; query is issued to the database properly. Please include reproducible code/information in your issue.&lt;/p&gt;</comment>
                    <comment id="11114" author="abtris" created="Wed, 9 Dec 2009 07:50:12 +0000"  >&lt;p&gt;Try this example on my github &lt;a href=&quot;http://github.com/abtris/doctrine-sandbox&quot; class=&quot;external-link&quot;&gt;http://github.com/abtris/doctrine-sandbox&lt;/a&gt;, screenshots included.&lt;/p&gt;</comment>
                    <comment id="11161" author="abtris" created="Thu, 10 Dec 2009 19:23:51 +0000"  >&lt;p&gt;Try my sources, i now solution with add connection, but will be better support in manager for set encoding by options.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-339] Documentation unclear about linking inherited objects</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-339</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The (very nice) doctrine documentation fails to mention anything about how inherited objects handle relations.&lt;/p&gt;

&lt;p&gt;I.e. if I got the model: &lt;br/&gt;
Entity:&lt;br/&gt;
  columns:&lt;br/&gt;
    username: string(20)&lt;br/&gt;
    password: string(16)&lt;br/&gt;
    created_at: timestamp&lt;br/&gt;
    updated_at: timestamp&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Entity&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyValue: 1&lt;/p&gt;

&lt;p&gt;Group:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Entity&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyValue: 2&lt;/p&gt;

&lt;p&gt;Topic:&lt;br/&gt;
  content: string&lt;br/&gt;
  entity_id: integer&lt;br/&gt;
  relations:&lt;br/&gt;
    User:&lt;br/&gt;
       class: Entity&lt;br/&gt;
       local: entity_id&lt;br/&gt;
       foreign: id&lt;/p&gt;

&lt;p&gt;Can I then define both users and groups to link to Topic? &lt;/p&gt;


</description>
                <environment></environment>
            <key id="10583">DC-339</key>
            <summary>Documentation unclear about linking inherited objects</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tarjei">Tarjei Huse</reporter>
                        <labels>
                    </labels>
                <created>Tue, 8 Dec 2009 08:57:45 +0000</created>
                <updated>Tue, 8 Dec 2009 08:57:45 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-344] Trouble with auto including generate Base class with specifik name</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-344</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have found a problem during testing example model on page &lt;a href=&quot;http://www.doctrine-project.org/documentation/cookbook/1_1/en/code-igniter-and-doctrine&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/cookbook/1_1/en/code-igniter-and-doctrine&lt;/a&gt; . A use YAML model with object name UserGroup and call method Doctrine_Core::createTablesFromModels(&apos;models&apos;); process faling with error:&lt;/p&gt;

&lt;p&gt;Fatal error: Class &apos;BaseUserGroup&apos; not found in /sourcepath/models/UserGroup.php on line 13&lt;/p&gt;

&lt;p&gt;Generate model file included abstract class BaseUserGroup exist and is OK. If I include BaseUserGroup manuly or rename object &quot;UserGroup&quot; on &quot;UserGroups&quot; everithing work fine. I thing here is a problem with autoloding base class with specifik name.&lt;/p&gt;

&lt;p&gt;Here is my code example:&lt;/p&gt;

&lt;p&gt;Doctrine_Core::dropDatabases();&lt;br/&gt;
Doctrine_Core::createDatabases();&lt;br/&gt;
Doctrine_Core::generateModelsFromYaml(&apos;sourcepath/yaml/model.yml&apos;, &apos;models&apos;);&lt;br/&gt;
Doctrine_Core::createTablesFromModels(&apos;models&apos;);&lt;/p&gt;


&lt;p&gt;Trouble shotting YAML model is:&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
UserGroup:&lt;br/&gt;
  columns:&lt;br/&gt;
    user_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;br/&gt;
    group_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;/p&gt;</description>
                <environment>Linux, Ubuntu 9.04 64b</environment>
            <key id="10591">DC-344</key>
            <summary>Trouble with auto including generate Base class with specifik 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="havelkaondrej">Havelka Ondrej</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Dec 2009 09:20:54 +0000</created>
                <updated>Sun, 21 Mar 2010 00:34:59 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>3</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11298" author="silent_hill_dev" created="Sat, 26 Dec 2009 19:40:52 +0000"  >&lt;p&gt;Same problem here following the same example of the 1.2 tutorial.&lt;/p&gt;</comment>
                    <comment id="11634" author="m.olszewski" created="Mon, 8 Feb 2010 19:14:40 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I&apos;ve stumbled upon the same problem and I think I know where the issue is.&lt;/p&gt;

&lt;p&gt;So Doctrine_Core::createTablesFromModels() calls Doctrine_Export::exportSchema() which in turn calls Doctrine_Core::loadModels().&lt;/p&gt;

&lt;p&gt;Doctrine_Core::loadModels() uses RecursiveIteratorIterator and iterates over all found files.&lt;/p&gt;

&lt;p&gt;Now I think the order of files returned by RecursiveIteratorIterator is not always the same (depends on OS, filenames and cosmic radiation &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; ), but the most important thing here is that class files from &apos;modules/generated&apos; directory (as in examples) ARE NOT included before subclasses derived from generated classes. This means that Doctrine_Core::autoload() fails to load classes from &apos;modules/generated&apos; directory, exactly this check fails:&lt;/p&gt;

&lt;p&gt;if (0 !== stripos($className, &apos;Doctrine_&apos;) || class_exists($className, false) || interface_exists($className, false))&lt;/p&gt;

&lt;p&gt;as base class is not starting with &apos;Doctrine_&apos; and is not yet loaded.&lt;/p&gt;

&lt;p&gt;To fix it properly the algorithm for loading modules must be changed to first include &apos;modules/generated&apos; classes and then rest of classes. I am not sure but maybe Core::autoload() might be changed to include base classes properly.&lt;/p&gt;


&lt;p&gt;QUICK WORKAROUND:&lt;br/&gt;
As a quick workaround I&apos;ve changed parameters in call to createTablesFromModels() to:&lt;/p&gt;

&lt;p&gt;Doctrine_Core::createTablesFromModels(array(&apos;models/generated&apos;,&apos;models&apos;));&lt;/p&gt;

&lt;p&gt;as createTablesFromModels() can accept array of directories.&lt;/p&gt;


&lt;p&gt;Hope this helps you, please let me know if you need any more information. Thanks!&lt;/p&gt;</comment>
                    <comment id="11635" author="sacho" created="Tue, 9 Feb 2010 01:38:32 +0000"  >&lt;p&gt;You are missing the model autoloader(&lt;a href=&quot;http://www.doctrine-project.org/upgrade/1_2#Models%20Autoloading&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/upgrade/1_2#Models%20Autoloading&lt;/a&gt;), which was added in 1.2&lt;/p&gt;

&lt;p&gt;That should fix the problem with conservative autoloading.&lt;/p&gt;</comment>
                    <comment id="11637" author="m.olszewski" created="Tue, 9 Feb 2010 11:54:06 +0000"  >&lt;p&gt;I&apos;ve tried registering modelsAutoload() and it works superb in this case for both aggressive and conservative loading.&lt;/p&gt;

&lt;p&gt;It is a shame that it is not mentioned in 1.2 PDF I&apos;ve got - it&apos;d make life easier for some people &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;

&lt;p&gt;Thanks for your help.&lt;/p&gt;</comment>
                    <comment id="12418" author="cublt" created="Sun, 21 Mar 2010 00:34:59 +0000"  >&lt;p&gt;i am a new user to doctrine and i hit this brick wall. this bug report was all that saved me, and it is a bit misleading. my test results are below. in the end i found a combination that worked, but this seems like a glaring bug especially since the pdf takes the user right down a path that fails completely in all cases (default aggressive loading, doesn&apos;t work for me at all).&lt;/p&gt;

&lt;p&gt;i am using a pear loaded version 1.2 on ubuntu&lt;/p&gt;

&lt;p&gt;here are my test results:&lt;br/&gt;
---------------------------------------------------------------------------------------------------&lt;br/&gt;
case 1: load models right after generating them, without modelsAutoLoad() call: SUCCESS/FAIL varies&lt;br/&gt;
---------------------------------------------------------------------------------------------------&lt;br/&gt;
in doctrine_bootstrap.php file: &lt;br/&gt;
&amp;lt;?&lt;br/&gt;
require_once(&apos;lib/vendor/doctrine/Doctrine.php&apos;);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));&lt;br/&gt;
$manager = Doctrine_Manager::getInstance();&lt;br/&gt;
$conn = Doctrine_Manager::connection(&apos;mysql:// DSN REMOVED &apos;,&apos;doctrine&apos;);&lt;/p&gt;

&lt;p&gt;in test.php:&lt;br/&gt;
&amp;lt;?&lt;br/&gt;
require_once(&apos;doctrine_bootstrap.php&apos;);&lt;br/&gt;
Doctrine_Core::generateModelsFromDb(&apos;models&apos;, array(&apos;doctrine&apos;), array(&apos;generateTableClasses&apos; =&amp;gt; true));&lt;br/&gt;
Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;



&lt;p&gt;---------------------------------------------------------------------------------------------------&lt;br/&gt;
case 2: load models after they have already been generated, without modelsAutoLoad() call: FAIL&lt;br/&gt;
---------------------------------------------------------------------------------------------------&lt;br/&gt;
in doctrine_bootstrap.php file: &lt;br/&gt;
&amp;lt;?&lt;br/&gt;
require_once(&apos;lib/vendor/doctrine/Doctrine.php&apos;);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));&lt;br/&gt;
$manager = Doctrine_Manager::getInstance();&lt;br/&gt;
$conn = Doctrine_Manager::connection(&apos;mysql:// DSN REMOVED &apos;,&apos;doctrine&apos;);&lt;/p&gt;

&lt;p&gt;in test.php:&lt;br/&gt;
&amp;lt;?&lt;br/&gt;
// note: all model classes are in ./models and ./models/generated&lt;br/&gt;
require_once(&apos;doctrine_bootstrap.php&apos;);&lt;br/&gt;
Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;




&lt;p&gt;---------------------------------------------------------------------------------------------------&lt;br/&gt;
case 3: load models after they have already been generated, with the modelsAutoLoad() call and default aggressive setting: FAIL&lt;br/&gt;
---------------------------------------------------------------------------------------------------&lt;br/&gt;
in doctrine_bootstrap.php file: &lt;br/&gt;
&amp;lt;?&lt;br/&gt;
require_once(&apos;lib/vendor/doctrine/Doctrine.php&apos;);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));&lt;br/&gt;
$manager = Doctrine_Manager::getInstance();&lt;br/&gt;
$conn = Doctrine_Manager::connection(&apos;mysql:// DSN REMOVED &apos;,&apos;doctrine&apos;);&lt;/p&gt;

&lt;p&gt;spl_autoload_register(array(&apos;Doctrine_Core&apos;, &apos;modelsAutoload&apos;));&lt;/p&gt;

&lt;p&gt;in test.php:&lt;br/&gt;
&amp;lt;?&lt;br/&gt;
// note: all model classes are in ./models and ./models/generated&lt;br/&gt;
require_once(&apos;doctrine_bootstrap.php&apos;);&lt;br/&gt;
Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;




&lt;p&gt;---------------------------------------------------------------------------------------------------&lt;br/&gt;
case 4: load models after they have already been generated, with the modelsAutoLoad() call and conservative loading: SUCCESS&lt;br/&gt;
---------------------------------------------------------------------------------------------------&lt;br/&gt;
in doctrine_bootstrap.php file: &lt;br/&gt;
&amp;lt;?&lt;br/&gt;
require_once(&apos;lib/vendor/doctrine/Doctrine.php&apos;);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));&lt;br/&gt;
$manager = Doctrine_Manager::getInstance();&lt;br/&gt;
$conn = Doctrine_Manager::connection(&apos;mysql:// DSN REMOVED &apos;,&apos;doctrine&apos;);&lt;/p&gt;

&lt;p&gt;$manager-&amp;gt;setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);&lt;br/&gt;
spl_autoload_register(array(&apos;Doctrine_Core&apos;, &apos;modelsAutoload&apos;));&lt;/p&gt;

&lt;p&gt;in test.php:&lt;br/&gt;
&amp;lt;?&lt;br/&gt;
// note: all model classes are in ./models and ./models/generated&lt;br/&gt;
require_once(&apos;doctrine_bootstrap.php&apos;);&lt;br/&gt;
Doctrine_Core::loadModels(&apos;models&apos;);&lt;/p&gt;

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

<item>
            <title>[DC-348] Doctrine manual does not document that columns can be added with simple inheritance, or the semantics of accessing those columns in the parent</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-348</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The Doctrine manual&apos;s section on inheritance mentions simple inheritance only briefly. The examples do not show that columns can be added, nor do they explain that the parent model class can also access those columns (very useful when you override its methods at the application level in Symfony). &lt;/p&gt;

&lt;p&gt;Both behaviors are supported (Jon suggested I take advantage of them at one point) but it&apos;s easy to miss the fact that they are available. For a long time I assumed column aggregation inheritance was the only way to add columns.&lt;/p&gt;

&lt;p&gt;I&apos;m now exploiting simple inheritance as a way to add columns to sfGuardUser rather than introducing an sfGuardUserProfile class with all of the attendant problems of trying to pretend two tables are actually one table. This is very useful.&lt;/p&gt;

&lt;p&gt;(Out of curiosity, is there an alternative way to add columns to plugin schemas at the app level in Symfony 1.3 similar to the way it&apos;s now done for Propel?)&lt;/p&gt;</description>
                <environment></environment>
            <key id="10596">DC-348</key>
            <summary>Doctrine manual does not document that columns can be added with simple inheritance, or the semantics of accessing those columns in the parent</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="boutell">Tom Boutell</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Dec 2009 00:23:00 +0000</created>
                <updated>Thu, 10 Dec 2009 00:23:00 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-353] Doctrine_Query can&apos;t map a main query colum inside a subquery with join</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-353</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If i have the following schema:&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;Medidor:
  tableName: TBLMEDIDOR
  columns:
    CODIGO:
      name: NRCODIGO as codigo
      type: integer(10)
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      sequence: SEQMEDCODIGO
    DESCRICAO:
      name: TXDESCRICAO as descricao
      type: string(1000)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;

AnaliseMedidor:
  tableName: TBLANALISE_MEDIDOR
  columns:
    CODIGO:
      name: NRCODIGO as codigo
      type: integer(10)
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      sequence: SEQANMCODIGO
    DATA:
      name: DTDATA as dataAnalise
      type: date
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    MEDIDOR:
      name: FKMEDCODIGO as medidor_codigo
      type: integer(10)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    OBSERVACAO:
      name: TXOBSERVACAO as observacao
      type: string(1000)
  relations:
    Medidor: { local: medidor_codigo, foreign: codigo, foreignAlias: Analises }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and execute the following query:&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::getTable(&apos;Medidor&apos;)-&amp;gt;createQuery()
    -&amp;gt;innerJoin(&apos;m.Analises a&apos;)
    -&amp;gt;where(&apos;a.dataAnalise = (SELECT MAX(a2.dataAnalise) FROM &apos;
        . &apos;AnaliseMedidor a2 WHERE a2.medidor_codigo = a.medidor_codigo)&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;the &quot;a.medidor_codigo&quot; in the subquery don&apos;t get correctly mapped. So Doctrine tells me:&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;{sfDoctrineLogger} executeQuery : SELECT t.nr80102codigo AS t__nr80102codigo, t.tx80102descricao AS t__tx80102descricao FROM TBL80102MEDIDOR t INNER JOIN TBL80103ANALISE_MEDIDOR t2 ON t.nr80102codigo = t2.fk80102codigo WHERE t2.dt80103data = (SELECT MAX(t3.dt80103data) AS t3__0 FROM TBL80103ANALISE_MEDIDOR t3 WHERE t3.fk80102codigo = t2.medidor_codigo)
{Doctrine_Connection_Oracle_Exception} SQLSTATE[HY000]: General error: 904 OCIStmtExecute: ORA-00904: &lt;span class=&quot;code-quote&quot;&gt;&quot;T2&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;MEDIDOR_CODIGO&quot;&lt;/span&gt;: invalid identifier
 (/root/PDO_OCI-1.0/oci_statement.c:142)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If i put the real name column it runs ok:&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::getTable(&apos;Medidor&apos;)-&amp;gt;createQuery()
    -&amp;gt;innerJoin(&apos;m.Analises a&apos;)
    -&amp;gt;where(&apos;a.dataAnalise = (SELECT MAX(a2.dataAnalise) FROM &apos;
        . &apos;AnaliseMedidor a2 WHERE a2.medidor_codigo = a.FKMEDCODIGO)&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But, this should not be done, right?&lt;/p&gt;


&lt;p&gt;In Doctrine 1.2 it works fine. But in the related versions don&apos;t.&lt;/p&gt;</description>
                <environment>Apache 2.2.13, PHP 5.3, Fedora 11 or Ubuntu 9.04 (and Symfony 1.2.9/1.2.10 with Doctrine 1.0.12/1.0.14)</environment>
            <key id="10603">DC-353</key>
            <summary>Doctrine_Query can&apos;t map a main query colum inside a subquery with join</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="dead_thinker">Arian Maykon de Ara&#250;jo Di&#243;genes</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Dec 2009 23:02:56 +0000</created>
                <updated>Thu, 10 Dec 2009 23:17:04 +0000</updated>
                                    <version>1.0.12</version>
                <version>1.0.14</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11169" author="dead_thinker" created="Thu, 10 Dec 2009 23:17:04 +0000"  >&lt;p&gt;Haven&apos;t added a TestCase because Doctrine 1.0.14 don&apos;t have them yet!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-355] Call to a member function evictAll() if a table is retrieved, that is not existent</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-355</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;Im not quite sure it this bahaviour is wanted, but i think that this&lt;br/&gt;
should be catched:&lt;/p&gt;

&lt;p&gt;If i call Doctrine::getTable on a non existing model, the exception is&lt;br/&gt;
thrown. After them i want always to clear all Record Repositories, see&lt;br/&gt;
code:&lt;/p&gt;

&lt;p&gt;try&lt;/p&gt;
{
        $table = Doctrine::getTable(&apos;notexistent&apos;);
        }
&lt;p&gt;        catch(Exception $e)&lt;/p&gt;
{
                echo &apos;not existent&apos;.$e-&amp;gt;getMessage();
        }
&lt;p&gt;        Doctrine_Manager::connection()-&amp;gt;clear();&lt;/p&gt;

&lt;p&gt;Then I get the error message:&lt;/p&gt;

&lt;p&gt;Fatal error: Call to a member function evictAll() on a non-object in /&lt;br/&gt;
core/lib/Doctrine/Doctrine/Connection.php on line 1239&lt;/p&gt;

&lt;p&gt;The problem is that the function clear doesnt check if a repository is&lt;br/&gt;
given.&lt;/p&gt;

&lt;p&gt; public function clear()&lt;br/&gt;
    {&lt;br/&gt;
        foreach ($this-&amp;gt;tables as $k =&amp;gt; $table) &lt;/p&gt;
{
            $table-&amp;gt;getRepository()-&amp;gt;evictAll();             //
getRepository delivers FALSE
            $table-&amp;gt;clear();
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;Is it normal behaviour? Or should it be checked first:&lt;/p&gt;

&lt;p&gt;if ($repository = $table-&amp;gt;getRepository())&lt;/p&gt;
{
 $repository-&amp;gt;evisctAll();

}

&lt;p&gt;best regards,&lt;br/&gt;
aNj&lt;/p&gt;</description>
                <environment>Ubuntu 8.04</environment>
            <key id="10608">DC-355</key>
            <summary>Call to a member function evictAll() if a table is retrieved, that is not existent</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="anj">aNj</reporter>
                        <labels>
                    </labels>
                <created>Sat, 12 Dec 2009 18:27:17 +0000</created>
                <updated>Sat, 12 Dec 2009 18:27:17 +0000</updated>
                                    <version>1.2.0</version>
                <version>1.2.1</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-356] Error in self referencing (nest relations) and tableName.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-356</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have this schema:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Interface&lt;br/&gt;
Interfaz: &lt;br/&gt;
  tableName:        YT_INTERFAZ&lt;br/&gt;
  columns:&lt;br/&gt;
    cinterfaz:        
{ type: integer, notnull: true, primary: true, autoincrement: true }
&lt;p&gt;  relations:&lt;br/&gt;
    Conexiones:&lt;br/&gt;
      class: Interfaz&lt;br/&gt;
      local: cinterfazsrc&lt;br/&gt;
      foreign: cinterfazdst&lt;br/&gt;
      refClass: Conexion&lt;br/&gt;
      equal: true&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;#Link&lt;br/&gt;
Conexion:&lt;br/&gt;
  tableName:        YT_CONEXION&lt;br/&gt;
  columns:&lt;br/&gt;
    cinterfazsrc:      &lt;/p&gt;
{ type: integer, primary: true }
&lt;p&gt;    cinterfazdst:      &lt;/p&gt;
{ type: integer, primary: true }

&lt;p&gt;When I try to get $interfaz-&amp;gt;Conexiones, I get this message:&lt;/p&gt;

&lt;p&gt;Notice: Undefined index: yt_interfaz in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 288&lt;/p&gt;

&lt;p&gt;Notice: Undefined index: in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 289&lt;/p&gt;

&lt;p&gt;Fatal error: Call to a member function getFieldName() on a non-object in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 290&lt;/p&gt;

&lt;p&gt;But If I remove tableName fields in schema declaration, it works perfectly. The name of tableName don&apos;t matters, if you use it, it fails.&lt;/p&gt;</description>
                <environment>Linux, php 5.2.10, apache 2.2.12</environment>
            <key id="10609">DC-356</key>
            <summary>Error in self referencing (nest relations) and tableName.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="perseo">Sergio Gomez</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Dec 2009 12:07:46 +0000</created>
                <updated>Thu, 17 Jan 2013 01:16:07 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>2</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="15310" author="kweij" created="Tue, 15 Feb 2011 08:15:12 +0000"  >&lt;p&gt;Same story over here. Same error with the following non-equal nest relation:&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-javascript&quot;&gt;&amp;lt;?php

class TXCRDataNodeCRDataNode &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; &lt;span class=&quot;code-keyword&quot;&gt;function&lt;/span&gt; setTableDefinition() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;x_CRDataNode_CRDataNode&apos;);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;childNodeID&apos;, &apos;integer&apos;, 4, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;length&apos; =&amp;gt; 4,
             &apos;fixed&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;autoincrement&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             ));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;parentNodeID&apos;, &apos;integer&apos;, 4, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;length&apos; =&amp;gt; 4,
             &apos;fixed&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;autoincrement&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             ));
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;function&lt;/span&gt; setUp() {
        parent::setUp();
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;TCRDataNode as child&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;childNodeID&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;dataNodeID&apos;));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;TCRDataNode as parent&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;parentNodeID&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;dataNodeID&apos;));
    }
}

class TCRDataNode &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; &lt;span class=&quot;code-keyword&quot;&gt;function&lt;/span&gt; setTableDefinition() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;CRDataNode&apos;);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;dataNodeID&apos;, &apos;integer&apos;, 4, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;length&apos; =&amp;gt; 4,
             &apos;fixed&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;autoincrement&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             ));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;value&apos;, &apos;string&apos;, 255, array(
             &apos;type&apos; =&amp;gt; &apos;string&apos;,
             &apos;length&apos; =&amp;gt; 255,
             &apos;fixed&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             &apos;autoincrement&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;,
             ));
    }
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;function&lt;/span&gt; setUp() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;TCRDataNode as childNodes&apos;, array(
            &apos;local&apos; =&amp;gt; &apos;parentNodeID&apos;,
            &apos;foreign&apos; =&amp;gt; &apos;childNodeID&apos;,
            &apos;refClass&apos; =&amp;gt; &apos;TXCRDataNodeCRDataNode&apos;));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;TCRDataNode as parentNodes&apos;, array(
            &apos;local&apos; =&amp;gt; &apos;childNodeID&apos;,
            &apos;foreign&apos; =&amp;gt; &apos;parentNodeID&apos;,
            &apos;refClass&apos; =&amp;gt; &apos;TXCRDataNodeCRDataNode&apos;));
    }
}

$dn = Doctrine_Core::getTable(&apos;TCRDataNode&apos;)-&amp;gt;find(5300);

?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;.. and then when I ..&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-javascript&quot;&gt;&amp;lt;?php

$pn = $dn-&amp;gt;parentNodes;

?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;.. it goes like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice: Undefined index: crdatanode in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 288&lt;/p&gt;

&lt;p&gt;Notice: Undefined index: in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 289&lt;/p&gt;

&lt;p&gt;Fatal error: Call to a member function getFieldName() on a non-object in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 290&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Using Doctrine 1.2.2&lt;/p&gt;

&lt;p&gt;It seemed like the same thing as presented in the &lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_2/en/defining-models:relationships:join-table-associations:self-referencing-nest-relations#non-equal-nest-relations&quot; class=&quot;external-link&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="15331" author="kweij" created="Thu, 17 Feb 2011 09:34:20 +0000"  >&lt;p&gt;This aching issue - as I traced the cord back to the wall - appears to originate from the fact that I use UPPERCASES in the names of my databas tables. When I user all lowercases: no problem. Hence it worked on my WAMP server (Windows just lowercases it all). Even when I so much as start the entity-table which an UPPERCASE: bang! Fatal error.&lt;/p&gt;

&lt;p&gt;This is not logical and, I presume, is a definite bug.&lt;/p&gt;

&lt;p&gt;Please, oh please fix this ..&lt;/p&gt;</comment>
                    <comment id="17528" author="dannykopping" created="Tue, 6 Mar 2012 08:39:37 +0000"  >&lt;p&gt;As Klaas mentions, this function incorrectly assumes that all databases will be named using lowercase letters.&lt;/p&gt;

&lt;p&gt;The problem arises in the following line:&lt;br/&gt;
$cache&lt;span class=&quot;error&quot;&gt;&amp;#91;$key&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;dqlAlias&amp;#39;&amp;#93;&lt;/span&gt; = $this-&amp;gt;_tableAliases&lt;span class=&quot;error&quot;&gt;&amp;#91;strtolower(implode(&amp;#39;__&amp;#39;, $e))&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;If one removes the &quot;strtolower&quot; function call, it will work for tables named with uppercase letters, but this is obviously quite an inelegant solution.&lt;/p&gt;

&lt;p&gt;Could you suggest an alternative solution? I&apos;ll be happy to make the change, test it and issue a pull request in GitHub&lt;/p&gt;</comment>
                    <comment id="17529" author="dannykopping" created="Tue, 6 Mar 2012 13:01:44 +0000"  >&lt;p&gt;I&apos;ve just tested this scenario in as many different possible combinations as I could think of (all tables uppercase/PascalCase, all tables lowercase, some Pascal, some lowercase) and just by removing the &quot;strtolower&quot; function, the issue seems to be resolved.&lt;/p&gt;</comment>
                    <comment id="19333" author="jklehr" created="Thu, 17 Jan 2013 01:16:07 +0000"  >&lt;p&gt;We&apos;ve encountered this as well, tried a lot of different things in our models/schema to get around it, but nothing worked.&lt;/p&gt;

&lt;p&gt;Made a test case here: &lt;a href=&quot;https://github.com/diablomedia/doctrine1/blob/master/tests/Ticket/DC356TestCase.php&quot; class=&quot;external-link&quot;&gt;https://github.com/diablomedia/doctrine1/blob/master/tests/Ticket/DC356TestCase.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Modified the doctrine core as suggested by Danny, but this change causes other Doctrine test to fail (Particularly tests/TableTestCase.php).&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-357] setting &quot;Doctrine_Core::ATTR_EXPORT&quot; to &quot;Doctrine_Core::EXPORT_TABLES&quot; prevents i18n table creation</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-357</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When I try to prevent foreign key creation (because I am using a mix of MyISAM and InnoDB tables) using the given attribute, I notice that all the translation tables are also not getting created.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10610">DC-357</key>
            <summary>setting &quot;Doctrine_Core::ATTR_EXPORT&quot; to &quot;Doctrine_Core::EXPORT_TABLES&quot; prevents i18n table creation</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="lsmith">Lukas Kahwe</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Dec 2009 14:21:17 +0000</created>
                <updated>Mon, 14 Dec 2009 16:51:11 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Cli</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11185" author="jwage" created="Mon, 14 Dec 2009 16:47:11 +0000"  >&lt;p&gt;You can use the bit operator with this attribute.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#exporting&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_2/en/configuration#exporting&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="11186" author="lsmith" created="Mon, 14 Dec 2009 16:51:11 +0000"  >&lt;p&gt;in that case the bug is bogus .. however the docs should probably make it clear that there are other export modes available, then illustrated atm.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-359] concrete inheritance doesn&apos;t create all relations</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-359</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;This is the YML schema&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;Entity:
  actAs:
    Timestampable:
  columns:
    id:
      type: integer(11)
      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;
    name: string(50)
  relations:
    DynamicFields:
      class: DynamicField
      local: id
      foreign: dynamic_field_id
      refClass: EntityDynamicFields

DynamicField:
  actAs:
    I18n:
      fields: [name_xml]
  columns:
    id:
      type: integer(11)
      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;
    name_xml: 
      type: string(50)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    Entities:
      class: Entity
      local: dynamic_field_id
      foreign: id
      refClass: EntityDynamicFields

EntityDynamicFields:
  actAs:
    I18n:
      fields: [value_xml]
  columns:
    id:
      type: integer(11)
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    dynamic_field_id:
      type: integer(11)
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    value_xml: string(250)

Airline:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Bank:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Client:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Employe:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Host:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Partner:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Person:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

Supplier:
  inheritance:
    &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt;: Entity
    type: concrete

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

&lt;p&gt;I run the commands &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 build-all
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and&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 rebuild-db
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem is when I verify if the foreign keys are created, but&lt;br/&gt;
these were only created for the &quot;client&quot; and &quot;employee&quot; models, to&lt;br/&gt;
&quot;host&quot; does not create the relationship in the MySQL, but if I rename&lt;br/&gt;
&quot;host&quot; with a name like &quot;Ent&quot;, the relationship is established, or if I rename &lt;br/&gt;
the parent model &quot;Entity&quot; to &quot;Zzzzz&quot;, all relations are created.&lt;/p&gt;

&lt;p&gt;I did several tests, and the only way that the relation is created, is&lt;br/&gt;
that the model name, is alphabetically sorted before the parent model name. &lt;/p&gt;

&lt;p&gt;This is a part of the dump of MySQL&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;ALTER TABLE `entity_dynamic_fields`
  ADD CONSTRAINT `entity_dynamic_fields_dynamic_field_id_dynamic_field_id` FOREIGN KEY (`dynamic_field_id`) REFERENCES `dynamic_field` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_airline_id` FOREIGN KEY (`id`) REFERENCES `airline` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_bank_id` FOREIGN KEY (`id`) REFERENCES `bank` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_client_id` FOREIGN KEY (`id`) REFERENCES `client` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_employe_id` FOREIGN KEY (`id`) REFERENCES `employe` (`id`),
  ADD CONSTRAINT `entity_dynamic_fields_id_entity_id` FOREIGN KEY (`id`) REFERENCES `entity` (`id`);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The other foreign keys are missed&lt;/p&gt;

&lt;p&gt;you can view the diagram EER created with reverse engineering of MySQL Workbench &lt;br/&gt;
&lt;a id=&quot;10236_thumb&quot; href=&quot;http://www.doctrine-project.org/jira/secure/attachment/10236/10236_Picture+1.png&quot; title=&quot;Picture 1.png&quot;&gt;&lt;img src=&quot;http://www.doctrine-project.org/jira/secure/thumbnail/10236/_thumb_10236.png&quot; align=&quot;absmiddle&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description>
                <environment>PHP 5.2.11 (cli) (built: Oct  5 2009 21:36:09) &lt;br/&gt;
Copyright (c) 1997-2009 The PHP Group&lt;br/&gt;
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans&lt;br/&gt;
&lt;br/&gt;
Server version: Apache/2.2.13 (Unix)&lt;br/&gt;
&lt;br/&gt;
Server version: 5.1.38-log MySQL Community Server (GPL)</environment>
            <key id="10615">DC-359</key>
            <summary>concrete inheritance doesn&apos;t create all relations</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jvega">Juan Vega</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Dec 2009 22:20:46 +0000</created>
                <updated>Wed, 16 Dec 2009 19:42:00 +0000</updated>
                                    <version>1.2.0</version>
                <version>1.2.1</version>
                                                <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11190" author="jvega" created="Tue, 15 Dec 2009 19:42:57 +0000"  >&lt;p&gt;I know where is the problem, in Doctrine_Core::loadModels the list of models returned are alphabetically sorted, if I can rearrange the array by inheritance, the foreign keys for the models (&apos;host&apos; &apos;partner&apos; &apos;person&apos; &apos;supplier&apos;) are created.&lt;/p&gt;

&lt;p&gt;more explicity:&lt;/p&gt;

&lt;p&gt;I have 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;Array
(
    [0] =&amp;gt; Airline
    [1] =&amp;gt; Bank
    [2] =&amp;gt; Client
    [3] =&amp;gt; DynamicField
    [4] =&amp;gt; Employe
    [5] =&amp;gt; Entity
    [6] =&amp;gt; EntityDynamicFields
    [7] =&amp;gt; Host
    [8] =&amp;gt; Partner
    [9] =&amp;gt; Person
    [10] =&amp;gt; Supplier
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I need 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;Array
(
    [0] =&amp;gt; Entity
    [1] =&amp;gt; Airline
    [2] =&amp;gt; Bank
    [3] =&amp;gt; Client
    [4] =&amp;gt; Employe
    [5] =&amp;gt; Host
    [6] =&amp;gt; Partner
    [7] =&amp;gt; Person
    [8] =&amp;gt; Supplier
    [9] =&amp;gt; DynamicField
    [10] =&amp;gt; EntityDynamicFields
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="11207" author="jvega" created="Wed, 16 Dec 2009 19:42:00 +0000"  >&lt;p&gt;ok, this is my patch to rearrange the models loaded, this array puts the child models before the parents&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10237" name="fix-dc-359.diff" size="1210" author="jvega" created="Wed, 16 Dec 2009 19:42:00 +0000" />
                    <attachment id="10236" name="Picture 1.png" size="94239" author="jvega" created="Mon, 14 Dec 2009 22:20:46 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-362] Doctrine fails to create correct table structure if model is named &quot;User&quot;</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-362</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When building models and database structure from YAML schema, Doctrine ignores the behaviors and relations on models if it is named &quot;User&quot;:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;...

User:  
  actAs:
    Timestampable:
    Sluggable:
      unique: true
      fields: username
      canUpdate: true
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    company_id
      type: integer(4)
    timezone_id:
      type: integer(1)
    role_id:
      type: integer(1)
    email:
      type: string(255)
    username:
      type: string(255)
      unique: true
    password:
      type: string(40)
    firstname:
      type: string(255)
    lastname:
      type: string(255)
    last_login:
      type: datetime
  relations:
    Company:
      local: company_id
      foreign: id
    Timezone:
      local: timezone_id
      foreign: id
    Role:
      local: role_id
      foreign: id

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

&lt;p&gt;This creates the following table structure:&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;CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) DEFAULT NULL,
  `timezone_id` tinyint(4) DEFAULT NULL,
  `role_id` tinyint(4) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `password` varchar(40) DEFAULT NULL,
  `firstname` varchar(255) DEFAULT NULL,
  `lastname` varchar(255) DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The table structure is both missing foreign key constraints to Company, Timezone and Role. It is also missing columns &lt;tt&gt;updated_at&lt;/tt&gt; and &lt;tt&gt;created_at&lt;/tt&gt; for Timestampable behavior. The &lt;tt&gt;slug&lt;/tt&gt; column for Sluggable behavior is missing, as well.&lt;/p&gt;

&lt;p&gt;When looking at the BaseUser::setUp() method it looks as it is supposed 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-none&quot;&gt;class BaseUser extends Doctrine_Record
{

    ....

    public function setUp()
    {
        parent::setUp();
        $this-&amp;gt;hasOne(&apos;Company&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;company_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $this-&amp;gt;hasOne(&apos;Timezone&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;timezone_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $this-&amp;gt;hasOne(&apos;Role&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;role_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $sluggable0 = new Doctrine_Template_Sluggable(array(
             &apos;unique&apos; =&amp;gt; true,
             &apos;fields&apos; =&amp;gt; &apos;username&apos;,
             &apos;canUpdate&apos; =&amp;gt; true,
        ));
        $this-&amp;gt;actAs($timestampable0);
        $this-&amp;gt;actAs($sluggable0);
    }

    ....

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

&lt;p&gt;So the only area where it goes wrong, is when generating the queries for creating the model tables. I don&apos;t know if the same problem appears with other model names, but it doesn&apos;t like models named &quot;User&quot;.&lt;/p&gt;

&lt;p&gt;If I rename the model to &quot;Person&quot; and rebuild, it all works perfectly as it should.&lt;/p&gt;</description>
                <environment>Mac OS X 10.6.2 (10C540) (Snow Leopard) with MAMP 1.8 bundle: &lt;br/&gt;
PHP Version: 5.2.10,&lt;br/&gt;
MySQL Version: 5.1.37&lt;br/&gt;
</environment>
            <key id="10623">DC-362</key>
            <summary>Doctrine fails to create correct table structure if model is named &quot;User&quot;</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="michenriksen">Michael Henriksen</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Dec 2009 13:59:26 +0000</created>
                <updated>Fri, 8 Jan 2010 20:31:09 +0000</updated>
                                    <version>1.2.0-RC1</version>
                                                <component>Behaviors</component>
                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11201" author="michenriksen" created="Wed, 16 Dec 2009 14:04:39 +0000"  >&lt;p&gt;Forgot to mention, that it works perfectly when renaming model to something else than &quot;User&quot;&lt;/p&gt;</comment>
                    <comment id="11357" author="neographikal" created="Fri, 8 Jan 2010 20:31:09 +0000"  >&lt;p&gt;Have the same problem in 1.2.1 at PostgreSQL 8.4&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-368] createTablesFromModels() wants to create already existing FOREIGN KEY constraints</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-368</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If you create InnoDB tables from a given model directory, the table generator wants to create a foreign key constraint that already exists.&lt;/p&gt;

&lt;p&gt;1. Doctrine_Core::generateModelsFromYaml(&apos;yaml&apos;, &apos;models&apos;);&lt;br/&gt;
2. Doctrine_Core::createTablesFromModels(&apos;models&apos;);&lt;br/&gt;
3. Running this setup twice, will print out the following error:&lt;/p&gt;

&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;HY000&amp;#93;&lt;/span&gt;: General error: 1005 Can&apos;t create table &apos;./dev_mreiche/#sql-930_2cb7.frm&apos; (errno: 121). Failing Query: &quot;ALTER TABLE group_user ADD CONSTRAINT group_user_user_id_user_id FOREIGN KEY (user_id) REFERENCES user(id)&quot;. Failing Query: ALTER TABLE group_user ADD CONSTRAINT group_user_user_id_user_id FOREIGN KEY (user_id) REFERENCES user(id)&lt;/p&gt;</description>
                <environment>mysql  Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486) using readline 5.2&lt;br/&gt;
PHP 5.2.11-0.dotdeb.1 with Suhosin-Patch 0.9.7 (cli) (built: Sep 20 2009 09:41:43)&lt;br/&gt;
Ubuntu 9.04&lt;br/&gt;
</environment>
            <key id="10632">DC-368</key>
            <summary>createTablesFromModels() wants to create already existing FOREIGN KEY constraints</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mreiche">Mike Reiche</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 Dec 2009 13:35:19 +0000</created>
                <updated>Tue, 24 Aug 2010 04:32:21 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="11228" author="mreiche" created="Fri, 18 Dec 2009 13:38:50 +0000"  >&lt;p&gt;Moved model and setup code from description to attachment.&lt;/p&gt;</comment>
                    <comment id="11636" author="m.olszewski" created="Tue, 9 Feb 2010 08:53:02 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Just a quick comment - the test case you&apos;ve provided works fine for me using 1.2.1 and also latest code from 1.2 branch... you might try that.&lt;/p&gt;

&lt;p&gt;The error above (1005) is caused by mismatch between local and foreign key definitions. So it seems somewhere along the lines you/Doctrine messed up field definitions (although I can&apos;t see it provided test case). Try using integer without length definition in YAML, like:&lt;/p&gt;

&lt;p&gt;id:&lt;br/&gt;
      type: integer&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
      primary: true&lt;/p&gt;

&lt;p&gt;and check if this is working.&lt;/p&gt;</comment>
                    <comment id="11886" author="ppw8bnh3jy2a" created="Mon, 1 Mar 2010 14:44:47 +0000"  >&lt;p&gt;I&apos;m having the same issue.  However, I&apos;ve tried the test case using a sqlite memory only database and i can&apos;t trigger the problem.&lt;/p&gt;

&lt;p&gt;Here&apos;s my mysql schema, for your review - which does trigger the issue using 1.2.1.&lt;/p&gt;

</comment>
                    <comment id="11887" author="ppw8bnh3jy2a" created="Mon, 1 Mar 2010 14:48:51 +0000"  >&lt;p&gt;I put some debugging statements in Doctrine/Export.php around line 1216:&lt;br/&gt;
------------&lt;br/&gt;
                      $connection-&amp;gt;exec($query);&lt;br/&gt;
                  } catch (Doctrine_Connection_Exception $e) {&lt;br/&gt;
                      // we only want to silence table already exists errors&lt;br/&gt;
+                     print_r($e-&amp;gt;getPortableCode());&lt;br/&gt;
+                     print_r(Doctrine_Core::ERR_ALREADY_EXISTS);&lt;br/&gt;
+                     print_r($e-&amp;gt;getMessage());&lt;br/&gt;
+                     echo &quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&quot;;&lt;br/&gt;
+//                                  exit;&lt;br/&gt;
+&lt;br/&gt;
+                     &lt;br/&gt;
                      if ($e-&amp;gt;getPortableCode() !== Doctrine_Core::ERR_ALREADY_EXISTS) {&lt;br/&gt;
                          $connection-&amp;gt;rollback();&lt;/p&gt;

&lt;p&gt;----------------------&lt;/p&gt;


&lt;p&gt;Here&apos;s the output I get:&lt;/p&gt;

&lt;p&gt;-5-5SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S01&amp;#93;&lt;/span&gt;: Base table or view already exists: 1050 Table &apos;category&apos; already exists. Failing Query: &quot;CREATE TABLE category (id BIGINT AUTO_INCREMENT, name VARCHAR(80), company_id BIGINT, INDEX company_id_idx (company_id), PRIMARY KEY(id)) ENGINE = INNODB&quot;&lt;/p&gt;

&lt;p&gt;-5-5SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S01&amp;#93;&lt;/span&gt;: Base table or view already exists: 1050 Table &apos;company&apos; already exists. Failing Query: &quot;CREATE TABLE company (id BIGINT AUTO_INCREMENT, name VARCHAR(80) UNIQUE, address1 VARCHAR(80), address2 VARCHAR(80), city VARCHAR(80), state VARCHAR(10), zipcode VARCHAR(20), phone VARCHAR(20), fax VARCHAR(20), url VARCHAR(255), logo VARCHAR(255), perferedcolumn BIGINT, randomsort BIGINT, comment LONGTEXT, PRIMARY KEY(id)) ENGINE = INNODB&quot;&lt;/p&gt;

&lt;p&gt;-5-5SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S01&amp;#93;&lt;/span&gt;: Base table or view already exists: 1050 Table &apos;user&apos; already exists. Failing Query: &quot;CREATE TABLE user (email VARCHAR(255), password VARCHAR(80), fullname VARCHAR(80), company_id BIGINT, cellphone VARCHAR(20), voice VARCHAR(20), voiceext VARCHAR(20), fax VARCHAR(20), comment LONGTEXT, status TINYINT(1), admin TINYINT(1), timeadded DATETIME, timechagned DATETIME, INDEX company_id_idx (company_id), PRIMARY KEY(email)) ENGINE = INNODB&quot;&lt;/p&gt;

&lt;p&gt;-15-5SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;HY000&amp;#93;&lt;/span&gt;: General error: 1005 Can&apos;t create table &apos;./iprfpartners/#sql-7eeb_2d8.frm&apos; (errno: 121). Failing Query: &quot;ALTER TABLE category ADD CONSTRAINT category_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id)&quot;&lt;/p&gt;

</comment>
                    <comment id="14037" author="aristondarmayuda" created="Mon, 23 Aug 2010 16:12:37 +0000"  >&lt;p&gt;I have same problem, but this problem is face on db engine side. When we look at the last query sql like:&lt;/p&gt;

&lt;p&gt;ALTER TABLE category ADD CONSTRAINT category_company_id_company_id FOREIGN KEY (company_id) REFERENCES company(id)&lt;/p&gt;

&lt;p&gt;The first call of createTablesFromModels will create the table and add contraint which run fine because table and constraint not exist yet. Then when we execute createTablesFromModels again it will fail because it still try to create constraint which already exist on table. I&apos;m still looking on MySql section how to check the constrain if it exist or not. If the constraint not exist then we can execute the sql above, if not we need to avoid execution for sql above, this mean we cannot MODIFY the constrain (like ON UPDATE and ON DELETE mode).&lt;/p&gt;</comment>
                    <comment id="14044" author="aristondarmayuda" created="Tue, 24 Aug 2010 04:29:52 +0000"  >&lt;p&gt;I&apos;ve figure out the errorno: 121 which I thinking is that the process try re-adding existing CONSTRAINT name. The resolve that I&apos;ve found is for MySQL engine and modify some Doctrine libraries.&lt;/p&gt;

&lt;p&gt;1. I&apos;ve modify Doctrine_Export_Mysql by adding override function of:&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 createForeignKeySql($table, array $definition)
{
    $tableInfo = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;execute(&apos;SHOW CREATE TABLE &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;quoteIdentifier($table));
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($tableInfo &amp;amp;&amp;amp; ($row = $tableInfo-&amp;gt;fetch()))
      &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($row[&apos;Create Table&apos;] &amp;amp;&amp;amp; preg_match(&apos;/CONSTRAINT `&apos;.$definition[&apos;name&apos;].&apos;`.+/i&apos;, $row[&apos;Create Table&apos;])) &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;&apos;;
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; parent::createForeignKeySql($table, $definition);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2. Since if CONSTRAINT already exist the createForeignKeySql return empty string, we need modify function on Doctrine_Export with:&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 createForeignKey($table, array $definition)
{
    $sql = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createForeignKeySql($table, $definition);
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($sql != &apos;&apos;)
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;execute($sql);
    &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -1;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now by add/modify function above I can savely run createTablesFromModels because if CONSTRAINT of a table exist on database the ALTER TABLE ... ADD CONSTRAINT will not generated. Hope this can help some of you guys.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10404" name="schema.txt" size="4059" author="ppw8bnh3jy2a" created="Mon, 1 Mar 2010 14:44:47 +0000" />
                    <attachment id="10239" name="testcase.zip" size="723" author="mreiche" created="Fri, 18 Dec 2009 13:38:50 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-370] Doctrine serializes arrays, objects, etc. like &apos;string&apos;, which is never bigger than a TEXT, limited to 65535 characters (in MySQL)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-370</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine supports storing objects and arrays, and implements this via serialize().&lt;/p&gt;

&lt;p&gt;However in DataDict/Mysql they are handled like the &apos;string&apos; type, which means they are subject to the rules there that ensure nothing bigger than a &apos;TEXT&apos; is ever used to represent them.&lt;/p&gt;

&lt;p&gt;TEXT is not a great choice for objects and arrays because it&apos;s difficult to ensure they will not exceed 65,535 bytes in size.&lt;/p&gt;

&lt;p&gt;This would be most easily fixed by moving them to the next block of case statements there, used for CLOBs. The logic there already picks suitable large types (MEDIUMTEXT and LONGTEXT) as needed, and defaults to LONGTEXT which is a good choice for objects and arrays.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10635">DC-370</key>
            <summary>Doctrine serializes arrays, objects, etc. like &apos;string&apos;, which is never bigger than a TEXT, limited to 65535 characters (in MySQL)</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="boutell">Tom Boutell</reporter>
                        <labels>
                    </labels>
                <created>Sat, 19 Dec 2009 19:50:20 +0000</created>
                <updated>Fri, 29 Jan 2010 12:57:17 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11518" author="hobodave" created="Fri, 29 Jan 2010 03:37:42 +0000"  >&lt;p&gt;Array and Object data types now behave identically to clob.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;http://trac.doctrine-project.org/changeset/7077&quot; class=&quot;external-link&quot;&gt;r7077&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="11523" author="boutell" created="Fri, 29 Jan 2010 12:57:17 +0000"  >&lt;p&gt;Thanks David!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-372] I18n record generator assumes relation alias is the table name</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-372</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In Doctrine/I18n.php, method setTableDefinition, line 108:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;        foreach($relations as $table =&amp;gt; $relation) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But the $relations array key is not a table name, but a relation alias.&lt;/p&gt;

&lt;p&gt;So currently the generator assumes the relation alias IS the table name.&lt;br/&gt;
When it&apos;s not true, the I18n table definition fails.&lt;/p&gt;</description>
                <environment>latest symfony 1.4 SVN.</environment>
            <key id="10637">DC-372</key>
            <summary>I18n record generator assumes relation alias is the 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ornicar">thibault duplessis</reporter>
                        <labels>
                    </labels>
                <created>Sun, 20 Dec 2009 14:03:24 +0000</created>
                <updated>Sun, 20 Dec 2009 14:03:24 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>I18n</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-373] Relating to Translation table (generated by Doctrine_I18n) doesn&apos;t work correctly after resetting connection</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-373</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Relating to Translation table (generated by Doctrine_I18n) doesn&apos;t work correctly after resetting connection.&lt;/p&gt;

&lt;p&gt;First, I defined the following 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-none&quot;&gt; 
  Example:
    actAs:
      I18n:
        fields: [title]
    columns:
        title: string(128)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next, I prepared the following fixture &lt;a href=&quot;file::&quot; class=&quot;external-link&quot;&gt;file::&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-none&quot;&gt; 
  Example:
    Example_1:
      Translation:
        en:
          title: &quot;Title&quot;
        ja:
          title: &quot;&#38988;&#21517;&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next, I run &quot;build-all-reload&quot; task. The table was created and data was loaded.&lt;/p&gt;

&lt;p&gt;And I write the following 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; 
  Doctrine_Core::loadModels(&apos;models&apos;);
  $example = Doctrine_Core::getTable(&apos;Example&apos;)-&amp;gt;find(1);
  
  var_dump(
    $example-&amp;gt;Translation[&apos;en&apos;]-&amp;gt;title,
    $example-&amp;gt;Translation[&apos;ja&apos;]-&amp;gt;title
  );
  
  Doctrine_Manager::resetInstance();
  Doctrine_Manager::getInstance()-&amp;gt;openConnection(DSN, &apos;doctrine&apos;);
  
  $example2 = Doctrine_Core::getTable(&apos;Example&apos;)-&amp;gt;find(1);
  var_dump(
    $example2-&amp;gt;Translation[&apos;en&apos;]-&amp;gt;title,
    $example2-&amp;gt;Translation[&apos;ja&apos;]-&amp;gt;title
  );
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I try executing my code, but I got the following error::&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;  string(5) &quot;Title&quot;
  string(6) &quot;&#38988;&#21517;&quot;
  
  Doctrine_Connection_Mysql_Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column &apos;e.title&apos; in &apos;field list&apos; in /path/to/doctrine/Doctrine/Connection.php on line 1082
  
  Call Stack:
      0.0055      65352   1. {main}() /path/to/my/code/test.php:0
      0.2776    5873388   2. Doctrine_Table-&amp;gt;find() /path/to/my/code/test.php:52
      0.2793    5881152   3. Doctrine_Query-&amp;gt;fetchOne() /path/to/doctrine/Doctrine/Table.php:1611
      0.2793    5881296   4. Doctrine_Query_Abstract-&amp;gt;execute() /path/to/doctrine/Doctrine/Query.php:281
      0.2793    5881892   5. Doctrine_Query_Abstract-&amp;gt;_execute() /path/to/doctrine/Doctrine/Query/Abstract.php:1026
      0.3127    5890712   6. Doctrine_Connection-&amp;gt;execute() /path/to/doctrine/Doctrine/Query/Abstract.php:976
      0.3164    5892632   7. Doctrine_Connection_Statement-&amp;gt;execute() /path/to/doctrine/Doctrine/Connection.php:1006
      0.3181    5907408   8. Doctrine_Connection-&amp;gt;rethrowException() /path/to/doctrine/Doctrine/Connection/Statement.php:269
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.2.11 (with Suhosin-Patch 0.9.7)&lt;br/&gt;
PHP 5.3.6</environment>
            <key id="10638">DC-373</key>
            <summary>Relating to Translation table (generated by Doctrine_I18n) doesn&apos;t work correctly after resetting connection</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="co3k">Kousuke Ebihara</reporter>
                        <labels>
                    </labels>
                <created>Sun, 20 Dec 2009 22:54:24 +0000</created>
                <updated>Tue, 11 Sep 2012 13:16:23 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                <version>1.2.4</version>
                                                <component>Connection</component>
                <component>I18n</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="14659" author="arnaud.charlier@gmail.com" created="Tue, 2 Nov 2010 04:55:46 +0000"  >&lt;p&gt;Good Morning,&lt;/p&gt;

&lt;p&gt;First, thanks a lot for your work on Doctrine. It&apos;s a real great tool we love to use.&lt;/p&gt;

&lt;p&gt;Currently in one of our big application we have exactly the same issue.&lt;br/&gt;
It seems when we close the connection, the reference with the objectTranslation is lost.&lt;br/&gt;
Re-open the connection seems not able to reinstantiate this Translation link to the objectTranslation.&lt;/p&gt;

&lt;p&gt;Currently we have no solution, but we are still investigating this.&lt;/p&gt;

&lt;p&gt;I&apos;m available to go deep in the code with you, but any Doctrine Team help will be really nice.&lt;/p&gt;

&lt;p&gt;Thanks to let me know as soon as possible.&lt;/p&gt;

&lt;p&gt;Arnaud&lt;/p&gt;</comment>
                    <comment id="15891" author="jsiponen" created="Fri, 27 May 2011 14:51:51 +0000"  >&lt;p&gt;I&apos;ve just now battled with the very same problem in Doctrine 1.2 (the version bundled with symfony 1.4) and the problem seems to be caused by the fact that Doctrine_Record_Generator simply isn&apos;t written such that it is able to reinitialize generators for unloaded table instances after a connection is closed.  This problem also manifests itself after a table has been loaded in a connection and one tries retrieve a table again after Doctrine_Connection-&amp;gt;evictTables() has been called. This makes it impossible to to open more than one connection at a time in a request/script when using behaviors that dynamically modify table instances (such as the i18n behavior).&lt;/p&gt;

&lt;p&gt;Doctrine_Record_Generator determines if it needs to run its initialization methods simply by checking if the to-be generated class, as defined by the className option, exists using a class_exists call. This means that the first time this method is called the initialization happens but for every subsequent call no initialization is made. Now, in the i18m behavior, the important initialization happens in its setTableDefinition method in which it removes any of the translated fields from the table instance that is been setup and redefines them as relations on the to-be-created Translation class. It then finishes off by dynamically declaring the new class for the translation record using its generateClassFromTable method.&lt;/p&gt;

&lt;p&gt;Thus, the first time everything goes smoothly and the i18n generator&apos;s setTableDefinition is called and the table instance is properly initialized. Everything will now work as expected while the current connection is open since the connection instance keeps the i18n modified table instances alive and well for callers.&lt;/p&gt;

&lt;p&gt;But, when the current connection is closed the i18n modified table instances it holds are also removed (goes out of scope). Then, when a new connection is opened, this new connection will start without having any table instances. This means that the next time one asks the new connection for a table instance of the same class with the i18n behavior the i18n behaviors will fail to initialize because the generator at this time believes its class has actually been initialized which, in turn, means that the table using the i18n behavior isn&apos;t properly initialized. No initialization means that this table will now include the non-existant i18n fields in the select part of its queries (those are in the translation table) causing those queries to fail miserably.&lt;/p&gt;

&lt;p&gt;I believe this could be fixed by adding a static attribute to Doctrine_Record_Generator that tracks the spl_object_hash of the underlying dbh instance variable of the doctrine connection of the table parameter. If the hash is the same the next time that the initialize method is called the generator can decide not to reinitialize itself but if it detects that the hash of the current connection is different then that is definitely a clue to the generator that it needs to reinitialize itself (i.e. run all of the initialization methods but generateClassFromTable which should&apos;t be called more than once).&lt;/p&gt;

&lt;p&gt;Maybe do it like this perhaps:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract
{
  public function initialize(Doctrine_Table $table)
  {
    /* ... */ 
  
    $currentConnectionHash = spl_object_hash($table-&amp;gt;getConnection()-&amp;gt;getDbh());
    
    //Next part is called if this is the first connection made or if this is a new open connection with new table instances
    if ($currentConnectionHash != self::$lastConnectionHash)
    {
      self::$lastConnectionHash = $currentConnectionHash;
      
      $this-&amp;gt;buildTable();

      $fk = $this-&amp;gt;buildForeignKeys($this-&amp;gt;_options[&apos;table&apos;]);

      $this-&amp;gt;_table-&amp;gt;setColumns($fk);

      $this-&amp;gt;buildRelation();

      $this-&amp;gt;setTableDefinition();
      $this-&amp;gt;setUp();
      
      if ($this-&amp;gt;_options[&apos;generateFiles&apos;] === false &amp;amp;&amp;amp; class_exists($this-&amp;gt;_options[&apos;className&apos;])) {
        $this-&amp;gt;generateClassFromTable($this-&amp;gt;_table); //Don&apos;t generate the class more than once ever
      }
      
      $this-&amp;gt;buildChildDefinitions();

      $this-&amp;gt;_table-&amp;gt;initIdentifier();
    }
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; </comment>
                    <comment id="16003" author="jsiponen" created="Thu, 16 Jun 2011 20:28:21 +0000"  >&lt;p&gt;Failing test case attached&lt;/p&gt;</comment>
                    <comment id="18060" author="co3k" created="Fri, 8 Jun 2012 07:53:37 +0000"  >&lt;p&gt;Good job, Joe Siponen! Thanks for your nice patch!&lt;/p&gt;

&lt;p&gt;I can&apos;t understand why the Doctrine team discontinued maintenance of Doctrine 1 without any fixes for some serious issues like this problem...&lt;/p&gt;

&lt;p&gt;Joe, would you send your patch by pull-request in GitHub? They might notice this problem and try to fix in official repository by your request. If you cannnot, I will do it as your proxy. (Of course I&apos;m going to describe your credit)&lt;/p&gt;</comment>
                    <comment id="18626" author="co3k" created="Tue, 11 Sep 2012 13:16:23 +0000"  >&lt;p&gt;I&apos;ve tested Joe Siponen&apos;s patch, it would be good in a situation of single connection, but it doesn&apos;t work in multiple connections.&lt;/p&gt;

&lt;p&gt;So I modified your patch to fit my needs. I&apos;m testing my arranged patch and I want to publish it ASAP...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11015" name="DC373TestCase.php" size="6100" author="jsiponen" created="Thu, 16 Jun 2011 20:28:21 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-375] Doctrine_Table getTable singleton issue</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-375</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;first, i defined a table class :&lt;br/&gt;
class CohibaClientTable extends Doctrine_Table&lt;br/&gt;
{&lt;br/&gt;
    public $_pager;&lt;/p&gt;

&lt;p&gt;     public function getAbstractList($arrParam = array(), $page=1, $maxPerPage=20)&lt;br/&gt;
    {&lt;br/&gt;
        $objQuery = $this-&amp;gt;createQuery(&apos;t1&apos;)&lt;br/&gt;
            -&amp;gt;select(&apos;t1.*&apos;);&lt;/p&gt;

&lt;p&gt;        if(is_array($arrParam) &amp;amp;&amp;amp; count($arrParam)&amp;gt;0)&lt;/p&gt;
        {
            QueryAssistant::processOption($objQuery, $arrParam);  // dont set &quot;offset&quot; and &quot;limit&quot; option in it
        }

&lt;p&gt;        $this-&amp;gt;_pager = new Doctrine_Pager($objQuery, $page, $maxPerPage);&lt;/p&gt;

&lt;p&gt;        $items = $this-&amp;gt;_pager-&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;        $objQuery-&amp;gt;free();&lt;br/&gt;
        return $items;&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;    public function getList($page=1, $maxPerPage=20)&lt;/p&gt;
    {
        $arrParam = array(
            &apos;orderBy&apos;=&amp;gt;&apos;t1.cle asc&apos;
        );

        return $this-&amp;gt;getAbstractList($arrParam, $page, $maxPerPage);
    }

&lt;p&gt;    public function getPager()&lt;/p&gt;
    {
        return $this-&amp;gt;_pager;
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;and then, in the action, invoke it like this codes:&lt;br/&gt;
1&amp;gt;&lt;br/&gt;
   $items = Doctrine::getTable(&quot;CohibaClient&quot;)-&amp;gt;getList(1, $maxPerPage);&lt;br/&gt;
    $pager = Doctrine::getTable(&quot;CohibaClient&quot;)-&amp;gt;getPager();&lt;/p&gt;

&lt;p&gt;    $this-&amp;gt;log(&quot;total records: &quot;.$pager-&amp;gt;getNumResults().&quot; total page: &quot;.$pager-&amp;gt;getLastPage().&quot;\n&quot;);&lt;br/&gt;
    $lastPage = $pager-&amp;gt;getLastPage();&lt;br/&gt;
2&amp;gt;&lt;br/&gt;
   $table = Doctrine::getTable(&quot;CohibaClient&quot;);&lt;br/&gt;
   $items = $table-&amp;gt;getList(1, $maxPerPage);&lt;br/&gt;
   $pager = $table-&amp;gt;getPager();&lt;/p&gt;

&lt;p&gt;   $this-&amp;gt;log(&quot;total records: &quot;.$pager-&amp;gt;getNumResults().&quot; total page: &quot;.$pager-&amp;gt;getLastPage().&quot;\n&quot;);&lt;br/&gt;
   $lastPage = $pager-&amp;gt;getLastPage();&lt;/p&gt;

&lt;p&gt;#2 works, but not #1, error is &quot;Fatal error: Call to a member function getNumResults() on a non-object in.... &quot; is it an issue when singleton generation?&lt;/p&gt;</description>
                <environment>symfony 1.2.9</environment>
            <key id="10644">DC-375</key>
            <summary>Doctrine_Table getTable singleton issue</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bennybi">ben bi</reporter>
                        <labels>
                    </labels>
                <created>Tue, 22 Dec 2009 02:46:16 +0000</created>
                <updated>Tue, 22 Dec 2009 06:59:07 +0000</updated>
                                    <version>1.0.14</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-379] No description of ATTR_DEFAULT_IDENTIFIER_OPTIONS now in &quot;Chapter 4 Configuration&quot;</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-379</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In the previous (1.1) documentation version there were small but useful description about how to set up primary key (&lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_1/en/configuration#defaults-attributes:default-added-auto-id&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_1/en/configuration#defaults-attributes:default-added-auto-id&lt;/a&gt;)&lt;br/&gt;
Now there is nothing about ATTR_DEFAULT_IDENTIFIER_OPTIONS and it takes about 20 minutes to debug and find out where did &quot;id&quot; field added&lt;/p&gt;

&lt;p&gt;ps: message &quot;If you find a problem with the documentation or have a suggestion, please register and open a ticket. &quot; in the bottom of the docs pages is ambiguous due to it points to trac :-$&lt;/p&gt;</description>
                <environment></environment>
            <key id="10652">DC-379</key>
            <summary>No description of ATTR_DEFAULT_IDENTIFIER_OPTIONS now in &quot;Chapter 4 Configuration&quot;</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="zerkms">zerkms</reporter>
                        <labels>
                    </labels>
                <created>Wed, 23 Dec 2009 02:55:04 +0000</created>
                <updated>Wed, 23 Dec 2009 02:55:04 +0000</updated>
                                                                    <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-383] Migrations not respecting ATTR_TBLNAME_FORMAT</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-383</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I am using Doctrine 1.2.1 and Migrations don&apos;t appear to respect Doctrine::ATTR_TBLNAME_FORMAT when creating or dropping tables.  This means while models create/drop tables with prefixes migrations don&apos;t.  Also the migration_version table is created without the prefix too even though it was apparently fixed in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-245&quot; title=&quot;Table name prefix for table migration_version&quot;&gt;&lt;del&gt;DC-245&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I haven&apos;t tested but it also probably means other attributes like Doctrine::ATTR_IDXNAME_FORMAT and Doctrine::ATTR_SEQNAME_FORMAT are not obeyed either which makes things a little confusing knowing when to care for prefixes or not.&lt;/p&gt;</description>
                <environment>Debian 5, Apache 2, PHP 5.2.9, MySQL 5.1</environment>
            <key id="10658">DC-383</key>
            <summary>Migrations not respecting ATTR_TBLNAME_FORMAT</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="drak">Karma Dordrak (Drak)</reporter>
                        <labels>
                    </labels>
                <created>Wed, 23 Dec 2009 13:25:38 +0000</created>
                <updated>Fri, 28 May 2010 06:13:28 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Attributes</component>
                <component>Migrations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13075" author="eman" created="Fri, 28 May 2010 06:13:28 +0000"  >&lt;p&gt;Simple patch to set the table name inside constructor&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10615" name="migration_table_prefix_doctrine_1.2.patch" size="424" author="eman" created="Fri, 28 May 2010 06:13:28 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-386] Doctrine_Hydrator_ArrayDriver may segfault Php when loaded by Zend Framework Autoloader</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-386</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Apache and Php segfault with no error information in the logs and a white screen of death when I use Doctrine 1.2.1 in a Zend Framework controller. &lt;/p&gt;

&lt;p&gt;I&apos;ve traced the problem to line 126 of Zend/Loader/Autoloader.php which only seemed to occur when it autoloaded Doctrine_Hydrator_ArrayDriver during a call to save() in the controller. &lt;/p&gt;

&lt;p&gt;I debugged with xdebug and have attached a simple test controller with no other code. The ZF page works fine when all Doctrine is commented out and a Doctrine test page with the same code but outside of ZF worked fine via Apache as did a CLI script.&lt;/p&gt;

&lt;p&gt;Workaround is to not push Doctrine to Zend Loader in the bootstrap.&lt;/p&gt;

&lt;p&gt;Here is the debug output just before a segfault, the stack and the variable values:&lt;/p&gt;

&lt;p&gt;Remote Launch (stepping)	&lt;br/&gt;
	Library/Zend/Loader/Autoloader.php.Zend_Loader_Autoloader::autoload : lineno 126	&lt;br/&gt;
	Library/Zend/Loader/Autoloader.php.is_subclass_of : lineno 0	&lt;br/&gt;
	Library/Doctrine/Query.php.Doctrine_Query-&amp;gt;processPendingFields : lineno 477	&lt;br/&gt;
	Library/Doctrine/Query.php.Doctrine_Query-&amp;gt;buildSqlQuery : lineno 1213	&lt;br/&gt;
	Library/Doctrine/Query.php.Doctrine_Query-&amp;gt;getSqlQuery : lineno 1122	&lt;br/&gt;
	Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract-&amp;gt;_getDqlCallbackComponents : lineno 1137	&lt;br/&gt;
	Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract-&amp;gt;_preQuery : lineno 1106	&lt;br/&gt;
	Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract-&amp;gt;execute : lineno 1001	&lt;br/&gt;
	Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable-&amp;gt;getUniqueSlug : lineno 207	&lt;br/&gt;
	Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable-&amp;gt;buildSlugFromFields : lineno 120	&lt;br/&gt;
	Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable-&amp;gt;preInsert : lineno 65	&lt;br/&gt;
	Library/Doctrine/Record/Listener/Chain.php.Doctrine_Record_Listener_Chain-&amp;gt;preInsert : lineno 342	&lt;br/&gt;
	Library/Doctrine/Record.php.Doctrine_Record-&amp;gt;invokeSaveHooks : lineno 355	&lt;br/&gt;
	Library/Doctrine/Connection/UnitOfWork.php.Doctrine_Connection_UnitOfWork-&amp;gt;insert : lineno 551	&lt;br/&gt;
	Library/Doctrine/Connection/UnitOfWork.php.Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph : lineno 81	&lt;br/&gt;
	Library/Doctrine/Record.php.Doctrine_Record-&amp;gt;save : lineno 1691	&lt;br/&gt;
	Application/controllers/TestingController.php.TestingController-&amp;gt;indexAction : lineno 20	&lt;br/&gt;
	Library/Zend/Controller/Action.php.Zend_Controller_Action-&amp;gt;dispatch : lineno 513	&lt;br/&gt;
	Library/Zend/Controller/Dispatcher/Standard.php.Zend_Controller_Dispatcher_Standard-&amp;gt;dispatch : lineno 289	&lt;br/&gt;
	Library/Zend/Controller/Front.php.Zend_Controller_Front-&amp;gt;dispatch : lineno 946	&lt;br/&gt;
	Library/Zend/Application/Bootstrap/Bootstrap.php.Zend_Application_Bootstrap_Bootstrap-&amp;gt;run : lineno 77	&lt;br/&gt;
	Application/Bootstrap.php.Bootstrap-&amp;gt;run : lineno 52	&lt;br/&gt;
	Library/Zend/Application.php.Zend_Application-&amp;gt;run : lineno 346	&lt;br/&gt;
	Public/index.php.&lt;/p&gt;
{main}
&lt;p&gt; : lineno 26	&lt;/p&gt;

&lt;p&gt;=&lt;del&gt;=&lt;/del&gt;=&lt;del&gt;=&lt;/del&gt;=-=&lt;/p&gt;

&lt;p&gt;$class	Doctrine_Hydrator_ArrayDriver	&lt;br/&gt;
$object	Zend_Loader_Autoloader	&lt;br/&gt;
	_autoloaders	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
			0	Doctrine	&lt;br/&gt;
			1	autoload	&lt;br/&gt;
	_defaultAutoloader	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Zend_Loader	&lt;br/&gt;
		1	loadClass	&lt;br/&gt;
	_fallbackAutoloader	false	&lt;br/&gt;
	_internalAutoloader	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Zend_Loader_Autoloader	&lt;br/&gt;
		1	_autoload	&lt;br/&gt;
	_namespaces	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;5&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		Zend_	true	&lt;br/&gt;
		ZendX_	true	&lt;br/&gt;
		Lisantra_	true	&lt;br/&gt;
		Persistence_	true	&lt;br/&gt;
		Doctrine_	true	&lt;br/&gt;
	_namespaceAutoloaders	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
			0	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
				0	Doctrine	&lt;br/&gt;
				1	autoload	&lt;br/&gt;
	_suppressNotFoundWarnings	false	&lt;br/&gt;
$self	Zend_Loader_Autoloader	&lt;br/&gt;
	_autoloaders	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
			0	Doctrine	&lt;br/&gt;
			1	autoload	&lt;br/&gt;
	_defaultAutoloader	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Zend_Loader	&lt;br/&gt;
		1	loadClass	&lt;br/&gt;
	_fallbackAutoloader	false	&lt;br/&gt;
	_internalAutoloader	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		0	Zend_Loader_Autoloader	&lt;br/&gt;
		1	_autoload	&lt;br/&gt;
	_namespaces	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;5&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		Zend_	true	&lt;br/&gt;
		ZendX_	true	&lt;br/&gt;
		Lisantra_	true	&lt;br/&gt;
		Persistence_	true	&lt;br/&gt;
		Doctrine_	true	&lt;br/&gt;
	_namespaceAutoloaders	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
		Array &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;	&lt;br/&gt;
			0	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;	&lt;br/&gt;
				0	Doctrine	&lt;br/&gt;
				1	autoload	&lt;br/&gt;
	_suppressNotFoundWarnings	false	&lt;br/&gt;
$method	_autoload	&lt;br/&gt;
$autoloader	Array &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;	&lt;/p&gt;</description>
                <environment>Ubuntu 9.04 fully updated with Apache 2.2.11, Php 5.2.6, Zend Framework 1.9.6, Doctrine 1.2.1</environment>
            <key id="10661">DC-386</key>
            <summary>Doctrine_Hydrator_ArrayDriver may segfault Php when loaded by Zend Framework Autoloader</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="mgatto">Michael Gatto</reporter>
                        <labels>
                    </labels>
                <created>Thu, 24 Dec 2009 23:41:15 +0000</created>
                <updated>Thu, 24 Dec 2009 23:46:23 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10258" name="Doctrine.php" size="6572" author="mgatto" created="Thu, 24 Dec 2009 23:41:15 +0000" />
                    <attachment id="10256" name="doctrine_trace.txt.xt" size="1723114" author="mgatto" created="Thu, 24 Dec 2009 23:41:15 +0000" />
                    <attachment id="10257" name="TestingController.php" size="777" author="mgatto" created="Thu, 24 Dec 2009 23:41:15 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-387] mssql fails on find($key)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-387</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine_Core::getTable(&apos;Project&apos;)-&amp;gt;find($id)&lt;br/&gt;
this kind of expression produces query like &quot;SELECT TOP 1 &lt;span class=&quot;error&quot;&gt;&amp;#91;inner_tbl&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;id&amp;#93;&lt;/span&gt; AS &lt;span class=&quot;error&quot;&gt;&amp;#91;p__id&amp;#93;&lt;/span&gt; FROM (SELECT TOP 1 &lt;span class=&quot;error&quot;&gt;&amp;#91;p&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;id&amp;#93;&lt;/span&gt; AS &lt;span class=&quot;error&quot;&gt;&amp;#91;p__id&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;p&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;name&amp;#93;&lt;/span&gt; AS &lt;span class=&quot;error&quot;&gt;&amp;#91;p__name&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;p&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;description&amp;#93;&lt;/span&gt; AS &lt;span class=&quot;error&quot;&gt;&amp;#91;p__description&amp;#93;&lt;/span&gt; FROM &lt;span class=&quot;error&quot;&gt;&amp;#91;project&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;p&amp;#93;&lt;/span&gt; WHERE (&lt;span class=&quot;error&quot;&gt;&amp;#91;p&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;id&amp;#93;&lt;/span&gt; = ?)) AS &lt;span class=&quot;error&quot;&gt;&amp;#91;inner_tbl&amp;#93;&lt;/span&gt;&quot;&lt;br/&gt;
which fails because there is no &lt;span class=&quot;error&quot;&gt;&amp;#91;inner_tbl&amp;#93;&lt;/span&gt;.&lt;span class=&quot;error&quot;&gt;&amp;#91;id&amp;#93;&lt;/span&gt; &lt;/p&gt;</description>
                <environment></environment>
            <key id="10662">DC-387</key>
            <summary>mssql fails on find($key)</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="zerkms">zerkms</reporter>
                        <labels>
                    </labels>
                <created>Fri, 25 Dec 2009 00:31:21 +0000</created>
                <updated>Tue, 5 Jan 2010 21:37:05 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11330" author="gensisns" created="Tue, 5 Jan 2010 21:37:05 +0000"  >&lt;p&gt;Close as duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-289&quot; title=&quot;Using MSSQL connection the find method for models does not work&quot;&gt;&lt;del&gt;DC-289&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-388] Conservative loading not working</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-388</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Apparently, when setting  Doctrine::MODEL_LOADING_CONSERVATIVE things like Doctrine_Core::createTablesFromModels() don&apos;t work.  Have to enable aggressive model loading.  This has been confirmed on the doctrine-user mailing list.&lt;/p&gt;

&lt;p&gt;I took a brief look at the code: I may be missing something but it appears there may be a logic difference in the conservative vs. aggressive model loading method.  Aggressive loading uses require_once on all files in the model directory and tries to determine the name of the class inside the file (by doing a difference on the loaded classes).  This logic makes sense since the class and file name do not have to match.&lt;/p&gt;

&lt;p&gt;However, conservative loading just tries to calculate the class name and store it in an array for later loading by the autoloader.  This means there is a huge logic difference in behaviour between these two loading methods since the model class files actually must differ depending on case (specifically, the model class file name must follow a specific format to match the actual class name) otherwise the autoload array will never know the correct name of the class.&lt;/p&gt;

&lt;p&gt;I would also like to comment that overall, require_once is a poor choice for performance reasons, it&apos;s vastly slower than include_once, but overall the logic should better be adjusted to use plain include (if possible), for performance reasons.&lt;/p&gt;</description>
                <environment>Apache 2, MySQL 5.1, PHP 5.2.9, Debian 5</environment>
            <key id="10663">DC-388</key>
            <summary>Conservative loading not working</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="drak">Karma Dordrak (Drak)</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Dec 2009 03:00:22 +0000</created>
                <updated>Wed, 27 Jan 2010 23:53:07 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Attributes</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-389] query cache doesn&apos;t cache _isLimitSubqueryUsed</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-389</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The problem is that _isLimitSubqueryUsed is not cached with query cache. &lt;br/&gt;
It gets calculated when building query, but when the query is coming &lt;br/&gt;
from cache it&apos;s not. &lt;br/&gt;
Because of this, line 1087 of Query/Abstract.php is never executed, &lt;br/&gt;
when coming from cache: &lt;br/&gt;
if ($this-&amp;gt;isLimitSubqueryUsed() &amp;amp;&amp;amp; &lt;br/&gt;
    $this-&amp;gt;_conn-&amp;gt;getAttribute(Doctrine::ATTR_DRIVER_NAME) !== &lt;br/&gt;
&apos;mysql&apos;) &lt;/p&gt;
{ 
    $params = array_merge((array) $params, (array) $params); 
} 

Maybe it is on purpose, but I didn&apos;t get any answer on the google-groups.

Here is a diff I use now: 
Index: trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
=================================================================== 
--- a/trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
+++ b/trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
@@ -1286,4 +1286,5 @@ 
         $cached = unserialize($cached); 
         $this-&amp;gt;_tableAliasMap = $cached[2]; 
+        $this-&amp;gt;_isLimitSubqueryUsed = $cached[3]; 
         $customComponent = $cached[0]; 
@@ -1346,5 +1347,5 @@ 
         }
&lt;p&gt; &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;return serialize(array($customComponent, $componentInfo,&lt;br/&gt;
$this-&amp;gt;getTableAliasMap())); &lt;br/&gt;
+        return serialize(array($customComponent, $componentInfo, &lt;br/&gt;
$this-&amp;gt;getTableAliasMap(), $this-&amp;gt;isLimitSubqueryUsed())); &lt;br/&gt;
     }&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>Postgres db, php5.2, linux</environment>
            <key id="10664">DC-389</key>
            <summary>query cache doesn&apos;t cache _isLimitSubqueryUsed</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="szotyi">Peter Kovacs</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Dec 2009 20:53:34 +0000</created>
                <updated>Mon, 27 Jun 2011 18:06:25 +0000</updated>
                                    <version>1.1.5</version>
                <version>1.1.6</version>
                <version>1.2.4</version>
                                                <component>Caching</component>
                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16082" author="grass" created="Mon, 27 Jun 2011 18:06:25 +0000"  >&lt;p&gt;This still seems to be a problem in version 1.2.4, rendering the query cache unusable for our project.&lt;br/&gt;
The suggested fix works fine, and seems to hold litte potential for trouble.&lt;/p&gt;

&lt;p&gt;Anyone still listening/reading here? We are aware of the EOL, but would love to produce a test case to anyone (&quot;official&quot;) trying to fix this - just not sure if it is still worth bothering...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-390] doctrine_cache_keys bigger than 1mb</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-390</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When multiple projects using doctrine use the same memcached server the doctrine_cache_keys can get bigger then 1mb and php will be throwing warnings telling that the data is too big to be stored by memcached.&lt;/p&gt;

&lt;p&gt;I am currently using a workaround, having 1 doctrine_cache_keys per application, on the file Cache/Driver.php i added the following line to the constructor&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$this-&amp;gt;_cacheKeyIndexKey = &apos;doctrine_cache_keys_&apos; . md5(Doctrine_Manager::getInstance()-&amp;gt;getCurrentConnection()-&amp;gt;getOption(&apos;dsn&apos;));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but if an application uses more than 1mb en keys then the notice will rise again.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10669">DC-390</key>
            <summary>doctrine_cache_keys bigger than 1mb</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="crosspad">Douglas Yau</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 Dec 2009 17:49:24 +0000</created>
                <updated>Wed, 27 Jan 2010 23:33:01 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Caching</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11368" author="circlechu" created="Wed, 13 Jan 2010 13:33:10 +0000"  >&lt;p&gt;Why doctrine need to save the keys when it is timeout? I found doctrine will hold the duplicated keys in doctrine_cache_keys map. So this is why it will become more and more bigger.  So I think if I remove those duplicated key it will be better? Here is my solution&lt;br/&gt;
I add array_unique function to remove all duplicated keys in the map. This method is in the Doctrine_Cache_Driver class.&lt;/p&gt;

&lt;p&gt;    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Save a cache key in the index of cache keys&lt;br/&gt;
     *&lt;/li&gt;
	&lt;li&gt;@param string $key&lt;/li&gt;
	&lt;li&gt;@return boolean True if successful and false if something went wrong.&lt;br/&gt;
     */&lt;br/&gt;
    protected function _saveKey($key)
    {
        $keys = $this-&amp;gt;fetch($this-&amp;gt;_cacheKeyIndexKey);
        $keys[] = $key;
        $keys=array_unique ($keys);
        return $this-&amp;gt;save($this-&amp;gt;_cacheKeyIndexKey, $keys, null, false);
    }&lt;/li&gt;
&lt;/ul&gt;
</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="10795">DC-460</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-392] Let the parser ignore .* (hidden) files</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-392</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When generating models from yml files starting with a `.&apos; such as temporary files from certain editors and meta files from OS X are also parsed by the importer. I do not see any reasons too include these hidden files in parsing as they are hidden for a purpose. And there would be no point in deliberately using hidden files for your config files.&lt;/p&gt;

&lt;p&gt;Also see:&lt;br/&gt;
&lt;a href=&quot;http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/&quot; class=&quot;external-link&quot;&gt;http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/&lt;/a&gt;&lt;br/&gt;
and&lt;br/&gt;
&lt;a href=&quot;http://alessandrovermeulen.me/2010/01/01/doctrine-unable-to-parse-string-unable-to-parse-line-0/&quot; class=&quot;external-link&quot;&gt;http://alessandrovermeulen.me/2010/01/01/doctrine-unable-to-parse-string-unable-to-parse-line-0/&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="10671">DC-392</key>
            <summary>Let the parser ignore .* (hidden) files</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="spockz">Alessandro Vermeulen</reporter>
                        <labels>
                    </labels>
                <created>Sat, 2 Jan 2010 21:58:09 +0000</created>
                <updated>Tue, 8 Jun 2010 15:19:18 +0000</updated>
                                    <version>1.1.6</version>
                                                <component>File Parser</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11310" author="spockz" created="Sat, 2 Jan 2010 21:58:53 +0000"  >&lt;p&gt;Added affected versions.&lt;/p&gt;</comment>
                    <comment id="13200" author="jwage" created="Tue, 8 Jun 2010 15:19:18 +0000"  >&lt;p&gt;We can include this fix in 1.2.3, does anyone have a patch? If not I&apos;ll try and hunt down the offending code and patch it. Not sure where it is off the top of my head anymore &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-396] Add timezone support for time and timestamp datatype in PostgreSQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-396</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Please add support for the types of time with timezone and timestamp with timezone in the Doctrine when using PostgreSQL.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10681">DC-396</key>
            <summary>Add timezone support for time and timestamp datatype in PostgreSQL</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="phprus">Vladislav</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Jan 2010 10:01:12 +0000</created>
                <updated>Sun, 19 Aug 2012 05:29:02 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="18526" author="alepot" created="Sun, 19 Aug 2012 01:58:16 +0000"  >&lt;p&gt;I came across this problem because I prefer to store timezone information instead of local dates. &lt;/p&gt;

&lt;p&gt;I believe this is resolved by the attached patch, which patches the Timestampable template and it&apos;s listener to create and maintain &apos;timestamp with timezone&apos; in Postgresql.&lt;/p&gt;
</comment>
                </comments>
                    <attachments>
                    <attachment id="11313" name="timestampable.diff" size="2567" author="alepot" created="Sun, 19 Aug 2012 05:26:16 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-400] bit(1) columns are broken</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-400</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Ihave the following Doctrine schema:&lt;/p&gt;

&lt;p&gt;&amp;#8212;&lt;br/&gt;
TestTable:&lt;br/&gt;
    columns:&lt;br/&gt;
        bitty: bit(1)&lt;/p&gt;

&lt;p&gt;I have created the database and table for this. I then have the following PHP code:&lt;/p&gt;

&lt;p&gt;$obj1 = new TestTable();&lt;br/&gt;
$obj1&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;bitty&amp;#39;&amp;#93;&lt;/span&gt; = b&apos;0&apos;;&lt;br/&gt;
$obj1-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;$obj2 = new TestTable();&lt;br/&gt;
$obj2&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;bitty&amp;#39;&amp;#93;&lt;/span&gt; = 0;&lt;br/&gt;
$obj2-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;Clearly my attempt is to save the bit value 0 in the bitty column.&lt;/p&gt;

&lt;p&gt;However after running this PHP code I get the following odd results:&lt;/p&gt;

&lt;p&gt;mysql&amp;gt; select * from test_table;&lt;br/&gt;
&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; id &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; bitty &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;  1 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;  2 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;br/&gt;
2 rows in set (0.00 sec)&lt;/p&gt;

&lt;p&gt;mysql&amp;gt; select * from test_table where bitty = 1;&lt;br/&gt;
&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; id &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; bitty &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;  1 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;  2 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;--&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;br/&gt;
2 rows in set (0.00 sec)&lt;/p&gt;

&lt;p&gt;mysql&amp;gt; select * from test_table where bitty = 0;                &lt;br/&gt;
Empty set (0.00 sec)&lt;/p&gt;

&lt;p&gt;Those boxes are the 0x01 character, i.e. Doctrine has set the value to 1, not 0.&lt;/p&gt;

&lt;p&gt;However I can insert 0&apos;s into that table direct from MySQL:&lt;/p&gt;

&lt;p&gt;mysql&amp;gt; insert into test_table values (4, b&apos;0&apos;);&lt;br/&gt;
Query OK, 1 row affected (0.00 sec)&lt;/p&gt;

&lt;p&gt;mysql&amp;gt; select * from test_table where bitty = 0;&lt;br/&gt;
&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; id &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt; bitty &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;/p&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;  4 &lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;ins&gt;---&lt;del&gt;&lt;/ins&gt;&lt;/del&gt;------+&lt;br/&gt;
1 row in set (0.00 sec)&lt;/p&gt;


&lt;p&gt;See also this question on StackOverflow &lt;a href=&quot;http://stackoverflow.com/questions/2008021/php-doctrine-orm-not-able-to-handle-bit1-types-correctly&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/2008021/php-doctrine-orm-not-able-to-handle-bit1-types-correctly&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Ubuntu 9.10 php 5.2 mysql 5.1, all installed with ubuntu&amp;#39;s apt</environment>
            <key id="10688">DC-400</key>
            <summary>bit(1) columns are broken</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="rorymccann">Rory McCann</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 09:33:34 +0000</created>
                <updated>Mon, 11 Apr 2011 15:38:55 +0000</updated>
                                                                    <component>Schema Files</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-401] Doctrine_Query-&gt;load crashes with additional ending whitespace in JOIN </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-401</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;following will lead to an error:&lt;/p&gt;

&lt;p&gt;-&amp;gt;leftJoin(&apos;alias.RelatedTable alias2  WITH .....&apos;)&lt;/p&gt;

&lt;p&gt;The problem is the additional whitespace behind alias2.&lt;br/&gt;
On line 1682 in Doctrine_Query class file:&lt;/p&gt;

&lt;p&gt;$tmp            = explode(&apos; &apos;, $path);&lt;/p&gt;

&lt;p&gt;will create an array of 3 elements where the last one is empty but will be used as empty alias mapping after foreach from line 1698.&lt;/p&gt;

</description>
                <environment></environment>
            <key id="10689">DC-401</key>
            <summary>Doctrine_Query-&gt;load crashes with additional ending whitespace in JOIN </summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="cmi">Christian Michel</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 11:54:52 +0000</created>
                <updated>Wed, 6 Jan 2010 12:02:40 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-402] aliased fields from root class are not recognized als root class fields, if they&apos;re the only one</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-402</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If all selected fields from the root class are aliased, &lt;br/&gt;
Doctrine_Query-&amp;gt;processPendingFields() won&apos;t recognize them as fields of the table and the following exception will be thrown:&lt;br/&gt;
&quot;The root class of the query (alias c)  must have at least one field selected.&quot;&lt;/p&gt;

&lt;p&gt;In my real world example, this could only be fixed, using the primary key of the root class/table in select&lt;/p&gt;</description>
                <environment></environment>
            <key id="10691">DC-402</key>
            <summary>aliased fields from root class are not recognized als root class fields, if they&apos;re the only 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="cmi">Christian Michel</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 14:06:56 +0000</created>
                <updated>Wed, 6 Jan 2010 14:06:56 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-403] Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-403</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;h3&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h3&gt;

&lt;ol&gt;
	&lt;li&gt;fetch a tree with nested set
&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;$root = Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;findRoot($rootId);
$treeObject= Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;fetchTree($root-&amp;gt;getId()); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;issue
&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;$root-&amp;gt;getNode()-&amp;gt;getChildren();

or there will be a total query mess in a lambda function with a loop getChildren().
...
&amp;lt;?php foreach($root-&amp;gt;getChildren() as $child): ?&amp;gt;
   ....
&amp;lt;?php endforeach; ?&amp;gt;
...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Problem is described more verbosely here &amp;#8211; &lt;a href=&quot;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&quot; class=&quot;external-link&quot;&gt;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whatbehaviorisexpected&quot;&gt;&lt;/a&gt;What behavior is expected&lt;/h3&gt;
&lt;p&gt;An already fetched record instance is returned, without calling database and without causing query flooding.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Likeinpropel.&quot;&gt;&lt;/a&gt;Like in propel.&lt;/h3&gt;
&lt;p&gt;In propel if you are calling ....::retrieveTree($id) it returns the root&lt;br/&gt;
with completed, pooled (cached) and linked  tree.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whathappens&quot;&gt;&lt;/a&gt;What happens&lt;/h3&gt;
&lt;p&gt;An additional query is issued&lt;/p&gt;

&lt;p&gt;This is a big slip in architecture of Doctrine`s nested set implementation.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10693">DC-403</key>
            <summary>Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="zidler">alex</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 20:52:18 +0000</created>
                <updated>Fri, 16 Apr 2010 12:18:05 +0000</updated>
                                    <version>1.2.1</version>
                                <fixVersion>1.2.0</fixVersion>
                                <component>Nested Set</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-412] Error defining &quot;unique&quot; constraint in a translated (i18n) column</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-412</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Let&apos;s suppose we have a class &quot;Element&quot;  with columns &quot;name&quot; and &quot;description&quot;.&lt;/p&gt;

&lt;p&gt;We want to set an &quot;unique&quot; constraint in column &quot;name&quot;, and set the I18n behavior to columns name and description.&lt;/p&gt;

&lt;p&gt;In the generated translation table &quot;element_translation&quot;, doctrine sets an unique constraint in the column &quot;name&quot;. This is an error, as various languages could translate that string in the same way. I think that the &quot;unique&quot; constraint should be set to the combination of columns &quot;name&quot; and &quot;lang&quot;, so the restriction applies for a given language.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10705">DC-412</key>
            <summary>Error defining &quot;unique&quot; constraint in a translated (i18n) column</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="davefx">David Mar&#237;n Carre&#241;o</reporter>
                        <labels>
                    </labels>
                <created>Sat, 9 Jan 2010 08:53:18 +0000</created>
                <updated>Sun, 10 Jan 2010 21:18:56 +0000</updated>
                                                                    <component>I18n</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-417] Unexpected results with equal many-to-many relations</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-417</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;print_r&apos;s before refresh represent what i hoped to get and after that what was inserted into db.&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;INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] =&amp;gt; 2
    [1] =&amp;gt; 1
)


UPDATE match_reference SET match_id = ? WHERE user_id = ? AND match_id = ?
Array
(
    [0] =&amp;gt; 1
    [1] =&amp;gt; 1
    [2] =&amp;gt; 2
)


INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] =&amp;gt; 3
    [1] =&amp;gt; 2
)


INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] =&amp;gt; 4
    [1] =&amp;gt; 2
)
Array
(
    [0] =&amp;gt; Array
        (
            [id] =&amp;gt; 2
            [username] =&amp;gt; 2
        )

)
Array
(
    [0] =&amp;gt; Array
        (
            [id] =&amp;gt; 1
            [username] =&amp;gt; 1
        )

    [1] =&amp;gt; Array
        (
            [id] =&amp;gt; 3
            [username] =&amp;gt; 3
        )

    [2] =&amp;gt; Array
        (
            [id] =&amp;gt; 4
            [username] =&amp;gt; 4
        )

)
Array
(
)
Array
(
    [0] =&amp;gt; Array
        (
            [id] =&amp;gt; 3
            [username] =&amp;gt; 3
        )

    [1] =&amp;gt; Array
        (
            [id] =&amp;gt; 4
            [username] =&amp;gt; 4
        )

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


&lt;p&gt;schema/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;---
User:
  columns:
    username: string(255)
  relations:
    Matches:
      class: User
      local: user_id
      foreign: match_id
      refClass: MatchReference
      equal: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      cascade: [delete]

MatchReference:
  columns:
    user_id:
      type: integer
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    match_id:
      type: integer
      primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;index.php&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;require_once(&apos;config.php&apos;);

Doctrine::loadModels(&apos;models&apos;);

Doctrine_Query::create()
    -&amp;gt;delete(&apos;User&apos;)
    -&amp;gt;execute();

Doctrine_Query::create()
    -&amp;gt;delete(&apos;MatchReference&apos;)
    -&amp;gt;execute();

$u1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
$u1-&amp;gt;id = $u1-&amp;gt;username = 1;
$u1-&amp;gt;save();

$u2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
$u2-&amp;gt;id = $u2-&amp;gt;username = 2;
$u2-&amp;gt;save();

$u3 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
$u3-&amp;gt;id = $u3-&amp;gt;username = 3;
$u3-&amp;gt;save();

$u4 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
$u4-&amp;gt;id = $u4-&amp;gt;username = 4;
$u4-&amp;gt;save();

$profiler = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Connection_Profiler();
Doctrine_Manager::getInstance()-&amp;gt;getCurrentConnection()-&amp;gt;addListener($profiler);

$user_1 = Doctrine::getTable(&apos;User&apos;)-&amp;gt;find(1);

$matches = Doctrine_Query::create()
    -&amp;gt;from(&apos;User&apos;)
    -&amp;gt;whereIn(&apos;id&apos;, array(2))
    -&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY);

$match = $matches[0];

$user_1-&amp;gt;link(&apos;Matches&apos;, array($match[&apos;id&apos;]));
$user_1-&amp;gt;save();

$user_2 = Doctrine::getTable(&apos;User&apos;)-&amp;gt;find(2);

$matches = Doctrine_Query::create()
-&amp;gt;from(&apos;User&apos;)
-&amp;gt;whereIn(&apos;id&apos;, array(3, 4))
-&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY);

foreach ($matches as $match) {
    $user_2-&amp;gt;link(&apos;Matches&apos;, array($match[&apos;id&apos;]));
}

$user_2-&amp;gt;save();

foreach ($profiler as $event) {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (in_array($event-&amp;gt;getName(), array(&apos;execute&apos;)) &amp;amp;&amp;amp; preg_match(&apos;/^(INSERT|UPDATE)/&apos;, $event-&amp;gt;getQuery())) {
        echo print_r($event-&amp;gt;getQuery(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;) . &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
        echo print_r($event-&amp;gt;getParams(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;) . &lt;span class=&quot;code-quote&quot;&gt;&quot;\n\n&quot;&lt;/span&gt;;
    }
}

print_r($user_1-&amp;gt;Matches-&amp;gt;toArray());
print_r($user_2-&amp;gt;Matches-&amp;gt;toArray());

$user_1-&amp;gt;refresh(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
$user_2-&amp;gt;refresh(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);

print_r($user_1-&amp;gt;Matches-&amp;gt;toArray());
print_r($user_2-&amp;gt;Matches-&amp;gt;toArray());

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7 (cli) (built: Nov 26 2009 14:52:57) &lt;br/&gt;
MySQL 5.0.84-0.dotdeb.0&lt;br/&gt;
Doctrine-1.1.6-Sandbox</environment>
            <key id="10712">DC-417</key>
            <summary>Unexpected results with equal many-to-many relations</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ihff">Ivo V&#245;sa</reporter>
                        <labels>
                    </labels>
                <created>Mon, 11 Jan 2010 16:52:08 +0000</created>
                <updated>Thu, 14 Jan 2010 13:05:39 +0000</updated>
                                    <version>1.1.6</version>
                <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11364" author="ihff" created="Mon, 11 Jan 2010 17:23:57 +0000"  >&lt;p&gt;Just tested it on 1.2.1 with same results.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-424] using boolean logic in select don&apos;t work</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-424</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Continuing with same setup as in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-417&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-417&lt;/a&gt;&lt;br/&gt;
I discovered another issue&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;$result = Doctrine_Query::create()
    -&amp;gt;select(&apos;u.*, m.*, COUNT(m.id) &amp;gt; 0 AS match_check&apos;)
    -&amp;gt;from(&apos;User u&apos;)
    -&amp;gt;leftJoin(&apos;u.Matches m&apos;)
    -&amp;gt;groupBy(&apos;u.id&apos;)
    -&amp;gt;orderBy(&apos;match_check DESC, RAND()&apos;)
    -&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;match_check will actually be count of matches not 0 or 1 as i expected. &lt;br/&gt;
is it bug or feature?&lt;/p&gt;</description>
                <environment></environment>
            <key id="10726">DC-424</key>
            <summary>using boolean logic in select don&apos;t work</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="ihff">Ivo V&#245;sa</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Jan 2010 13:21:28 +0000</created>
                <updated>Wed, 27 Jan 2010 21:14:32 +0000</updated>
                                    <version>1.1.6</version>
                <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11378" author="guilhermeblanco" created="Thu, 14 Jan 2010 13:24:29 +0000"  >&lt;p&gt;SelectExpressions cannot contain ComparisonExpressions.&lt;/p&gt;

&lt;p&gt;That&apos;s a limitation of Doctrine 1, which was resolved in Doctrine 2.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;</comment>
                    <comment id="11493" author="jboyd" created="Wed, 27 Jan 2010 21:14:06 +0000"  >&lt;p&gt;Something like this will work:&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;$result = Doctrine_Query::create()
    -&amp;gt;select(&apos;u.*, m.*)
    -&amp;gt;addSelect(&quot;QUOTE(IF(COUNT(m.id) &amp;gt; 0),1,0)) match_check&apos;)
    -&amp;gt;from(&apos;User u&apos;)
    -&amp;gt;leftJoin(&apos;u.Matches m&apos;)
    -&amp;gt;groupBy(&apos;u.id&apos;)
    -&amp;gt;orderBy(&apos;match_check DESC, RAND()&apos;)
    -&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-426] Doctrine incorrectly assigns a NULL value to primary key fields</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-426</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;in my project (MySQL 5.x, PHP 5.2.x), I use a combined primary key which looks as follows:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;hasColumn(&quot;guid&quot;, 		&quot;string&quot;, 	32,		array(&apos;primary&apos; =&amp;gt; true));&lt;br/&gt;
$this-&amp;gt;hasColumn(&quot;revision&quot;, 	&quot;integer&quot;, 	4,		array(&apos;primary&apos; =&amp;gt; true));&lt;br/&gt;
$this-&amp;gt;hasColumn(&quot;language&quot;, 	&quot;string&quot;, 	32,		array(&apos;primary&apos; =&amp;gt; true));&lt;/p&gt;

&lt;p&gt;My project automatically initializes the GUID and revision fields, but language is left empty. Doctrine assumes that NULL is a good value, and uses the NULL value after saving an object to reload it. This results in the following statement, generated by the find()-Method within Table.php:&lt;/p&gt;

&lt;p&gt;SELECT b.guid AS b_&lt;em&gt;guid, b.revision AS b&lt;/em&gt;&lt;em&gt;revision, b.language AS b&lt;/em&gt;&lt;em&gt;language, b.active AS b&lt;/em&gt;&lt;em&gt;active, b.title AS b&lt;/em&gt;&lt;em&gt;title, b.content AS b&lt;/em&gt;&lt;em&gt;content, b.category AS b&lt;/em&gt;_category FROM blog_entry b WHERE (b.guid = &apos;505f1a2d13864fa4aef461aa1b5b37a3&apos; AND b.revision = &apos;1&apos; AND b.language = NULL)&lt;/p&gt;

&lt;p&gt;Since MySQL does not allow NULL values in primary keys, MySQL uses an empty string (&apos;&apos;). Doctrine should also use an empty string as default value if the primary key consists of a string, OR issue a warning that MySQL does not allow NULL values in primary keys. The problem with this &quot;bug&quot; is that problems occur in situations where you do not expect them, for example, when storing objects.&lt;/p&gt;

&lt;p&gt;If a test case is required, just tell me and I&apos;ll prepare one.&lt;/p&gt;

&lt;p&gt;Thanks and best regards,&lt;br/&gt;
Timo&lt;/p&gt;</description>
                <environment></environment>
            <key id="10728">DC-426</key>
            <summary>Doctrine incorrectly assigns a NULL value to primary key fields</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="alek202">Timo A. Hummel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Jan 2010 17:25:56 +0000</created>
                <updated>Thu, 14 Jan 2010 17:25:56 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-427] Record Hydration error</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-427</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;schema.yml &lt;/p&gt;

&lt;p&gt;CheCategory:&lt;br/&gt;
  options:&lt;br/&gt;
    collate: utf8_unicode_ci&lt;br/&gt;
    charset: utf8&lt;br/&gt;
  actAs:&lt;br/&gt;
    Timestampable: ~&lt;br/&gt;
    NestedSet: ~&lt;br/&gt;
  columns:    &lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
CheItem:&lt;br/&gt;
  options:&lt;br/&gt;
    collate: utf8_unicode_ci&lt;br/&gt;
    charset: utf8&lt;br/&gt;
  actAs:&lt;br/&gt;
    Timestampable: ~&lt;br/&gt;
  columns:&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
    category_id:&lt;br/&gt;
      type: integer(12)    &lt;br/&gt;
  relations:&lt;br/&gt;
    CheItemPhoto:&lt;br/&gt;
      type: many&lt;br/&gt;
      local: id&lt;br/&gt;
      foreign: item_id&lt;br/&gt;
    CheItemAttribute:&lt;br/&gt;
      type: many&lt;br/&gt;
      local: id&lt;br/&gt;
      foreign: item_id&lt;br/&gt;
    CheCategory:&lt;br/&gt;
      local: category_id&lt;br/&gt;
      foreign: id&lt;/p&gt;

&lt;p&gt;CheAttribute:&lt;br/&gt;
  options:&lt;br/&gt;
    collate: utf8_unicode_ci&lt;br/&gt;
    charset: utf8&lt;br/&gt;
  columns:&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
    attr_type:&lt;br/&gt;
      type: integer(2)    &lt;br/&gt;
    label:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
    sort_order:&lt;br/&gt;
      type: integer(5)&lt;br/&gt;
      default: 9999&lt;br/&gt;
  relations:&lt;br/&gt;
    CheItemAttribute:      &lt;br/&gt;
      local: id&lt;br/&gt;
      foreign: attribute_id&lt;/p&gt;

&lt;p&gt;CheItemAttribute:&lt;br/&gt;
  options:&lt;br/&gt;
    collate: utf8_unicode_ci&lt;br/&gt;
    charset: utf8&lt;br/&gt;
  columns:&lt;br/&gt;
    item_id:&lt;br/&gt;
      type: integer(12)&lt;br/&gt;
    attr_value:&lt;br/&gt;
      type: clob&lt;br/&gt;
    attribute_id:&lt;br/&gt;
      type: integer(12)&lt;br/&gt;
  relations:&lt;br/&gt;
    CheItem:&lt;br/&gt;
      local: item_id&lt;br/&gt;
      foreign: id&lt;br/&gt;
    CheAttribute:&lt;br/&gt;
      local: attribute_id&lt;br/&gt;
      foreign: id&lt;/p&gt;

&lt;p&gt;CheItemPhoto:&lt;br/&gt;
  options:&lt;br/&gt;
    collate: utf8_unicode_ci&lt;br/&gt;
    charset: utf8&lt;br/&gt;
  actAs:&lt;br/&gt;
    Timestampable: ~&lt;br/&gt;
  columns:&lt;br/&gt;
    item_id:&lt;br/&gt;
      type: integer(12)&lt;br/&gt;
    basefile:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
    caption:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
    is_default:&lt;br/&gt;
      type: boolean&lt;br/&gt;
      default: false&lt;br/&gt;
  relations:&lt;br/&gt;
    CheItem:&lt;br/&gt;
      local: item_id&lt;br/&gt;
      foreign: id&lt;/p&gt;

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

&lt;p&gt;CheAttribute:&lt;br/&gt;
  Attr_price:&lt;br/&gt;
    name: Price&lt;br/&gt;
    label: price&lt;br/&gt;
    sort_order: 1&lt;br/&gt;
    attr_type: &amp;lt;?php echo CheAttribute::ATTR_STRING.&quot;\n&quot; ?&amp;gt;&lt;br/&gt;
  Attr_desc:&lt;br/&gt;
    name: Desc&lt;br/&gt;
    label: desc&lt;br/&gt;
    sort_order: 2&lt;br/&gt;
    attr_type: &amp;lt;?php echo CheAttribute::ATTR_HTML.&quot;\n&quot; ?&amp;gt;&lt;/p&gt;

&lt;p&gt;CheCategory:&lt;br/&gt;
  Cat_0:&lt;br/&gt;
    name: Items category&lt;br/&gt;
    children:&lt;br/&gt;
      Cat_1:&lt;br/&gt;
        name: Cups&lt;br/&gt;
        children:&lt;br/&gt;
          Cat_2:&lt;br/&gt;
            name: Beer&lt;br/&gt;
          Cat_3:&lt;br/&gt;
            name: Tea&lt;br/&gt;
            children:&lt;br/&gt;
              Cat_5:&lt;br/&gt;
                name: China&lt;br/&gt;
              Cat_6:&lt;br/&gt;
                name: Russian&lt;br/&gt;
          Cat_4:&lt;br/&gt;
            name: Coffee&lt;/p&gt;

&lt;p&gt;CheItem:&lt;br/&gt;
  Item_8:&lt;br/&gt;
    name: Vobla&lt;br/&gt;
    CheCategory: Cat_1&lt;br/&gt;
  Item_1:&lt;br/&gt;
    name: Vobla2&lt;br/&gt;
    CheCategory: Cat_2&lt;/p&gt;

&lt;p&gt;CheItemAttribute:&lt;br/&gt;
  Ite_attr_0:&lt;br/&gt;
    CheItem: Item_1&lt;br/&gt;
    CheAttribute: Attr_price&lt;br/&gt;
    attr_value: 10&lt;br/&gt;
  Ite_attr_1:&lt;br/&gt;
    CheItem: Item_1&lt;br/&gt;
    CheAttribute: Attr_desc&lt;br/&gt;
    attr_value: abcsdd&lt;br/&gt;
  Ite_attr_2:&lt;br/&gt;
    CheItem: Item_8&lt;br/&gt;
    CheAttribute: Attr_price&lt;br/&gt;
    attr_value: 123&lt;br/&gt;
  Ite_attr_3:&lt;br/&gt;
    CheItem: Item_8&lt;br/&gt;
    CheAttribute: Attr_desc&lt;br/&gt;
    attr_value: test&lt;/p&gt;

&lt;p&gt;code:&lt;/p&gt;

&lt;p&gt;$b =  Doctrine::getTable(&quot;CheAttribute&quot;)&lt;del&gt;&amp;gt;createQuery(&quot;A2&quot;)&lt;/del&gt;&amp;gt;leftJoin(&quot;A2.CheItemAttribute IA2 WITH IA2.item_id = ?&quot;, 2)&lt;del&gt;&amp;gt;addOrderBy(&quot;A2.sort_order ASC&quot;)&lt;/del&gt;&amp;gt;execute();    &lt;/p&gt;

&lt;p&gt;    var_dump($b&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;&lt;del&gt;&amp;gt;getCheItemAttribute()&lt;/del&gt;&amp;gt;getAttrValue());&lt;/p&gt;



&lt;p&gt;    $tb =  Doctrine::getTable(&quot;CheAttribute&quot;)&lt;del&gt;&amp;gt;createQuery(&quot;A&quot;)&lt;/del&gt;&amp;gt;leftJoin(&quot;A.CheItemAttribute IA WITH IA.item_id = ?&quot;, 1)&lt;del&gt;&amp;gt;addOrderBy(&quot;A.sort_order ASC&quot;)&lt;/del&gt;&amp;gt;execute();   &lt;/p&gt;

&lt;p&gt;    var_dump($tb&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;&lt;del&gt;&amp;gt;getCheItemAttribute()&lt;/del&gt;&amp;gt;getAttrValue());&lt;br/&gt;
    exit();&lt;/p&gt;

&lt;p&gt;in browser i see:&lt;/p&gt;

&lt;p&gt;string &apos;10&apos; (length=2)&lt;/p&gt;

&lt;p&gt;string &apos;10&apos; (length=2)&lt;/p&gt;

&lt;p&gt;but expected:&lt;/p&gt;

&lt;p&gt;10&lt;/p&gt;

&lt;p&gt;123&lt;/p&gt;

&lt;p&gt;With hydration Array &amp;amp; Scalar hydrated data is ok. &lt;/p&gt;






</description>
                <environment>Ubuntu 9.04&lt;br/&gt;
Apache 2.2.9 &lt;br/&gt;
PHP 5.2.6-3ubuntu4.2 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:14:44)&lt;br/&gt;
Copyright (c) 1997-2008 The PHP Group&lt;br/&gt;
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans&lt;br/&gt;
MySQL 5.0.75-0ubuntu10.2 (Ubuntu)&lt;br/&gt;
Symfony 1.4.1</environment>
            <key id="10729">DC-427</key>
            <summary>Record Hydration error</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mixadior">Diordienko Mykhail</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Jan 2010 19:50:59 +0000</created>
                <updated>Thu, 14 Jan 2010 19:50:59 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-430] I18n and inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-430</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When using i18n with inheritance, the localizables fields are overrinden by the second deriving class.&lt;br/&gt;
So, the translation table is containing only fields from one of the two descending classes.&lt;/p&gt;

&lt;p&gt;The yml is below:&lt;/p&gt;

&lt;p&gt;User:&lt;br/&gt;
  columns:&lt;br/&gt;
    email:            string(255)&lt;br/&gt;
    ...&lt;/p&gt;

&lt;p&gt;Employer:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends:  User&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
  actAs:&lt;br/&gt;
    I18n:&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;description, company&amp;#93;&lt;/span&gt;&lt;br/&gt;
  columns:      &lt;br/&gt;
    company:  string(255)     &lt;br/&gt;
    description:  text&lt;/p&gt;

&lt;p&gt;Recruiter:&lt;br/&gt;
  actAs:&lt;br/&gt;
    I18n:&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;position&amp;#93;&lt;/span&gt;&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends:  User&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
  columns:&lt;br/&gt;
    position: string(255)&lt;/p&gt;</description>
                <environment>Doctrine 1.2 with Symfony 1.4</environment>
            <key id="10734">DC-430</key>
            <summary>I18n and inheritance</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jwconsulting">Julien Wadin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 15 Jan 2010 12:55:49 +0000</created>
                <updated>Fri, 15 Jan 2010 12:55:49 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-432] ::isValidType fails when input format is different from php default format</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-432</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;In Validator::isValidType():&lt;br/&gt;
    return (string)$var == strval(floatval($var));&lt;/p&gt;

&lt;p&gt;floatval($var) returns only the integer part if the decimal character is anything other than &quot;.&quot;. &lt;br/&gt;
Therefore this evaluation fails. &lt;/p&gt;

&lt;p&gt;I&apos;ve added a small function &apos;ParseFloat&apos; which takes locale settings into consideration. &lt;br/&gt;
There might be a better solution.&lt;/p&gt;
</description>
                <environment>Windows XP (XAMPP Apache) &amp;amp; Linux </environment>
            <key id="10736">DC-432</key>
            <summary>::isValidType fails when input format is different from php default format</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jonr">J&#243;n Ragnarsson</reporter>
                        <labels>
                    </labels>
                <created>Fri, 15 Jan 2010 15:13:12 +0000</created>
                <updated>Tue, 8 Jun 2010 16:55:41 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13213" author="jwage" created="Tue, 8 Jun 2010 16:55:41 +0000"  >&lt;p&gt;Can you provide the changes as patch?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10289" name="Validator.php" size="7696" author="jonr" created="Fri, 15 Jan 2010 15:13:12 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-436]  Change in 1.2 to Doctrine_Event::skipOperation() functionality</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-436</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have been using Doctrine 1.1.6.&lt;/p&gt;

&lt;p&gt;I have two related models, which are always saved together. In my application, save is called on class A and that save cascades to class B. I have a save listener which in some cases can intercept class A&apos;s save operation and call Doctrine_Event::skipOperation() to prevent class A from being persistently saved. However, in such cases, class B is still saved - the skipOperation() does not skip the entire operation, just class A&apos;s save operation, allowing subsequent operations to occur as normal.&lt;/p&gt;

&lt;p&gt;This is the desired functionality and has been working fine. However, I have just upgraded to 1.2.1. only to find that something has changed, causing the skipOperation() to skip the entire operation, therefore not saving class B when class A&apos;s listener interferes.&lt;/p&gt;

&lt;p&gt;I presume this is a bug. If not, what precisely has changed with skipOperation(), and how can I keep the traditional functionality? &lt;/p&gt;</description>
                <environment>Debian</environment>
            <key id="10744">DC-436</key>
            <summary> Change in 1.2 to Doctrine_Event::skipOperation() functionality</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ondistantshores">Cameron Ross</reporter>
                        <labels>
                    </labels>
                <created>Mon, 18 Jan 2010 00:37:02 +0000</created>
                <updated>Wed, 10 Feb 2010 06:02:18 +0000</updated>
                                    <version>1.2.1</version>
                                <fixVersion>1.1.6</fixVersion>
                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-438] Nesting Taggable and I18N</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-438</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The Taggable extension doesnt work correctly when nested under I18N. &lt;br/&gt;
The  page_translation_taggable_tag table appears to be correctly created, it has 3 columns: id, lang, tag_id&lt;br/&gt;
But when you save a tag like this&lt;br/&gt;
$page-&amp;gt;Translation&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;en&amp;#39;&amp;#93;&lt;/span&gt;-&amp;gt;setTags(&apos;tag 1, tag2&apos;);&lt;br/&gt;
the lang column in page_translation_taggable_tag is empty&lt;br/&gt;
and this doesnt work either:&lt;br/&gt;
$page-&amp;gt;setTags(&apos;tag 1, tag2&apos;);&lt;/p&gt;

&lt;p&gt;Schema is this:&lt;br/&gt;
Page:&lt;br/&gt;
  actAs:&lt;br/&gt;
    I18n:&lt;br/&gt;
      fields:          &lt;span class=&quot;error&quot;&gt;&amp;#91;title, contents&amp;#93;&lt;/span&gt;&lt;br/&gt;
      actAs:&lt;br/&gt;
        Taggable: ~&lt;br/&gt;
  columns:&lt;br/&gt;
    title:                &lt;/p&gt;
{type: string(255), notnull: true}
&lt;p&gt;    contents:       clob&lt;/p&gt;</description>
                <environment>PHP 5.2.6, MySQL 5.0.75, Symfony 1.3.1</environment>
            <key id="10749">DC-438</key>
            <summary>Nesting Taggable and I18N</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="sorin">Sorin Neacsu</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Jan 2010 09:53:48 +0000</created>
                <updated>Tue, 19 Jan 2010 09:53:48 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Extensions</component>
                <component>I18n</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-440] doctrine migration fails with taggable extension</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-440</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When adding the Taggable behaviour to an entity, the doctrine migration fails (i&apos;m using the symfony task) with the follwing error:&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt; doctrine  Migrating from version 0 to 1&lt;/p&gt;

&lt;p&gt;  The following errors occurred:                                                                                                                                           &lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails. Failing Query: &quot;DROP TABLE taggable_tag&quot;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;I have a single entity in my schema, with the Taggable behavior attached:&lt;/p&gt;

&lt;p&gt;Article:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Taggable: ~&#160;&lt;br/&gt;
  columns:&lt;br/&gt;
    title:              &lt;/p&gt;
{ type: string(255), notnull: true }
&lt;p&gt;    body:               &lt;/p&gt;
{ type: clob }

&lt;p&gt;The Version1 class which was generate by the generate-migrations-diff task looks like this:&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;br/&gt;
/**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;This class has been auto-generated by the Doctrine ORM Framework&lt;br/&gt;
 */&lt;br/&gt;
class Version1 extends Doctrine_Migration_Base&lt;br/&gt;
{&lt;br/&gt;
    public function up()
    {
        $this-&amp;gt;dropTable(&apos;taggable_tag&apos;);
    }&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;    public function down()&lt;/p&gt;
    {
        $this-&amp;gt;createTable(&apos;taggable_tag&apos;, array(
             &apos;id&apos; =&amp;gt; 
             array(
              &apos;type&apos; =&amp;gt; &apos;integer&apos;,
              &apos;length&apos; =&amp;gt; &apos;8&apos;,
              &apos;autoincrement&apos; =&amp;gt; &apos;1&apos;,
              &apos;primary&apos; =&amp;gt; &apos;1&apos;,
             ),
             &apos;name&apos; =&amp;gt; 
             array(
              &apos;unique&apos; =&amp;gt; &apos;1&apos;,
              &apos;type&apos; =&amp;gt; &apos;string&apos;,
              &apos;length&apos; =&amp;gt; &apos;255&apos;,
             ),
             ), array(
             &apos;type&apos; =&amp;gt; &apos;&apos;,
             &apos;indexes&apos; =&amp;gt; 
             array(
             ),
             &apos;primary&apos; =&amp;gt; 
             array(
              0 =&amp;gt; &apos;id&apos;,
             ),
             &apos;collate&apos; =&amp;gt; &apos;&apos;,
             &apos;charset&apos; =&amp;gt; &apos;&apos;,
             ));
    }
&lt;p&gt;}&lt;/p&gt;</description>
                <environment>osx 10.6, apache 2, php 5.3, symfony 1.4</environment>
            <key id="10753">DC-440</key>
            <summary>doctrine migration fails with taggable extension</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="pulse00">Robert Gruendler</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Jan 2010 19:42:50 +0000</created>
                <updated>Fri, 22 Jan 2010 11:18:02 +0000</updated>
                                    <version>1.2.0</version>
                <version>1.2.1</version>
                                                <component>Extensions</component>
                <component>Migrations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="11443" author="pulse00" created="Fri, 22 Jan 2010 11:17:38 +0000"  >&lt;p&gt;i think i found the reason for this. The sfDoctrineGenerateMigrationsDiffTask seems to build it&apos;s diff from yml schema files:&lt;/p&gt;

&lt;p&gt;protected function execute()....&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;callDoctrineCli(&apos;generate-migrations-diff&apos;, array(&lt;br/&gt;
      &apos;yaml_schema_path&apos; =&amp;gt; $this-&amp;gt;prepareSchemaFile($config&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;yaml_schema_path&amp;#39;&amp;#93;&lt;/span&gt;),&lt;br/&gt;
    ));&lt;/p&gt;


&lt;p&gt;The task does not know anything about the models in the doctrine_extensions folder, and there are no yaml files for their&lt;br/&gt;
schema, so symfony migration tasks won&apos;t work with extensions.&lt;/p&gt;

&lt;p&gt;It would be great if this would be mentioned somewhere in the docs of the extensions.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-442] Refined definition of relations regarding &quot;copy()&quot; cloning behaviour</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-442</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine&apos;s cloning feature is based on the Doctrine_Record::copy($deep = false) method, while the $deep param says whether to clone the related objects as well, or not.&lt;/p&gt;

&lt;p&gt;However, considering the perspective of the application logic, the functional need can also be stated as: &quot;I wish you to clone yourself, expecting you to know yourself which related objects you need to clone as well, or even to de-reference, or whatever is needed (e.g. to remove the relation).&quot;&lt;br/&gt;
For this, the $deep argument is somehow inaccurate, as it does not take into consideration the different meanings of the relations:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;some relations (namely aggregations in UML terminology) need that the cloned object shall still refer to the same object (like referenced by the cloned object)&lt;/li&gt;
	&lt;li&gt;some relations (namely compositions) need to clone the related objects as well, as the latter are owned by the main object.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Practical example: when cloning an invoice (Doctrine_Record), application logic expects that its invoice line items be cloned as well (compositions), but not the reference to the customer (cloning my customers this way will not increase my business &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.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;

&lt;p&gt;Thus it would be great if there were a means to specify the needed behaviour in the schema.yml etc.&lt;br/&gt;
Thinkable approach: extend the &quot;application-level cascade&quot; feature of Doctrine by adding a &quot;clone&quot; or &quot;copy&quot; parameters. Then the copy() method in Doctrine_Record will know which related objects to clone as well, or not, or to clear (null). I guess it&apos;s quite analogous to the &quot;delete&quot; cascade stuff.&lt;/p&gt;

&lt;p&gt;So far my proposal. In case it will find support, I will then be happy to provide an implementation proposal.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10757">DC-442</key>
            <summary>Refined definition of relations regarding &quot;copy()&quot; cloning behaviour</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="rschumacher">Raphael Schumacher</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Jan 2010 17:00:24 +0000</created>
                <updated>Wed, 10 Feb 2010 06:02:00 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-443] Incorrect insert order in i18n entities</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-443</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If the schema has an entity MyMain with all its fields i18n and an entity MySecondary related to MyMain and you try to create a new MySecondary item using Symfony forms you get an error.&lt;/p&gt;

&lt;p&gt;I think the error is doctrine and in i18n because if you remove a field from the i18n behavior (&lt;tt&gt;fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;a,b,c,d&amp;#93;&lt;/span&gt;&lt;/tt&gt;, for example) all works ok.&lt;br/&gt;
I&apos;ve included a symfony project to help developpers replicate the error.&lt;/p&gt;

&lt;p&gt;My Schema&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
MyMain:
  actAs:
    I18n:
      fields: [a,b,c,d, e]
  columns:
    a:  { type: string(255), notnull: true }
    b:  { type: string(255), notnull: true }
    c:  string
    d:  string
    e:  string

MySecondary:
  columns:
    my_main_id:  integer
    a:        string(255)
    b:        string(255)
  relations:
    MyMain:
      local: my_main_id
      foreign: id
      foreignType: one
      cascade: [delete]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;And the form code&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;class MyMainForm extends BaseMyMainForm
{
  public function configure()
  {
    $this-&amp;gt;embedI18n(array(&apos;en&apos;, &apos;es&apos;));
  }
}

class MySecondaryForm extends BaseMySecondaryForm
{
  public function configure()
  {
    $this-&amp;gt;widgetSchema[&apos;my_main_id&apos;] = new sfWidgetFormInputHidden();
    $this-&amp;gt;embedRelation(&apos;MyMain as main_subform&apos;);
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And last the queries (and its order when you get the error)&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;INSERT INTO my_secondary (my_main_id, a, b) VALUES (?, ?, ?) - (, my_secondary[a], my_secondary[b])
INSERT INTO my_main_translation (id, lang, a, b, c, d, e) VALUES (?, ?, ?, ?, ?, ?, ?) - 
  (, en, my_secondary[main_subform][en][a], my_secondary[main_subform][en][b], my_secondary[main_subform][en][c], 
   my_secondary[main_subform][en][d], my_secondary[main_subform][en][e])
Error Doctrine_Connection_Mysql_Exception	SQLSTATE[23000]: Integrity constraint violation: 1048 Column &apos;id&apos; cannot be null 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Linux (2.6.21 kernel)&lt;br/&gt;
Apache/2.2.6&lt;br/&gt;
PHP 5.2.6&lt;br/&gt;
symfony version 1.4.1&lt;br/&gt;
doctrine 1.2</environment>
            <key id="10758">DC-443</key>
            <summary>Incorrect insert order in i18n entities</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="rodrigobb">Rodrigo Borrego Bernab&#233;</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Jan 2010 11:29:13 +0000</created>
                <updated>Fri, 22 Jan 2010 11:29:13 +0000</updated>
                                                                    <component>I18n</component>
                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10308" name="i18nrelation_problem.tgz" size="27753" author="rodrigobb" created="Fri, 22 Jan 2010 11:29:13 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-447] Problem linking many-to-many relationships</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-447</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Here&apos;s a small usage example of linking many-to-many relationships. The group is not linked with the user after calling link() as can be seen by comparing the group ids before and after the call.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;User:
  tableName: users
  columns:
    username:      { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    email:         { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
  indexes:
    username_idx:
      fields: [username]
      type:   unique
    email_idx:
      fields: [email]
      type:   unique
  actAs: [Timestampable]
  relations:
    groups:
      class:    Group
      alias:    Groups
      refClass: UserGroupRelation

Group:
  tableName: groups
  columns:
    name: { type: string(255), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
  actAs: [Timestampable, NestedSet]
  relations:
    users:
      class:    User
      alias:    Users
      refClass: UserGroupRelation

UserGroupRelation:
  tableName: user_group_relations
  columns:
    user_id:  { type: integer, notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    group_id: { type: integer, notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
  relations:
    Group:
      class:        Group
      foreignAlias: UserGroupRelations
      onDelete:     CASCADE
    User:
      class:        User
      foreignAlias: UserGroupRelations
      onDelete:     CASCADE
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;test.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$u = Doctrine_Core::getTable(&apos;User&apos;)-&amp;gt;findOneByUsername(&apos;james&apos;);
$g = Doctrine_Core::getTable(&apos;Group&apos;)-&amp;gt;findOneByName(&apos;group&apos;);
var_dump($g[&apos;id&apos;]);
$current = array();
foreach ($u[&apos;UserGroupRelations&apos;] as $r) {
    $current[] = $r[&apos;group_id&apos;];
}
var_dump($current);
$u-&amp;gt;link(&apos;Groups&apos;, array($g[&apos;id&apos;]), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
$u = Doctrine_Core::getTable(&apos;User&apos;)-&amp;gt;findOneByUsername(&apos;james&apos;);
$current = array();
foreach ($u[&apos;UserGroupRelations&apos;] as $r) {
    $current[] = $r[&apos;group_id&apos;];
}
var_dump($current);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Output&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;2&quot;&lt;/span&gt;
array(3) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;1&quot;&lt;/span&gt;
  [1]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;5&quot;&lt;/span&gt;
  [2]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;6&quot;&lt;/span&gt;
}
array(3) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;1&quot;&lt;/span&gt;
  [1]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;5&quot;&lt;/span&gt;
  [2]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;6&quot;&lt;/span&gt;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; </description>
                <environment>Windows Vista x86 SP2, PHP 5.2.x</environment>
            <key id="10773">DC-447</key>
            <summary>Problem linking many-to-many relationships</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="ree">Rytis Daugirdas</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Jan 2010 08:57:18 +0000</created>
                <updated>Mon, 25 Jan 2010 09:00:18 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-449] Duplicate entry integrity constraint error when updating Searchable record with indexed fields from a template</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-449</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have the following:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php
class JS_Page &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;page&apos;);
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumns(array(
			&apos;id&apos; =&amp;gt; array(
				&apos;type&apos;		=&amp;gt; &apos;integer&apos;,
				&apos;length&apos;	=&amp;gt; 4,
				&apos;primary&apos;	=&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
				&apos;autoincrement&apos;	=&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
			),
			&apos;content&apos; =&amp;gt; array(
				&apos;type&apos;		=&amp;gt; &apos;array&apos;,
				&apos;length&apos;	=&amp;gt; 65536,
				&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; array(),
			),
		));
	}

	&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;actAs(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; JS_Template_Meta());
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;actAs(&apos;Searchable&apos;, array(
			&apos;fields&apos;	=&amp;gt; array(&apos;title&apos;, &apos;description&apos;, &apos;keywords&apos;),
			&apos;tableName&apos;	=&amp;gt; &apos;page_index&apos;,
		));
	}
}

class JS_Template_Meta &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Template
{
	&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;hasColumns(array(
			&apos;title&apos; =&amp;gt; array(
				&apos;type&apos;		=&amp;gt; &apos;string&apos;,
				&apos;length&apos;	=&amp;gt; 255,
				&apos;notnull&apos;	=&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
			),
			&apos;description&apos; =&amp;gt; array(
				&apos;type&apos;		=&amp;gt; &apos;string&apos;,
			),
			&apos;keywords&apos; =&amp;gt; array(
				&apos;type&apos;		=&amp;gt; &apos;string&apos;,
				&apos;length&apos;	=&amp;gt; 255,
			),
		));
	}
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When a Page record is updated I get this error:&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;SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry &apos;application-title-0-3&apos; &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; key 1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If I only index fields from Page it works.&lt;/p&gt;

&lt;p&gt;I tracked this down to the code in Doctrine_Search that deletes the existing indexed data before re-indexing a record (I&apos;m not using batchUpdate). For reasons I don&apos;t understand the DELETE query is not executing correctly before re-indexing, and so any unchanged data is being added to the index twice, causing the error.&lt;/p&gt;

&lt;p&gt;I managed to work around this by adding my own template and listener before Searchable, with a preSave event that deletes the index data:&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;this&lt;/span&gt;-&amp;gt;actAs(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; JS_Template_Searchable());
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;actAs(&apos;Searchable&apos;, array(
			&apos;fields&apos;	=&amp;gt; array(&apos;title&apos;, &apos;description&apos;, &apos;keywords&apos;),
			&apos;tableName&apos;	=&amp;gt; &apos;page_index&apos;,
		));
...

class JS_Template_Searchable &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Template
{
	&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;addListener(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; JS_Template_Searchable_Listener());
	}
}

class JS_Template_Searchable_Listener &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record_Listener
{
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preSave(Doctrine_Event $event)
	{
		$invoker = $event-&amp;gt;getInvoker();
		$class = get_class($invoker) . &apos;Index&apos;;
		$query = Doctrine_Query::create()
			-&amp;gt;delete()
			-&amp;gt;from(&lt;span class=&quot;code-quote&quot;&gt;&quot;{$class} i&quot;&lt;/span&gt;)
			-&amp;gt;where(&lt;span class=&quot;code-quote&quot;&gt;&quot;i.id = ?&quot;&lt;/span&gt;, $invoker[&apos;id&apos;])
			-&amp;gt;execute();
	}
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Obviously that&apos;s an ugly hack, but it works.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10775">DC-449</key>
            <summary>Duplicate entry integrity constraint error when updating Searchable record with indexed fields from a template</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jacksleight">Jack Sleight</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Jan 2010 10:56:49 +0000</created>
                <updated>Mon, 25 Jan 2010 10:58:24 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-450] ORACLE: The generate DQL with i18n behavior doesn&apos;t correct</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-450</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;My schema:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;---
Country:
  tableName:          country
  actAs:
    SoftDelete:       ~
    Timestampable:    ~
    I18n:
      fields:         [name]
      className:      %CLASS%I18n
      tableName:      %TABLE%_i18n
      length:         5
  columns:
    id:
      type:           integer(3)
      primary:        true
      unsigned:       true
      sequence:       country
    created_at:
      type:           timestamp
    updated_at:
      type:           timestamp
    enabled_at:
      type:           timestamp
      notnull:        true
    disabled_at:
      type:           timestamp
    iso_code:
      type:           string(2)
    marc_code:
      type:           string(3)
    name:
      type:           string(255)
      notnull:        true
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;DQL query:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
$country = Doctrine::getTable(&apos;Country&apos;)-&amp;gt;findOneByMarcCode(&apos;sz&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Error:&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; 
ORA-00904: &lt;span class=&quot;code-quote&quot;&gt;&quot;C&quot;&lt;/span&gt;.&lt;span class=&quot;code-quote&quot;&gt;&quot;NAME&quot;&lt;/span&gt;: invalid identifier : SELECT a.* FROM ( SELECT c.id AS c__id, c.created_at AS c__created_at, c.updated_at AS c__updated_at, c.enabled_at AS 
c__enabled_at, c.disabled_at AS c__disabled_at, c.iso_code AS c__iso_code, c.marc_code AS c__marc_code, c.name AS c__name, c.deleted_at AS c__deleted_at FROM
common.country c WHERE (c.marc_code = :oci_b_var_1) ) a WHERE ROWNUM &amp;lt;= 1 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;In this line, i show the field &quot;name&quot;, but this field is in table translation. The DQL above is very complicated for only simple request. Why ?&lt;/p&gt;

&lt;p&gt;Thank&apos;s&lt;/p&gt;

&lt;p&gt;Bertrand&lt;/p&gt;</description>
                <environment></environment>
            <key id="10776">DC-450</key>
            <summary>ORACLE: The generate DQL with i18n behavior doesn&apos;t correct</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="garfield-fr">Bertrand Zuchuat</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Jan 2010 11:22:54 +0000</created>
                <updated>Thu, 18 Mar 2010 06:54:44 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>I18n</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12323" author="garfield-fr" created="Thu, 18 Mar 2010 06:54:44 +0000"  >&lt;p&gt;I don&apos;t have a real connection on Oracle Server. This test doesn&apos;t return the error above.&lt;/p&gt;

&lt;p&gt;Please test on real connection.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10491" name="DC450TestCase.php" size="4518" author="garfield-fr" created="Thu, 18 Mar 2010 06:53:00 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-451] preDql events on connection &amp; manager level</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-451</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I think it would be very helpful if the preDql events also worked on connection and manager level. If it is anyway possible.&lt;/p&gt;

&lt;p&gt;attach a record listener to a connection object, and it should also call the preDql events when doing DQL queries.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10777">DC-451</key>
            <summary>preDql events on connection &amp; manager level</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="sune">Sune Kibsgaard Pedersen</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Jan 2010 14:08:30 +0000</created>
                <updated>Mon, 25 Jan 2010 14:08:30 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-453] Joined records stated as dirty (whereas they are not modified)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-453</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When you retrieve records like this:&lt;/p&gt;

&lt;p&gt;(Here I have Labels, that have Albums)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;    $lab = Doctrine::getTable(&apos;Label&apos;)-&amp;gt;createQuery(&apos;lab&apos;)&lt;br/&gt;
      -&amp;gt;leftJoin(&apos;lab.Albums alb&apos;)&lt;br/&gt;
      -&amp;gt;select(&apos;lab.id, alb.id&apos;)&lt;br/&gt;
      -&amp;gt;where(&apos;lab.id = ?&apos;, 1)&lt;br/&gt;
      -&amp;gt;fetchOne();&lt;/p&gt;&lt;/blockquote&gt; 

&lt;p&gt;$lab-&amp;gt;state() is STATE_PROXY : it&apos;s ok, properties are not all loaded from the DB and the object is not modified&lt;/p&gt;

&lt;p&gt;BUT $lab-&amp;gt;Albums&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;state() is STATE_DIRTY : why ? the object is not modified...&lt;/p&gt;

&lt;p&gt;This causes real problems, because this way, joined objects unloaded properties are corrupted : it really behaves like they all are &quot;null&quot;, and that&apos;s all. Their real values are never loaded from the DB.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10780">DC-453</key>
            <summary>Joined records stated as dirty (whereas they are not modified)</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="theredled">Beno&#238;t Guchet</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Jan 2010 10:31:37 +0000</created>
                <updated>Thu, 29 Jul 2010 15:58:54 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12244" author="theredled" created="Mon, 15 Mar 2010 16:51:14 +0000"  >&lt;p&gt;No way to correct that ?&lt;/p&gt;</comment>
                    <comment id="12245" author="jwage" created="Mon, 15 Mar 2010 16:54:24 +0000"  >&lt;p&gt;Can you provide a test case? are you sure it is dirty or you had the object instance prior to the query and it was dirty there?&lt;/p&gt;</comment>
                    <comment id="12248" author="theredled" created="Mon, 15 Mar 2010 17:09:30 +0000"  >&lt;p&gt;Actually the given sample code is written to be a test case (Label/Albums can be any other basic Parent/Children relation). &lt;br/&gt;
You retrieve an object, join a child relation, selects only some fields from the children =&amp;gt; those children are Dirty.&lt;/p&gt;

&lt;p&gt;Yes I&apos;m sure it is dirty, the Album object does not exist before that, the script does nothing else than this query. The object was born dirty, so to speak.&lt;/p&gt;</comment>
                    <comment id="12249" author="jwage" created="Mon, 15 Mar 2010 17:12:41 +0000"  >&lt;p&gt;Sorry, I meant a Doctrine unit test case. Not just some pasted code in the issue.&lt;/p&gt;</comment>
                    <comment id="13731" author="mstrzele" created="Thu, 29 Jul 2010 15:58:54 +0000"  >&lt;p&gt;I have the same problem, but I have a deeper relation. The clue of it is that, that  in Albums&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; is setting id of relation with lab.id (cause of that change STATE_DIRTY is set), and after that operation getModiefied method return array with one element &lt;br/&gt;
array(&lt;br/&gt;
  id =&amp;gt; lab.id&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;The bug is that, that in releted object after hydration setting releted id changing state of record -&amp;gt; it is wrong behavior, becaus nothing changed -&amp;gt; record has releted id with value, which is exactly the same as in DB.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-467] Can&apos;t create root node if multiple roots and primary key have multiple columns</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-467</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When trying to create new root node, the following exception is thrown.&lt;/p&gt;

&lt;p&gt;PHP Fatal error:  Uncaught exception &apos;Doctrine_Tree_Exception&apos; with message &apos;Node must have a root id set or must  be persistent and have a single-valued numeric primary key in order to be created as a root node. Automatic assignment of a root id on transient/new records is no longer supported.&apos;&lt;/p&gt;

&lt;p&gt;This only happens when hasManyRoots is true, and table have multiple columns in primary key.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;$category = new Menu();&lt;br/&gt;
$category-&amp;gt;name = &apos;Menu Root&apos;;&lt;br/&gt;
$category-&amp;gt;language_id = 1;&lt;br/&gt;
$category-&amp;gt;root_id = 23;&lt;br/&gt;
$category-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;$treeObject = Doctrine::getTable(&apos;Menu&apos;)-&amp;gt;getTree();&lt;br/&gt;
$treeObject-&amp;gt;createRoot($category);&lt;/p&gt;


&lt;p&gt;and menu table is defined as follows:&lt;/p&gt;

&lt;p&gt;       $this-&amp;gt;hasColumn(&apos;id&apos;, &apos;integer&apos;, 8, array(&lt;br/&gt;
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,&lt;br/&gt;
             &apos;primary&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;autoincrement&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;length&apos; =&amp;gt; &apos;8&apos;,&lt;br/&gt;
        ));&lt;br/&gt;
        $this-&amp;gt;hasColumn(&apos;language_id&apos;, &apos;integer&apos;, 8, array(&lt;br/&gt;
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,&lt;br/&gt;
             &apos;primary&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;length&apos; =&amp;gt; &apos;8&apos;,&lt;br/&gt;
        ));&lt;/p&gt;

&lt;p&gt;If i remove primary option from language_id column, everything works as it should.&lt;/p&gt;</description>
                <environment>Linux, PostgreSQL</environment>
            <key id="10817">DC-467</key>
            <summary>Can&apos;t create root node if multiple roots and primary key have multiple columns</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="liquidbrain">Milan Cvejic</reporter>
                        <labels>
                    </labels>
                <created>Mon, 1 Feb 2010 05:31:16 +0000</created>
                <updated>Fri, 16 Apr 2010 12:17:22 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-473] createIndexSql() and dropIndexSql() use different index names (formatter) on MySQL and Postgres</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-473</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;While playing with createIndexSql() and dropIndexSql() i noticed, that the pgsql implementation differs from mysql. The index names usually are build with a &apos;_idx&apos; after the name. This is done through the formatter, i guess.&lt;/p&gt;

&lt;p&gt;I noticed, that in Doctrine_Export class the createIndexSql() method does not use the formatter, while dropIndexSql() do. So creating and dropping indexes on pgsql (in my case) fails because of the different names. It does work on mysql, because Doctrine_Export_Mysql class uses it&apos;s own createIndexSql() method where the formatter is used.&lt;/p&gt;

&lt;p&gt;Michael&lt;/p&gt;</description>
                <environment>Postgres 8.3, MySQL 5.0</environment>
            <key id="10825">DC-473</key>
            <summary>createIndexSql() and dropIndexSql() use different index names (formatter) on MySQL and Postgres</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="michael.piecko">Michael Piecko</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Feb 2010 11:34:56 +0000</created>
                <updated>Tue, 8 Jun 2010 17:04:37 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12256" author="jwage" created="Mon, 15 Mar 2010 17:47:46 +0000"  >&lt;p&gt;Hi, can you provide either a patch or failing test case that shows the issue so that I can write a patch for it? Thanks, Jon&lt;/p&gt;</comment>
                    <comment id="12314" author="michael.piecko" created="Thu, 18 Mar 2010 03:44:00 +0000"  >&lt;p&gt;I must admit that i never did that (patch). And i know i should. I&apos;ll work on that over the weekend.&lt;/p&gt;

&lt;p&gt;Michael&lt;/p&gt;</comment>
                    <comment id="13218" author="jwage" created="Tue, 8 Jun 2010 17:04:37 +0000"  >&lt;p&gt;You can just make your changes and then run svn diff in the Doctrine directory and it will produce a patch/diff which you can attach here.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-476] PHP&apos;s is_subclass_of function causing failure in some contexts</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-476</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have a suspicion that this is related to issue: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-386&quot; title=&quot;Doctrine_Hydrator_ArrayDriver may segfault Php when loaded by Zend Framework Autoloader&quot;&gt;DC-386&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bug manifested its-self  by bailing with no php error output when calling Doctrine_Pager::execute() in php 5.2.10 (5.3 appears to work - Mac OS X while 5.2.10 fail on ubuntu and centos).&lt;/p&gt;

&lt;p&gt;I traced this down to Doctrine_Record::processPendingFields(), the offending line number is #477.&lt;/p&gt;

&lt;p&gt;Interestingly, if I call is_subclass_of() with exactly the same params in my view just prior to calling Doctrine_Pager::execute()  in my code, the error does not present its-self , i.e. I&apos;b adding the following code :&lt;/p&gt;

&lt;p&gt;is_subclass_of(&apos;Doctrine_Hydrator_RecordDriver&apos;, &apos;Doctrine_Hydrator_Graph&apos;);&lt;/p&gt;

&lt;p&gt;It can also be avoided by calling Doctrine_Pager::getQuery()-&amp;gt;getQuerySql(); and no doubt other code paths which change the environment in some way.&lt;/p&gt;
</description>
                <environment>php 5.2.10 on both CentOS 5.4 and Ubuntu 9.10</environment>
            <key id="10828">DC-476</key>
            <summary>PHP&apos;s is_subclass_of function causing failure in some contexts</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="pchapman">Peter Chapman</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Feb 2010 16:18:24 +0000</created>
                <updated>Fri, 30 Apr 2010 11:04:48 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-478] Having a default value in a decimal field in base class forces Doctrine to try to save an instance even if not required.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-478</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have 2 classes. Order and Branch. An Order class can have one or no branch assigned to it. My base class definition for a branch is simple. It just has a name. &lt;/p&gt;

&lt;p&gt;The Order class has:&lt;br/&gt;
$this-&amp;gt;hasColumn(&apos;branchId&apos;, &apos;integer&apos;);&lt;/p&gt;

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

&lt;p&gt;$this-&amp;gt;hasOne(&lt;br/&gt;
            &apos;Fds_Model_Branch as branch&apos;, &lt;br/&gt;
            array(&lt;br/&gt;
                &apos;local&apos; =&amp;gt; &apos;branchId&apos;,&lt;br/&gt;
                &apos;foreign&apos; =&amp;gt; &apos;id&apos;,&lt;br/&gt;
            )&lt;br/&gt;
        );&lt;/p&gt;

&lt;p&gt;The branch class had this:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;hasColumn(&apos;name&apos;, &apos;string&apos;, 50, array(&lt;br/&gt;
            &apos;notnull&apos; =&amp;gt; true,&lt;br/&gt;
            &apos;notblank&apos; =&amp;gt; true,&lt;br/&gt;
        ));&lt;/p&gt;

&lt;p&gt;No hasMany relation back to Orders.&lt;/p&gt;

&lt;p&gt;Using this setup, all my tests work.&lt;/p&gt;

&lt;p&gt;I added this to the Branch class.&lt;br/&gt;
$this-&amp;gt;hasColumn(&lt;br/&gt;
            &apos;localTax&apos;, &apos;decimal&apos;, null, &lt;br/&gt;
            array(&lt;br/&gt;
                &apos;notnull&apos; =&amp;gt; true,&lt;br/&gt;
                &apos;default&apos; =&amp;gt; 0,&lt;br/&gt;
            )&lt;br/&gt;
        );&lt;/p&gt;

&lt;p&gt;Now my tests fail with a validator error from the branch class for the name property whenever I try to save an order that has no branch associated to it. Pretty weird right? I mean, my order has no branch, and yet Doctrine tries to save one.&lt;/p&gt;

&lt;p&gt;But if I change the definition of localTax to this:&lt;br/&gt;
$this-&amp;gt;hasColumn(&apos;localTax&apos;, &apos;decimal&apos;);&lt;/p&gt;

&lt;p&gt;Then my tests work as expected again. Problem is, I need to assign the default value of 0 to localTax instead of null. &lt;/p&gt;

&lt;p&gt;Is this a bug?&lt;/p&gt;</description>
                <environment>Linux, PHP 5.3</environment>
            <key id="10834">DC-478</key>
            <summary>Having a default value in a decimal field in base class forces Doctrine to try to save an instance even if not required.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bzarzuela">Bryan Zarzuela</reporter>
                        <labels>
                    </labels>
                <created>Thu, 4 Feb 2010 09:49:13 +0000</created>
                <updated>Thu, 4 Feb 2010 09:49:13 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-485] Limit gets lost when doing self join</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-485</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;hi doctrine team,&lt;br/&gt;
today I encountered a very weird problem when I tried to do a selfjoin on a table. the goal was to list all people that have the same addresses but limit the result to 5&lt;/p&gt;

&lt;p&gt;the problem was, that the doctrine split it into 2 querys and first selected the correct address ids with the Limit 5. but in the second query the limit is lost. which gives me more than 5 results if a few people have the same address&lt;/p&gt;

&lt;p&gt;the DQL looks like this&lt;/p&gt;

&lt;p&gt;        $q = DQ::create()&lt;br/&gt;
         -&amp;gt;from(&apos;address a INNER JOIN a.shared b ON a.city = b.city AND a.street = b.street&apos;)&lt;br/&gt;
         -&amp;gt;innerJoin(&apos;b.entity e&apos;)&lt;br/&gt;
         -&amp;gt;where(&apos;a.entity_id = ? AND a.is_active = ?&apos;, array($id, $is_active))&lt;br/&gt;
         -&amp;gt;limit(5)&lt;br/&gt;
         -&amp;gt;offset(0);&lt;/p&gt;

&lt;p&gt;SQL looks like this:&lt;/p&gt;

&lt;p&gt;SELECT * FROM address a &lt;br/&gt;
INNER JOIN address a2 ON ((a.city = a2.city AND a.street = a2.street)) &lt;br/&gt;
INNER JOIN entity e ON a2.entity_id = e.id &lt;br/&gt;
WHERE a.id IN (&apos;5689677&apos;) AND (a.entity_id = ? AND a.is_active = ?)&lt;/p&gt;

&lt;p&gt;Problem: Limit 5 is gone&lt;/p&gt;

&lt;p&gt;expected was something like this:&lt;/p&gt;

&lt;p&gt;SELECT *&lt;br/&gt;
FROM address a&lt;br/&gt;
INNER JOIN address b ON a.city = b.city AND a.street = b.street &lt;br/&gt;
INNER JOIN entity e ON b.entity_id = e.id&lt;br/&gt;
where a.entity_id = 104294414&lt;br/&gt;
limit 5&lt;/p&gt;

&lt;p&gt;my temporary solution:&lt;/p&gt;

&lt;p&gt;        $q = new Doctrine_RawSql();&lt;br/&gt;
        $q-&amp;gt;select(&apos;&lt;/p&gt;
{b.*}
&lt;p&gt;, &lt;/p&gt;
{e.*}
&lt;p&gt;, &lt;/p&gt;
{p.*}
&lt;p&gt;&apos;);&lt;br/&gt;
        $q-&amp;gt;from(&apos;address a INNER JOIN address b ON a.city = b.city AND a.street = b.street&lt;br/&gt;
            INNER JOIN entity e ON b.entity_id = e.id&lt;br/&gt;
            INNER JOIN person p ON e.id = p.entity_id&apos;);&lt;br/&gt;
        $q-&amp;gt;where(&apos;a.entity_id = ? AND a.is_active = ?&apos;, array($id, $isActive));&lt;br/&gt;
        $q-&amp;gt;addComponent(&apos;a&apos;, &apos;address a&apos;);&lt;br/&gt;
        $q-&amp;gt;addComponent(&apos;b&apos;, &apos;a.shared b&apos;);&lt;br/&gt;
        $q-&amp;gt;addComponent(&apos;e&apos;, &apos;b.entity e&apos;);&lt;br/&gt;
        $q-&amp;gt;addComponent(&apos;p&apos;, &apos;e.person p&apos;);&lt;br/&gt;
        $q-&amp;gt;limit($limit);&lt;br/&gt;
        $q-&amp;gt;offset($offset);&lt;/p&gt;

&lt;p&gt;my schema.yml is attached, do you need anything else?&lt;/p&gt;</description>
                <environment>os x, snow leopard,</environment>
            <key id="10851">DC-485</key>
            <summary>Limit gets lost when doing self join</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="nicam">Pascal Helfenstein</reporter>
                        <labels>
                    </labels>
                <created>Mon, 8 Feb 2010 10:53:16 +0000</created>
                <updated>Mon, 8 Feb 2010 11:06:41 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10357" name="schema.yml" size="2786" author="nicam" created="Mon, 8 Feb 2010 11:06:33 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-486] Taggable extension bound to inherited class also binds to all classes, which extend the base one</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-486</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;This is my schema.yml:&lt;/p&gt;

&lt;p&gt;Tale:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Taggable:&lt;br/&gt;
  columns: # there are some not interesting columns&lt;/p&gt;

&lt;p&gt;FolkTale:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Tale&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyValue: folk&lt;br/&gt;
  columns:&lt;br/&gt;
    folk_id: integer&lt;br/&gt;
  relations:&lt;br/&gt;
    Folk:&lt;br/&gt;
      class: Folk&lt;br/&gt;
      local: folk_id&lt;br/&gt;
      foreign: id&lt;br/&gt;
      type: one&lt;br/&gt;
      onDelete: CASCADE&lt;/p&gt;

&lt;p&gt;AuthoredTale:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Tale&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyValue: authored&lt;br/&gt;
  columns:&lt;br/&gt;
    author_id: integer&lt;br/&gt;
  relations:&lt;br/&gt;
    Author:&lt;br/&gt;
      class: Author&lt;br/&gt;
      local: author_id&lt;br/&gt;
      foreign: id&lt;br/&gt;
      type: one&lt;br/&gt;
      onDelete: CASCADE&lt;/p&gt;

&lt;p&gt;When I do ./symfony doctrine:build --all  I see three *_taggable_tag table in my DB (folk_tale_taggable_tag, authored_tale_taggable_tag and tale_tag) instead of expected one tale_tag.&lt;/p&gt;</description>
                <environment>php5.2.11, symfony 1.4, Doctrine 1.2, Taggable 1.0 </environment>
            <key id="10852">DC-486</key>
            <summary>Taggable extension bound to inherited class also binds to all classes, which extend the base 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="enlightened">Alexander Panshin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 8 Feb 2010 12:54:40 +0000</created>
                <updated>Mon, 8 Feb 2010 12:54:40 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Extensions</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-496] Doctrine should warn when a columns / table name match a reserved word</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-496</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Today i looked for quite a long time why doctrine doesn&apos;t acte like i wish...&lt;/p&gt;

&lt;p&gt;it turns out that it was because of a column named &apos;system_id&apos;... doctrine use this for internal use.&lt;/p&gt;

&lt;p&gt;no pbm with that, but please notify users that they will experience pbm when a column or table name match X or Y or Z.&lt;/p&gt;

&lt;p&gt;i&apos;ve experienced pbm with : table_name, system_id, and some other id too.&lt;/p&gt;</description>
                <environment>Linux / ALL</environment>
            <key id="10879">DC-496</key>
            <summary>Doctrine should warn when a columns / table name match a reserved word</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="emerzh">Brice Maron</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Feb 2010 13:58:37 +0000</created>
                <updated>Fri, 12 Feb 2010 13:58:37 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-499] Doctrine_Query_Set incorrectly rewrites expressions</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-499</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;First up Doctrine_Query_Set should extend Doctrine_Query_Condition so that the parseLiteralValue method is available in _processPossibleAggExpression().&lt;/p&gt;

&lt;p&gt;However I am not sure what this method is really supposed to do. It seems to do some reordering of clauses, but in my case it actually drops off some parts of my expression:&lt;br/&gt;
            Doctrine_Query::create()&lt;br/&gt;
                -&amp;gt;update(&apos;Document&apos;)&lt;br/&gt;
                -&amp;gt;set(&apos;clause_ordering&apos;, &quot;IF(clause_ordering IS NULL, &apos;$id&apos;, CONCAT(clause_ordering, &apos;,$id&apos;))&quot;)&lt;br/&gt;
                -&amp;gt;where(&apos;id = ?&apos;, $document_id)&lt;br/&gt;
                -&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;Results in &quot;UPDATE document SET clause_ordering = IF(clause_ordering IS NULL, &apos;67&apos;, CONCAT(clause_ordering)) WHERE (id = ?)&quot;&lt;/p&gt;

&lt;p&gt;And not as expected &quot;UPDATE document SET clause_ordering = IF(clause_ordering IS NULL, &apos;67&apos;, CONCAT(clause_ordering, &apos;,67&apos;)) WHERE (id = ?)&quot;&lt;/p&gt;

&lt;p&gt;Adding a space after IF and CONCAT fixes the issue, but is obviously a hack to get around the regexp in _processPossibleAggExpression()&lt;/p&gt;</description>
                <environment></environment>
            <key id="10890">DC-499</key>
            <summary>Doctrine_Query_Set incorrectly rewrites expressions</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="lsmith">Lukas Kahwe</reporter>
                        <labels>
                    </labels>
                <created>Sun, 14 Feb 2010 11:27:55 +0000</created>
                <updated>Fri, 4 Feb 2011 13:38:04 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13371" author="raphox" created="Sat, 19 Jun 2010 15:23:57 +0000"  >&lt;p&gt;Guilherme,&lt;br/&gt;
Como eu sei que voc&#234; fala portuguese e I dont speek english, vou falar em portugu&#234;s mesmo. Qualquer coisa voc&#234; traduz.&lt;/p&gt;

&lt;p&gt;Implementei uma solu&#231;&#227;o meio nebulosa aqui: &lt;a href=&quot;http://pastie.org/1011675&quot; class=&quot;external-link&quot;&gt;http://pastie.org/1011675&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O que esta pegando &#233; a express&#227;o regular. Ela n&#227;o esta aceitando muito bem quando existe na &quot;$hasAggExpression&quot; argumentos separados por v&#237;rgula.&lt;br/&gt;
O meu teste foi um pouco diferente do que o criado pelo Lukas. Veja:&lt;/p&gt;

&lt;p&gt;-&amp;gt;set(&apos;p.tempo_atual&apos;, &apos;IFNULL(p.tempo_atual, p.lance_tempo) - 1&apos;)&lt;/p&gt;

&lt;p&gt;Na implementa&#231;&#227;o atual ele descarto o segundo argumento do IFNULL(). N&#227;o tenho certeza se minha proposta de implementa&#231;&#227;o &#233; correta. n&#227;o entendi muito bem o funcionamento do preg_match_all. Ao meu ver ele sempre retornaria apenas a posicao 0, mas foi uitlizado um foreach, n&#227;o entendi o pq. Ent&#227;o como esta com foreach eu deixei e coloquei uma &apos;glue&apos; vari&#225;vel para o implode no final.&lt;/p&gt;</comment>
                    <comment id="15229" author="overond" created="Fri, 4 Feb 2011 13:38:04 +0000"  >&lt;p&gt;Tem como ignorar esta verifica&#231;&#227;o? Pq o que esta acontecendo e que se eu digitar numa frase, exemplo, &quot; teste( 89,0%), &quot;  o doctrine pensa que &#233; uma express&#227;o, como evitar isto?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-501] Join and WITH keywords : documentation is confusing</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-501</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Your documentation makes no sense to me on the usage of the WITH keyword&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_1/en/dql-doctrine-query-language:join-syntax#with-keyword&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_1/en/dql-doctrine-query-language:join-syntax#with-keyword&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$q = Doctrine_Query::create()
  -&amp;gt;select(&apos;u.id, p.id&apos;)
  -&amp;gt;from(&apos;User u&apos;)
  -&amp;gt;leftJoin(&apos;u.Phonenumbers p WITH u.id = 2&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;Get Users and the phone numbers if any of the user 2 (we could indeed need that kind of query)&lt;/p&gt;


&lt;p&gt;-----------------------------------------------------------------------------------------------------------------------------------&lt;br/&gt;
I guess this kind of example query is better &lt;/p&gt;

&lt;p&gt;// Documentation&lt;br/&gt;
Get users and their mobile phone numbers if any&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$q = Doctrine_Query::create()
  -&amp;gt;select(&apos;u.id, p.id&apos;)
  -&amp;gt;from(&apos;User u&apos;)
  -&amp;gt;leftJoin(&apos;u.Phonenumbers p WITH p.type = ?&apos;, &apos;mobile&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;you can expect this SQL&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;SELECT 
u.id AS u__id, 
p.id AS p__id 
FROM User u 
LEFT JOIN Phonenumbers p ON u.id = p.user_id AND p.type = &apos;mobile&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 


&lt;p&gt;// Still in the documentation&lt;br/&gt;
Be aware that this query is different of&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$q = Doctrine_Query::create()
  -&amp;gt;select(&apos;u.id, p.id&apos;)
  -&amp;gt;from(&apos;User u&apos;)
  -&amp;gt;leftJoin(&apos;u.Phonenumbers p&apos;)
  -&amp;gt;where(&apos;p.type = ?&apos;, &apos;mobile&apos;)
;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;because you will strip away the users who do not have a mobile phone number&lt;/p&gt;

&lt;p&gt;-----------------&lt;br/&gt;
Also the second example is more confusing ...&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$q = Doctrine_Query::create()
    -&amp;gt;select(&apos;u.id&apos;)
    -&amp;gt;from(&apos;User u&apos;)
    -&amp;gt;leftJoin(&apos;u.Groups g&apos;)
    -&amp;gt;innerJoin(&apos;u.Phonenumbers p WITH u.id &amp;gt; 3&apos;)
    -&amp;gt;leftJoin(&apos;u.Email e&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Means : Get Users (who HAVE Phonenumbers (innerJoin)) with their potential (leftJoin) Groups, potential (leftJoin) Emails, and their Phonenumbers&lt;br/&gt;
but not for the Users 1, 2 and 3&lt;/p&gt;

&lt;p&gt;Not really the straight forward example we can expect in a documentation&lt;/p&gt;

&lt;p&gt;Best regards&lt;/p&gt;</description>
                <environment></environment>
            <key id="10897">DC-501</key>
            <summary>Join and WITH keywords : documentation is confusing</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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="julien.b">Julien B.</reporter>
                        <labels>
                    </labels>
                <created>Mon, 15 Feb 2010 12:26:37 +0000</created>
                <updated>Mon, 15 Feb 2010 12:28:15 +0000</updated>
                                    <version>1.1.6</version>
                                                <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-502] sometimes not all the constraints are created for a many to many relation</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-502</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;it seems that the naming is important:&lt;/p&gt;

&lt;p&gt;in a User, Group, UserGroup relation (where the UserGroup defines the many to many relation for User &amp;amp; Group) the constraints are defined well&lt;/p&gt;

&lt;p&gt;but if the tables are Order, Service, OrderService it doesn&apos;t work =&amp;gt; just one constraint is created... please find my example:&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;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Order:
  tableName:          orders
  columns:
    name:             string(50)
  relations:
    Services:
      class:          Service
      local:          order_id
      foreign:        service_id
      refClass:       OrderService

Service:
  actAs:
    Versionable:      ~
  columns:
    name:             string(50)
  relations:
    Orders:
      class:          Order
      local:          service_id
      foreign:        order_id
      refClass:       OrderService

# WTF: it takes alphbetically the constraints building  !?
# &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; I used ZorderService instead of OrderService, Z is after S (O is before S) the constraints are defined fine!
OrderService:
  columns:
    order_id:         { type: integer, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    service_id:       { type: integer, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }

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

&lt;p&gt; ==&amp;gt; the generated SQL &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;sql&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;CREATE TABLE orders (id BIGINT AUTO_INCREMENT, name VARCHAR(50), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE order_service (order_id BIGINT, service_id BIGINT, version BIGINT, PRIMARY KEY(order_id, service_id, 
        version)) ENGINE = INNODB;
CREATE TABLE service_version (id BIGINT, name VARCHAR(50), version BIGINT, PRIMARY KEY(id, version)) ENGINE = 
        INNODB;
CREATE TABLE service (id BIGINT AUTO_INCREMENT, name VARCHAR(50), version BIGINT, PRIMARY KEY(id)) ENGINE = 
        INNODB;
ALTER TABLE order_service ADD CONSTRAINT order_service_order_id_orders_id FOREIGN KEY (order_id) REFERENCES 
        orders(id);
ALTER TABLE service_version ADD CONSTRAINT service_version_id_service_id FOREIGN KEY (id) REFERENCES service(id) 
        ON UPDATE CASCADE ON DELETE CASCADE;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;=&amp;gt;  as you can see for TABLE order_service just one constraint is defined (&lt;b&gt;order_service_order_id_orders_id&lt;/b&gt;) the other one (&lt;b&gt;order_service_service_id_service_id&lt;/b&gt;) is missing !!!&lt;/p&gt;


&lt;p&gt;However if i change the names for tables (actually i think alphabetically order) and use ZorderService instead of OrderService (lik UserGroup for User &amp;amp; Group) the two constraints are created!&lt;/p&gt;

&lt;p&gt;This also affects the &quot;getRelations()&quot; when i tried to write a behavior (it gives back just one relation):&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 ($event-&amp;gt;getInvoker()-&amp;gt;getTable()-&amp;gt;getRelations() as $relation)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ps: &lt;br/&gt;
  also the same bug reported on the list: &lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/ad48db71b71e043b&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/ad48db71b71e043b&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;sub&gt;(edit G.X: split too long lines in SQL code)&lt;/sub&gt;&lt;/p&gt;</description>
                <environment>i tried both under linux / win; with doctrine 1.1 / 1.2.1&lt;br/&gt;
tried with sandbox / direct creating &amp;quot;bootstrap&amp;quot; =&amp;gt; same results...</environment>
            <key id="10899">DC-502</key>
            <summary>sometimes not all the constraints are created for a many to many relation</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="rich">Papp Richard</reporter>
                        <labels>
                    </labels>
                <created>Mon, 15 Feb 2010 15:18:01 +0000</created>
                <updated>Mon, 14 Jun 2010 03:38:30 +0000</updated>
                                    <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>
                <version>1.2.0-RC1</version>
                <version>1.2.0</version>
                <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Import/Export</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12720" author="ryba" created="Tue, 20 Apr 2010 14:36:59 +0000"  >&lt;p&gt;I seem to have a very similar issue. It is really annoying because no error feedback is given at any point...&lt;br/&gt;
In my case, one out of three many-to-many relations actually has its constraints created, the other two not.&lt;br/&gt;
However, if I take the file date/sql/schema.sql (I am working with Symfony 1.4.4) and run as an SQL query directly with my database, the constraints are created properly!&lt;/p&gt;

&lt;p&gt;So, with symfony, if I go:&lt;br/&gt;
$ symfony14 doctrine:build-model&lt;br/&gt;
$ symfony14 doctrine:build-sql&lt;br/&gt;
$ symfony14 doctrine:insert-sql&lt;br/&gt;
The model gets generated, the database gets generated, but several many-to-many constrains are missing.&lt;/p&gt;

&lt;p&gt;Then if I go:&lt;br/&gt;
$ symfony14 doctrine:build-model&lt;br/&gt;
$ symfony14 doctrine:build-sql&lt;br/&gt;
$ mysql -u user -p database &amp;lt; date/sql/schema.sql&lt;br/&gt;
The model gets generated, the database gets generated, and the constraints are in place.&lt;/p&gt;

&lt;p&gt;Hope this helps to have the problem fixed.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Piotrek&lt;/p&gt;</comment>
                    <comment id="13273" author="gx" created="Fri, 11 Jun 2010 08:47:19 +0000"  >&lt;p&gt;I do confirm this &quot;alphabetical-order exporting&quot; problem! (in 1.2 svn revision 7676)&lt;br/&gt;
(see also #&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-655&quot; title=&quot;When Export from Models to database is made some constraints may not be created&quot;&gt;DC-655&lt;/a&gt;)&lt;/p&gt;


&lt;p&gt;*&lt;b&gt;Edit:&lt;/b&gt;* I have gone closer through the functions calls and used a debugger, and the problem is actually logical;&lt;br/&gt;
it happens whenever a refClass of a many-to-many relation is parsed (and exported) before one or both of the linked classes.&lt;/p&gt;

&lt;p&gt;Let&apos;s take this schema (YAML is shorter, anyways the generated PHP models are not bugged):&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;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;---
LinkTable:
  columns:
    table1_id:
      primary: true
      type:    integer
    table2_id:
      primary: true
      type:    integer
Table1:
  relations:
    Table2:
      refClass: LinkTable
      local:    table1_id
      foreign:  table2_id
Table2:
  relations:
    Table1:
      refClass: LinkTable
      local:    table2_id
      foreign:  table1_id
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now if you call Doctrine_Core::createTablesFromModels() or Doctrine_Core::generateSqlFromModels(), consequent call to Doctrine_Export::exportSortedClassesSql() does a loop and calls exportClassesSql() for each model in alphabetical order; once a table has been exported, subsequent bindings of pending relations won&apos;t be &quot;retro-parsed&quot; for the export.&lt;/p&gt;

&lt;p&gt;I tried to compact the calls chain:&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;php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;/* IN CLASS Doctrine_Export (or child (connection export)) */

$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;exportSortedClassesSql($classes)
{
    FOREACH ($classes as $class) {
        $connection = Doctrine_Manager::getInstance()-&amp;gt;getConnectionForComponent($class);
        &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;        $sql =
        $connection-&amp;gt;export-&amp;gt;exportClassesSql($models = array($class))
        {
            FOREACH ($models as $name) {
                $record = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; $name();
                $table = $record-&amp;gt;getTable();
                &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;                $data = $table-&amp;gt;getExportableFormat()
                {
                    /* IN CLASS Doctrine_Table (or child) */
                    
                    &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;                    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_parser-&amp;gt;getRelations()
                    {
                        /* IN CLASS Doctrine_Relation_Parser (or child) */
                        
                        FOREACH ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_pending as $alias =&amp;gt; $v) {
                            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getRelation($alias)
                            {
                                &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;                                /*
                                 * In the &lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; of an &lt;span class=&quot;code-quote&quot;&gt;&quot;association relation&quot;&lt;/span&gt; through a refTable:
                                 *   binds a *pending* (simple foreign key) relation to the refTable parser,
                                 *   binds a *pending* (simple foreign key) relation to itself,
                                 *   and &lt;span class=&quot;code-quote&quot;&gt;&quot;finalizes&quot;&lt;/span&gt; (adds to $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_relations) its association relation
                                 */
                            }
                        }
                    }
                    &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;                }
            }
        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;So, with our example schema,&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;LinkTable is exported with &lt;b&gt;no&lt;/b&gt; constraints (because has no relations at this time);&lt;/li&gt;
	&lt;li&gt;Table1 gets parsed, which finalizes the pending relation with Table2 (binded when loaded), binds to itself a pending relation with LinkTable, and binds to LinkTable parser the first &lt;b&gt;pending&lt;/b&gt; relation (with Table1); Table1 is then exported whilst it still has a pending relation;&lt;/li&gt;
	&lt;li&gt;Table2 gets parsed and exported the same way.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;So now we have 2 problems:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;each table has been exported immediately after its parsing, i.e. in an &lt;em&gt;incomplete state&lt;/em&gt; (&lt;b&gt;this is the present issue&lt;/b&gt;)&lt;/li&gt;
	&lt;li&gt;even after the whole relations parsing loop, LinkTable has still &lt;em&gt;2 pending relations&lt;/em&gt;, and each of both other tables has one &quot;final&quot; &lt;em&gt;and one pending&lt;/em&gt; (but maybe it is supposed to be so...)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note that a second call to Doctrine_Core::generateSqlFromModels() just after the first one, will parse all models one more time and thus finalize those pending relations, generating all constraints (also will subsequent calls).&lt;/p&gt;


&lt;p&gt;For now I don&apos;t have a fix but I think we could consider:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;loop twice in Doctrine_Export::exportSortedClassesSql() and exportClassesSql(), and construct SQL queries only the 2nd time (but... hum...)&lt;/li&gt;
	&lt;li&gt;improve Doctrine_Relation_Parser? maybe explicitly call getRelations() after each bind() (in the getRelation() function)...&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Anyway it seems clear that export shouldn&apos;t be done before all tables have been parsed.&lt;/p&gt;

&lt;p&gt;G.X&lt;/p&gt;</comment>
                    <comment id="13283" author="gx" created="Sat, 12 Jun 2010 16:17:25 +0000"  >&lt;p&gt;I still have no fix but in the waiting we can still discuss some &quot;user-side&quot; work-arounds (that don&apos;t need modifying Doctrine source code)...&lt;br/&gt;
Here is what crosses my mind first:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;(in the PHP working code) do a first &quot;dummy&quot; call to 
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$conn-&amp;gt;export-&amp;gt;exportClassesSql(Doctrine_Core::loadModels(&apos;models&apos;))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; just to ensure all relations are bound, then a &quot;real&quot; call to  &lt;tt&gt;Doctrine_Core::createTablesFromModels(&apos;models&apos;)&lt;/tt&gt; which will export all constraints well&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;(in the schema) rename &lt;em&gt;LinkTable&lt;/em&gt; to something like &lt;em&gt;ZzLinkTable&lt;/em&gt; so that it is exported last&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&quot;explicitize&quot; the two (one-to-many) foreign key relations in LinkTable by completing the schema as follows:
&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;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;---
LinkTable:
  columns:
    table1_id:
      primary: true
      type:    integer
    table2_id:
      primary: true
      type:    integer
#(added)
  relations:
    Table1:
      local:   table1_id
      foreign: id
    Table2:
      local:   table2_id
      foreign: id
#(/added)
Table1:
  relations:
    Table2:
      refClass: LinkTable
      local:    table1_id
      foreign:  table2_id
Table2:
  relations:
    Table1:
      refClass: LinkTable
      local:    table2_id
      foreign:  table1_id
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;(&lt;em&gt;I think this one would also &quot;solve&quot; the behavior problem of Papp Richard&lt;/em&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;But I&apos;m not that happy with the idea of choosing one of these &quot;hacks&quot; &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; if I had to, I would use this last one but (unless you use some &quot;&lt;tt&gt;onDelete: CASCADE&lt;/tt&gt;&quot; or so) it looks like unnecessary duplication...&lt;br/&gt;
Someone, any other idea? ^^&lt;/p&gt;

&lt;p&gt;G.X&lt;/p&gt;

&lt;p&gt;(edit: typo fix)&lt;/p&gt;</comment>
                    <comment id="13292" author="gx" created="Sun, 13 Jun 2010 08:00:34 +0000"  >&lt;p&gt;We can try another approach too: let&apos;s say that our generated PHP models classes &lt;b&gt;are&lt;/b&gt; incomplete.&lt;/p&gt;

&lt;p&gt;Indeed, for a simple foreign key relation (i.e. o2o and o2m / m2o), we can define it only once on the owning side in the YAML file, and the schema importer will generate complete PHP classes, with the &quot;hasOne&quot; on the owning side &lt;b&gt;and&lt;/b&gt; the auto-completed &quot;hasMany&quot; on the opposite side. E.g:&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;YAML schema&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;Phonenumber:
  columns:
    user_id: integer
  relations:
    User: {local: user_id, foreign: id}
User:
# we don&apos;t precise the opposite relation here
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;will generate the following classes (simplified a bit):&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;PHP models (1)&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-comment&quot;&gt;// models/Phonenumber.php
&lt;/span&gt;class Phonenumber &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;user_id&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;User&apos;, array(&apos;local&apos;   =&amp;gt; &apos;user_id&apos;,
                                    &apos;foreign&apos; =&amp;gt; &apos;id&apos;));
    }
}

&lt;span class=&quot;code-comment&quot;&gt;// models/User.php
&lt;/span&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;public&lt;/span&gt; function setUp() {
        &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; was auto-added during the schema &lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt;:
&lt;/span&gt;        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Phonenumber&apos;, array(&apos;local&apos;   =&amp;gt; &apos;id&apos;,
                                            &apos;foreign&apos; =&amp;gt; &apos;user_id&apos;));
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and this will work well.&lt;br/&gt;
BUT, now if we &lt;em&gt;remove the auto-added hasMany()&lt;/em&gt; in User.php, then run the following (which worked well before our manual modification):&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;test.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;require_once &apos;bootstrap.php&apos;;

$user = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User();
Doctrine_Core::dump($user-&amp;gt;Phonenumber);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;we get some &lt;tt&gt;Fatal error: Uncaught exception &apos;Doctrine_Record_UnknownPropertyException&apos; with message &apos;Unknown record property / related component &quot;Phonenumber&quot; on &quot;User&quot;&apos;&lt;/tt&gt;, which is supposed to occur. Indeed, how could Doctrine know that a User has a &quot;link&quot; with Phonenumber? It would be only possible by parsing the relations of all the (loaded) models first...&lt;/p&gt;

&lt;p&gt;So we can say that &lt;em&gt;YAML schema files can be incomplete &lt;b&gt;whereas&lt;/b&gt; PHP models classes MUST be COMPLETE.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, considering it is not to change, why not apply this &quot;principle&quot; to (m2m) association relations?&lt;br/&gt;
i.e., &lt;b&gt;Doctrine documentation could warn&lt;/b&gt; that, if you want to have all constraints properly exported (like in the present issue) and/or use relations from an association class (having &lt;tt&gt;$link&lt;/tt&gt; instance of &lt;tt&gt;LinkTable&lt;/tt&gt;, you want to use &lt;tt&gt;$link-&amp;gt;Table1&lt;/tt&gt;, not just &lt;tt&gt;$link-&amp;gt;table1_id&lt;/tt&gt;), then you MUST complete your PHP models with the FK relations, like this:&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;PHP models (2)&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-comment&quot;&gt;// models/LinkTable.php
&lt;/span&gt;class LinkTable &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;table1_id&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;table2_id&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-comment&quot;&gt;// ADD:
&lt;/span&gt;        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Table1&apos;, array(&apos;local&apos;   =&amp;gt; &apos;table1_id&apos;,
                                      &apos;foreign&apos; =&amp;gt; &apos;id&apos;));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Table2&apos;, array(&apos;local&apos;   =&amp;gt; &apos;table2_id&apos;,
                                      &apos;foreign&apos; =&amp;gt; &apos;id&apos;));
    }
}

&lt;span class=&quot;code-comment&quot;&gt;// models/Table1.php
&lt;/span&gt;class Table1 &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;public&lt;/span&gt; function setUp() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Table2&apos;, array(&apos;refClass&apos; =&amp;gt; &apos;LinkTable&apos;,
                                       &apos;local&apos;    =&amp;gt; &apos;table1_id&apos;,
                                       &apos;foreign&apos;  =&amp;gt; &apos;table2_id&apos;));
        &lt;span class=&quot;code-comment&quot;&gt;// add too?:
&lt;/span&gt;        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;LinkTable&apos;, array(&apos;local&apos;    =&amp;gt; &apos;id&apos;,
                                          &apos;foreign&apos;  =&amp;gt; &apos;table1_id&apos;));
    }
}

&lt;span class=&quot;code-comment&quot;&gt;// models/Table2.php
&lt;/span&gt;class Table2 &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;public&lt;/span&gt; function setUp() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Table1&apos;, array(&apos;refClass&apos; =&amp;gt; &apos;LinkTable&apos;,
                                       &apos;local&apos;    =&amp;gt; &apos;table2_id&apos;,
                                       &apos;foreign&apos;  =&amp;gt; &apos;table1_id&apos;));
        &lt;span class=&quot;code-comment&quot;&gt;// add too?:
&lt;/span&gt;        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;LinkTable&apos;, array(&apos;local&apos;    =&amp;gt; &apos;id&apos;,
                                          &apos;foreign&apos;  =&amp;gt; &apos;table2_id&apos;));
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;After all, these additional relations are bound internally (if not already defined) when exporting tables to DB...&lt;/p&gt;

&lt;p&gt;We also said that the YAML can be incomplete, but for now the short schema.yml I took as an example in my first comment results in PHP classes &lt;em&gt;without&lt;/em&gt; those (2+1+1) adds.&lt;/p&gt;

&lt;p&gt;So to allow YAML to be incomplete even for m2m relations, &lt;em&gt;Doctrine_Import_Schema#_buildRelationships()&lt;/em&gt; would need some &quot;improvement&quot; so that it creates the many-to-one relation for each many-to-many relation (and the opposite one-to-many relation, on the association class side i.e. the owning side, would be auto-completed afterwards). However, a m2m relation is allowed to be defined on one single end, thus may be created one the other end only when _&lt;em&gt;autoCompleteOppositeRelations()&lt;/em&gt; is called, i.e. after _&lt;em&gt;buildRelationships()&lt;/em&gt; has looped over all the existing relations. So &lt;em&gt;Doctrine_Import_Schema#_autoCompleteOppositeRelations()&lt;/em&gt; would need the same kind of improvement...&lt;/p&gt;

&lt;p&gt;In fact I&apos;m not sure of what is a &quot;well defined&quot; model as soon as it uses refClass, the documentation sometimes uses contradictory examples...&lt;/p&gt;

&lt;p&gt;Sorry I was so verbose!&lt;br/&gt;
Thank you for developing Doctrine &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-509] Oracle don&apos;t close cursor</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-509</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When you doing a big loop of insertion you have a &quot;too many open cursor&quot;.&lt;br/&gt;
The problem is in Doctrine_Connection class&lt;br/&gt;
At line 1005 you should replace :&lt;br/&gt;
$stmt = $this-&amp;gt;prepare($query);&lt;br/&gt;
by&lt;br/&gt;
$stmt = $this-&amp;gt;dbh-&amp;gt;prepare($query);&lt;/p&gt;

&lt;p&gt;and at line 1041 you should replace :&lt;br/&gt;
$stmt = $this-&amp;gt;prepare($query);&lt;br/&gt;
by&lt;br/&gt;
$stmt = $this-&amp;gt;dbh-&amp;gt;prepare($query);&lt;/p&gt;

&lt;p&gt;After this correction, you never have the problem &quot;too many open cursor&quot;&lt;/p&gt;

&lt;p&gt;Thanks to Ota to point that on google groups.&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/fe6cd03c8fb18b64/728ec1b4e42b1f0b?lnk=gst&amp;amp;q=doctrine_oracle_adapter#728ec1b4e42b1f0b&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/fe6cd03c8fb18b64/728ec1b4e42b1f0b?lnk=gst&amp;amp;q=doctrine_oracle_adapter#728ec1b4e42b1f0b&lt;/a&gt;&lt;/p&gt;</description>
                <environment>PHP 5.3.1</environment>
            <key id="10912">DC-509</key>
            <summary>Oracle don&apos;t close cursor</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="oxman">oxman</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Feb 2010 04:17:46 +0000</created>
                <updated>Thu, 28 Jul 2011 16:18:46 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11978" author="jwage" created="Tue, 2 Mar 2010 13:49:33 +0000"  >&lt;p&gt;Hmm. This change is invalid because it then doesn&apos;t return the proper statement object. What is the real issue we get the too many cursors open error?&lt;/p&gt;</comment>
                    <comment id="12023" author="oxman" created="Thu, 4 Mar 2010 06:37:57 +0000"  >&lt;p&gt;Why ?&lt;br/&gt;
The both return Doctrine_Adapter_Statement_Interface&lt;/p&gt;</comment>
                    <comment id="12026" author="jwage" created="Thu, 4 Mar 2010 08:18:16 +0000"  >&lt;p&gt;The change makes it so they return PDOStatement, and we need it to return the Doctrine statement wrapper, right?&lt;/p&gt;</comment>
                    <comment id="12029" author="oxman" created="Thu, 4 Mar 2010 08:32:21 +0000"  >&lt;p&gt;It seems not.&lt;/p&gt;

&lt;p&gt;At line 1005 in Doctrine/Connection.php :&lt;br/&gt;
                $stmt = $this-&amp;gt;dbh-&amp;gt;prepare($query);&lt;br/&gt;
                var_dump(get_class($stmt));&lt;br/&gt;
                die;&lt;/p&gt;

&lt;p&gt;I see :&lt;br/&gt;
string(33) &quot;Doctrine_Adapter_Statement_Oracle&quot;&lt;/p&gt;

&lt;p&gt;And with :&lt;br/&gt;
                $stmt = $this-&amp;gt;prepare($query);&lt;br/&gt;
                var_dump(get_class($stmt));&lt;br/&gt;
                die;&lt;/p&gt;

&lt;p&gt;I see :&lt;br/&gt;
string(29) &quot;Doctrine_Connection_Statement&quot;&lt;/p&gt;

&lt;p&gt;The both implements Doctrine_Adapter_Statement_Interface&lt;/p&gt;</comment>
                    <comment id="12776" author="richard" created="Thu, 29 Apr 2010 04:24:43 +0000"  >&lt;p&gt;I have this problem in Symfony 1.4.3 when I use comand:&lt;br/&gt;
symfony doctrine:data-load&lt;/p&gt;

&lt;p&gt;I have 3000 - 4000 lines in my fixtures and max open cursor at 300 on my database oracle.&lt;/p&gt;

&lt;p&gt;This problem can an issue???&lt;/p&gt;</comment>
                    <comment id="13220" author="jwage" created="Tue, 8 Jun 2010 17:06:50 +0000"  >&lt;p&gt;I see, well the change still is not right because it bypasses all the logic in Doctrine_Connection::prepare() which is for sure required and can&apos;t just be removed. We need to determine the real issue here in order to properly patch it.&lt;/p&gt;</comment>
                    <comment id="13458" author="pkwooster" created="Tue, 29 Jun 2010 13:44:32 +0000"  >&lt;p&gt;I&apos;m encountering the same ORA-1000 problem running the symfony doctrine:build-schema command. We are still using PDO, but I have asked in the users group if that&apos;s the best choice. The problem is that the listTableColumns and listTableRelations methods both leave a cursor open. They both call Connection::fetchAssoc, so they should be reading all the records.&lt;/p&gt;

&lt;p&gt;I narrowed it down a little:&lt;/p&gt;

&lt;p&gt;This works properly when no parameters are provided:&lt;/p&gt;

&lt;p&gt;$sql = &quot;SELECT * FROM all_tab_columns tc WHERE tc.table_name = &apos;DEAL&apos;&quot;;&lt;br/&gt;
$result = $connection-&amp;gt;fetchAssoc($sql, array());&lt;/p&gt;

&lt;p&gt;This doesn&apos;t release the cursor when a named parameter is provided&lt;/p&gt;

&lt;p&gt;$sql = &quot;SELECT * FROM all_tab_columns tc WHERE tc.table_name = :tn&quot;;&lt;br/&gt;
$result = $connection-&amp;gt;fetchAssoc($sql, array(&apos;:tn&apos; =&amp;gt; &apos;DEAL&apos;)); // doesn&apos;t release cursor&lt;/p&gt;

&lt;p&gt;This doesn&apos;t release the cursor when a positional parameter is provided&lt;/p&gt;

&lt;p&gt;$sql = &quot;SELECT * FROM all_tab_columns tc WHERE tc.table_name = ?&quot;;&lt;br/&gt;
$result = $connection-&amp;gt;fetchAssoc($sql, array(&apos;DEAL&apos;)); // doesn&apos;t release cursor&lt;/p&gt;

&lt;p&gt;This works properly when the PDO connection is used directly&lt;/p&gt;

&lt;p&gt;$sql = &quot;SELECT * FROM all_tab_columns tc WHERE tc.table_name = :tn&quot;;&lt;br/&gt;
$dbh = $connection-&amp;gt;getDbh();&lt;br/&gt;
$stmt = $dbh-&amp;gt;prepare($sql);&lt;br/&gt;
$stmt-&amp;gt;execute(array(&apos;:tn&apos; =&amp;gt; &apos;DEAL&apos;));&lt;br/&gt;
$result = $stmt-&amp;gt;fetchAll();&lt;/p&gt;</comment>
                    <comment id="16226" author="clemherreman" created="Thu, 28 Jul 2011 16:18:46 +0000"  >&lt;p&gt;As I went through this bug, I looked for a fix. I found one here &lt;a href=&quot;https://github.com/derflocki/doctrine1/commit/47b926a523f9f6e3b88042ef2939af0646285ea2&quot; class=&quot;external-link&quot;&gt;https://github.com/derflocki/doctrine1/commit/47b926a523f9f6e3b88042ef2939af0646285ea2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically it consist of freeing cursors that aren&apos;t used by a SELECT query, thus preventing Oracle from throwing an exception on batch insert/delete.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-519] -&gt;where() add parentheses </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-519</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have this method&lt;/p&gt;

&lt;p&gt;public function getOpenBalances()&lt;/p&gt;
	{
		$q = $this-&amp;gt;createQuery(&apos;a&apos;)
			-&amp;gt;select(&apos;a.*&apos;)
			-&amp;gt;where(&apos;a.invoice_id IN (
				SELECT ac.invoice_id
				FROM AccountingCustomers ac 
				GROUP BY ac.invoice_id
				HAVING (SUM(ac.dedit) - SUM(ac.credit)) &amp;gt; 0)&apos;);
return $q-&amp;gt;execute();
	}

&lt;p&gt;and yhis is the error generated in symfony:&lt;/p&gt;

&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42601&amp;#93;&lt;/span&gt;: Syntax error: 7 ERROR: syntax error at or near &quot;)&quot; at character 456. Failing Query: &quot;SELECT a.id AS a_&lt;em&gt;id, a.customer_id AS a&lt;/em&gt;&lt;em&gt;customer_id, a.invoice_id AS a&lt;/em&gt;&lt;em&gt;invoice_id, a.credit AS a&lt;/em&gt;&lt;em&gt;credit, a.duedate AS a&lt;/em&gt;&lt;em&gt;duedate, a.debit AS a&lt;/em&gt;&lt;em&gt;debit, a.paymentdate AS a&lt;/em&gt;&lt;em&gt;paymentdate, a.note AS a&lt;/em&gt;&lt;em&gt;note, a.created_at AS a&lt;/em&gt;&lt;em&gt;created_at, a.updated_at AS a&lt;/em&gt;&lt;em&gt;updated_at FROM accounting_customers a WHERE (a.invoice_id IN (SELECT a2.invoice_id AS a2&lt;/em&gt;_invoice_id FROM accounting_customers a2 GROUP BY a2.invoice_id HAVING (SUM(ac.dedit) - SUM(a2.credi))) &amp;gt; 0))&quot;&lt;/p&gt;

&lt;p&gt;At the end ther is a parentheses that the code haven&apos;t.  ))) &amp;gt; 0))&lt;/p&gt;

&lt;p&gt;and another problem is that  SUM(ac.credit) is changed in SUM(a2.credi) &lt;/p&gt;


</description>
                <environment></environment>
            <key id="10941">DC-519</key>
            <summary>-&gt;where() add parentheses </summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="gsplsn71">Alessandro Gaspari</reporter>
                        <labels>
                    </labels>
                <created>Tue, 23 Feb 2010 12:49:32 +0000</created>
                <updated>Tue, 23 Feb 2010 12:51:49 +0000</updated>
                                    <version>1.2.0</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-526] Savepoint-rollback ignored in nested transaction context.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-526</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The example from the documentation on savepoints:&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;try&lt;/span&gt; {
    $conn-&amp;gt;beginTransaction();
    &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; some operations here 
&lt;/span&gt;
    &lt;span class=&quot;code-comment&quot;&gt;// creates a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; savepoint called mysavepoint
&lt;/span&gt;    $conn-&amp;gt;beginTransaction(&apos;mysavepoint&apos;);
    &lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt; {
        &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; some operations here
&lt;/span&gt;
        $conn-&amp;gt;commit(&apos;mysavepoint&apos;);
    } &lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt;(Exception $e) {
        $conn-&amp;gt;rollback(&apos;mysavepoint&apos;); # (a)
    }
    $conn-&amp;gt;commit();
} &lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt;(Exception $e) {
    $conn-&amp;gt;rollback();
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What seems to be a bug to me: (a) doesn&apos;t actually do a savepoint-rollback if reached, but rather returns false as soon as the nesting level is seen to be &amp;gt; 1.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10966">DC-526</key>
            <summary>Savepoint-rollback ignored in nested transaction context.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="napsi">Michael Nielsen</reporter>
                        <labels>
                    </labels>
                <created>Fri, 26 Feb 2010 04:19:09 +0000</created>
                <updated>Fri, 6 Aug 2010 03:11:39 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Transactions</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12239" author="jwage" created="Mon, 15 Mar 2010 16:26:10 +0000"  >&lt;p&gt;What rdbms are you using? Does it support this feature?&lt;/p&gt;</comment>
                    <comment id="12263" author="napsi" created="Mon, 15 Mar 2010 18:15:07 +0000"  >&lt;p&gt;I use MySQL 5.0.51/InnoDB. It is supported and the doctrine-example does indeed work, if I hack the rollback-method a bit.&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;&lt;a href=&quot;http://trac.doctrine-project.org/browser/tags/1.2.1/lib/Doctrine/Transaction.php&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/browser/tags/1.2.1/lib/Doctrine/Transaction.php&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;316	    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function rollback($savepoint = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
317	    {
318	        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel == 0) {
319	            &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_Transaction_Exception(&lt;span class=&quot;code-quote&quot;&gt;&quot;Rollback failed. There is no active transaction.&quot;&lt;/span&gt;);
320	        }
321	       
322	        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;connect();
323	
324	        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel &amp;gt;= 1 &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
325	            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel--;
326	            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
327	            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
328	        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
329	            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
330	            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
331	        }
332	
333	        $listener = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getAttribute(Doctrine_Core::ATTR_LISTENER);
334	
335	        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! is_null($savepoint)) {
[...]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem is that in a nested context, the rollback-method never does anything but a nesting-level decrement and a false-return, regardless of savepoints. So in the doctrine-example, (a) just ends up at the false-return at line 327 or 330, rather than reaching the savepoint-rollback-block starting at line 335. And so the command is never sent to MySQL.&lt;/p&gt;</comment>
                    <comment id="12264" author="jwage" created="Mon, 15 Mar 2010 18:23:42 +0000"  >&lt;p&gt;Do you have a patch/diff that fixes the issue for you?&lt;/p&gt;</comment>
                    <comment id="12268" author="napsi" created="Mon, 15 Mar 2010 19:27:37 +0000"  >&lt;p&gt;I just skipped the nestingLevel-section in case of a savepoint. I have not spent any time reviewing how (un)healthy that might be for the level counters and the method in general, but it fixes my current application of it. &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;

&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;@@ -321,14 +321,16 @@
         
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;connect();
 
-        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel &amp;gt;= 1 &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel--;
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
-            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
-        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
-            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
-        }
+	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_null($savepoint)) {
+		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel &amp;gt;= 1 &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
+			$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel--;
+			$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
+			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
+		} &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel &amp;gt; 1) {
+			$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel--;
+			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
+		}
+	}
 
         $listener = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getAttribute(Doctrine_Core::ATTR_LISTENER);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="13222" author="jwage" created="Tue, 8 Jun 2010 17:09:55 +0000"  >&lt;p&gt;The change unfortunately breaks the tests.&lt;/p&gt;</comment>
                    <comment id="13792" author="hckurniawan" created="Fri, 6 Aug 2010 03:11:39 +0000"  >&lt;p&gt;Hi Jonathan,&lt;/p&gt;

&lt;p&gt;I can also replicate and confirm the issue. I found a workaround that will fix this issue.&lt;br/&gt;
However in saying that, I&apos;m not very familiar with Doctrine base code and may have broken something else.&lt;br/&gt;
I&apos;d be very grateful if you can have a look at the following fix.&lt;/p&gt;

&lt;p&gt;The patch is for Doctrine/Transaction.php&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;@@ -214,9 +214,9 @@
                 }
                 $listener-&amp;gt;postTransactionBegin($event);
             }
-        }
 
         $level = ++$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel;
+        }
 
         &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $level;
     }
@@ -244,7 +244,7 @@
         $listener = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getAttribute(Doctrine_Core::ATTR_LISTENER);
 
         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! is_null($savepoint)) {
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel -= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;removeSavePoints($savepoint);
+            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;removeSavePoints($savepoint);
 
             $event = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Event($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;, Doctrine_Event::SAVEPOINT_COMMIT);
 
@@ -333,7 +333,7 @@
         $listener = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getAttribute(Doctrine_Core::ATTR_LISTENER);
 
         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! is_null($savepoint)) {
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nestingLevel -= $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;removeSavePoints($savepoint);
+            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;removeSavePoints($savepoint);
 
             $event = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Event($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;, Doctrine_Event::SAVEPOINT_ROLLBACK);
 
@@ -507,7 +507,10 @@
      */
     &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function beginInternalTransaction($savepoint = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
     {
+        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_null($savepoint)) {
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_internalNestingLevel++;
+        }
+
         &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;beginTransaction($savepoint);
     }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Thanks&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-536] Duplicate CREATE TABLE entries in schema.sql when using column_inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-536</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When creating a model involving column_inheritance the CREATE TABLE statement gets duplicated.&lt;/p&gt;

&lt;p&gt;The second CREATE TABLE include an index for the keyField.&lt;/p&gt;

&lt;p&gt;Test doctrine generated models and generated schema.sql attached.&lt;/p&gt;</description>
                <environment>MySQL 5 / PHP 5.3.1 / Symfony 1.4.3 (branch) / Doctrine 1.2.1 / Mac OSX</environment>
            <key id="10981">DC-536</key>
            <summary>Duplicate CREATE TABLE entries in schema.sql when using column_inheritance</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="webpragmatist">webPragmatist</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Mar 2010 12:38:25 +0000</created>
                <updated>Thu, 18 Nov 2010 01:44:16 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Inheritance</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="11973" author="webpragmatist" created="Tue, 2 Mar 2010 13:05:19 +0000"  >&lt;p&gt;It seems this issue is related to using array_unique() and databases which doctrine creates index along with the CREATE TABLE statement.&lt;/p&gt;

&lt;p&gt;This does not occur on sqlite as shown above in the console-log.txt (this db uses the CREATE INDEX statement).&lt;/p&gt;</comment>
                    <comment id="11975" author="sacho" created="Tue, 2 Mar 2010 13:25:36 +0000"  >&lt;p&gt;Yes, it seems SQL CREATE TABLE statements are generated for each of the children as well, but with sqlite, array_unique() filters out the ones that are &quot;extra&quot;.&lt;br/&gt;
But the MySQL statements all differ(due to indexes, I don&apos;t know if other things can cause them to differ as well), and as such all are left.&lt;/p&gt;</comment>
                    <comment id="12867" author="boutell" created="Fri, 7 May 2010 12:22:40 +0000"  >&lt;p&gt;We&apos;re seeing this issue too. doctrine:build --all --and-load works fine, but doctrine:build-sql generates duplicate CREATE TABLE statements. Our in-house workflow is the former, so the latter came as a surprise. Is there any sign of progress on this one?&lt;/p&gt;</comment>
                    <comment id="13533" author="bascht" created="Wed, 7 Jul 2010 09:14:06 +0000"  >&lt;p&gt;This looks like a Duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-123&quot; class=&quot;external-link&quot;&gt;DC-123&lt;/a&gt;.&lt;/p&gt;</comment>
                    <comment id="14772" author="kerdany" created="Thu, 18 Nov 2010 01:43:39 +0000"  >&lt;p&gt;A little addition to the symptoms of this problem.&lt;/p&gt;

&lt;p&gt;If the one of the child classes has a foreign key to another entity, another Third Create table SQL will be created, which contains the an index on the foreign key column.&lt;/p&gt;

&lt;p&gt;In other words, it seems that an additional create table statement is created for each automatically created index.&lt;/p&gt;

&lt;p&gt;An illustration is in the attached yml and sql schema:&lt;br/&gt;
kerdany_10-11-18-08-30.yml&lt;br/&gt;
kerdany_10-11-18-08-30.sql&lt;/p&gt;

&lt;p&gt;Tom Boutell: doctrine:build --all generates the problem with me!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10413" name="BaseInherited.class.php" size="429" author="webpragmatist" created="Tue, 2 Mar 2010 12:38:25 +0000" />
                    <attachment id="10412" name="BaseInheriter.class.php" size="1525" author="webpragmatist" created="Tue, 2 Mar 2010 12:38:25 +0000" />
                    <attachment id="10871" name="kerdany_10-11-18-08-30.sql" size="633" author="kerdany" created="Thu, 18 Nov 2010 01:42:16 +0000" />
                    <attachment id="10870" name="kerdany_10-11-18-08-30.yml" size="407" author="kerdany" created="Thu, 18 Nov 2010 01:42:16 +0000" />
                    <attachment id="10414" name="sandbox-console.txt" size="1465" author="webpragmatist" created="Tue, 2 Mar 2010 13:05:19 +0000" />
                    <attachment id="10411" name="schema.sql" size="416" author="webpragmatist" created="Tue, 2 Mar 2010 12:38:25 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-541] MSSQL Server: Enabling MARS prevents the saving of records.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-541</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;This is related to issue #540. In order to circumvent that issue, I enabled MARS (Multiple Active Result Sets) - now when attempting to save any record the following error results:&lt;/p&gt;

&lt;p&gt;Fatal error: Uncaught exception &apos;Doctrine_Transaction_Exception&apos; with message &apos;Rollback failed. There is no active transaction.&apos; in C:\www\doctrine\lib\Doctrine\Transaction.php on line 319&lt;/p&gt;

&lt;p&gt;This is actually caused by the following MSSQL error:&lt;/p&gt;

&lt;p&gt;exception &apos;Doctrine_Transaction_Exception&apos; with message &apos;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 3997 &lt;span class=&quot;error&quot;&gt;&amp;#91;Microsoft&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;SQL Server Native Client 10.0&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;SQL Server&amp;#93;&lt;/span&gt;A transaction that was started in a MARS batch is still active at the end of the batch. The transaction is rolled back. (SQLExecDirect&lt;span class=&quot;error&quot;&gt;&amp;#91;3997&amp;#93;&lt;/span&gt; at ext\pdo_odbc\odbc_driver.c:247)&apos; in C:\www\doctrine\lib\Doctrine\Transaction.php:212 Stack trace: #0 C:\www\doctrine\lib\Doctrine\Transaction.php(511): Doctrine_Transaction-&amp;gt;beginTransaction(NULL) #1 C:\www\doctrine\lib\Doctrine\Connection.php(1377): Doctrine_Transaction-&amp;gt;beginInternalTransaction(NULL) #2 C:\www\doctrine\lib\Doctrine\Connection\UnitOfWork.php(64): Doctrine_Connection-&amp;gt;beginInternalTransaction() #3 C:\www\doctrine\lib\Doctrine\Record.php(1691): Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph(Object(Model)) #4 C:\www\doctrine\tools\sandbox\index.php(83): Doctrine_Record-&amp;gt;save() #5 &lt;/p&gt;
{main}

&lt;p&gt;I haven&apos;t worked out what&apos;s going on yet, but this blog post may shed some light on it:&lt;br/&gt;
&lt;a href=&quot;http://blogs.msdn.com/cbiyikoglu/archive/2006/11/21/mars-transactions-and-sql-error-3997-3988-or-3983.aspx&quot; class=&quot;external-link&quot;&gt;http://blogs.msdn.com/cbiyikoglu/archive/2006/11/21/mars-transactions-and-sql-error-3997-3988-or-3983.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ve attached a script to reproduce this issue in the sandbox (MARS is enabled in the DSN).&lt;/p&gt;</description>
                <environment>PHP 5.3.1&lt;br/&gt;
MSSQL Server 2008&lt;br/&gt;
Windows&lt;br/&gt;
PHP PDO ODBC</environment>
            <key id="10990">DC-541</key>
            <summary>MSSQL Server: Enabling MARS prevents the saving of records.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="craigmarvelley">Craig Marvelley</reporter>
                        <labels>
                    </labels>
                <created>Wed, 3 Mar 2010 13:20:00 +0000</created>
                <updated>Thu, 10 Jun 2010 04:40:57 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Connection</component>
                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12237" author="jwage" created="Mon, 15 Mar 2010 16:23:31 +0000"  >&lt;p&gt;We&apos;ll need some more information. We don&apos;t have a way to test against mssql currently.&lt;/p&gt;</comment>
                    <comment id="12273" author="craigmarvelley" created="Tue, 16 Mar 2010 06:59:00 +0000"  >&lt;p&gt;I&apos;ve dug a little deeper and it seems that the exception is thrown because the Doctrine_Transaction_Mssql class has overrides for the transaction begin/commit/rollback methods. When I remove these overrides and let transactions be handled through the PDO API I don&apos;t get any exceptions while transactions seem to function as normal.&lt;/p&gt;

&lt;p&gt;Why are these methods overridden? Is it perhaps only necessary for the MSSQL PDO extension, as suggested here (&lt;a href=&quot;http://trac.symfony-project.org/wiki/HowToConnectToMSSQLServer&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/wiki/HowToConnectToMSSQLServer&lt;/a&gt;), since that extension seemingly has no native transaction support (I&apos;ve never used it)? Perhaps this isn&apos;t necessary for the ODBC extension?&lt;/p&gt;</comment>
                    <comment id="12291" author="craigmarvelley" created="Tue, 16 Mar 2010 15:06:21 +0000"  >&lt;p&gt;This patch maintains the existing manual transaction functionality for MSSQL connections, but uses the native PDO API for ODBC connections.&lt;/p&gt;</comment>
                    <comment id="13188" author="jwage" created="Tue, 8 Jun 2010 14:32:50 +0000"  >&lt;p&gt;Hmm. I don&apos;t think this patch is good. It doesn&apos;t fix the problem, just hacks around it.&lt;/p&gt;</comment>
                    <comment id="13231" author="craigmarvelley" created="Tue, 8 Jun 2010 18:31:23 +0000"  >&lt;p&gt;Ok.. Do you have any recommendations for a better patch? While I agree my patch is far from elegant, it does at least allow MSSQL and ODBC to work alongside each other. As far as I can tell, the underlying issue is that Doctrine uses the same driver for two very different PDO extensions - I couldn&apos;t think of a way to resolve this issue without some kind of check as to which extension is in use.&lt;/p&gt;

&lt;p&gt;We could maybe catch the exception that&apos;s thrown in the first instance when running a manual query, and try calling the parent rollback method instead? Maybe only when the current connection is ODBC? That&apos;s essentially the same approach though, with the added overhead of an unnecessary query that we know will fail..&lt;/p&gt;

&lt;p&gt;I&apos;m very keen to find a fix that you&apos;re happy with for this since I&apos;ve been manually patching it for a while, so any feedback that would engender that would be great!&lt;/p&gt;</comment>
                    <comment id="13232" author="jwage" created="Tue, 8 Jun 2010 18:47:47 +0000"  >&lt;p&gt;I am still not sure of the exact problem/error that is happening. When isn&apos;t happening with the current code? or is something happening that should not?&lt;/p&gt;</comment>
                    <comment id="13248" author="craigmarvelley" created="Wed, 9 Jun 2010 06:58:08 +0000"  >&lt;p&gt;As far as I understand it (I&apos;m no SQL Server expert, unfortunately!) the issue is this: &lt;/p&gt;

&lt;p&gt;The Doctrine_Transaction_Mssql class is used for both the MSSQL and ODBC PDO extensions. It manages transactions by executing manual queries against the database (ROLLBACK TRANSACTION, COMMIT_TRANSACTION, etc.).&lt;/p&gt;

&lt;p&gt;This isn&apos;t compatible with the ODBC PDO extension and SQL Server when Multiple Active Record Sets is enabled; I believe MARS allows multiple transactions to co-exist, and this query-style way of managing them isn&apos;t compatible with that as transactions aren&apos;t &apos;namespaced&apos;. MARS is critical because without it there&apos;s no way of looping over more than one record set at the same time, something we take for granted in MySQL et al.&lt;/p&gt;

&lt;p&gt;From that link to the Symfony wiki I posted earlier, it appears that the query method of managing transactions is only necessary for the MSSQL PDO extension - quote:&lt;/p&gt;

&lt;p&gt;&quot;dblib doesn&apos;t support transactions so we need to add a workaround for transactions, last insert ID, and quoting&quot;&lt;/p&gt;

&lt;p&gt;This is backed up by the patch - when we let the ODBC driver handle transactions natively, everything works fine.&lt;/p&gt;

&lt;p&gt;Does that make sense?&lt;/p&gt;</comment>
                    <comment id="13250" author="jwage" created="Wed, 9 Jun 2010 12:39:06 +0000"  >&lt;p&gt;Now that I look at everything again, do we need to even be overriding those methods at all in Doctrine_Transaction_Mssql (_doRollback, _doCommit, _doBeginTransaction). We should just let the database driver handle it?&lt;/p&gt;</comment>
                    <comment id="13251" author="jwage" created="Wed, 9 Jun 2010 12:40:05 +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;
Index: lib/Doctrine/Transaction/Mssql.php
===================================================================
--- lib/Doctrine/Transaction/Mssql.php	(revision 7673)
+++ lib/Doctrine/Transaction/Mssql.php	(working copy)
@@ -65,28 +65,4 @@
 
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;execute($query);
     }
-    
-    /**
-     * Performs the rollback.
-     */
-    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; function _doRollback()
-    {
-        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getDbh()-&amp;gt;exec(&apos;ROLLBACK TRANSACTION&apos;);
-    }
-    
-    /**
-     * Performs the commit.
-     */
-    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; function _doCommit()
-    {
-        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getDbh()-&amp;gt;exec(&apos;COMMIT TRANSACTION&apos;);
-    }
-    
-    /**
-     * Begins a database transaction.
-     */
-    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; function _doBeginTransaction()
-    {
-        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;conn-&amp;gt;getDbh()-&amp;gt;exec(&apos;BEGIN TRANSACTION&apos;);
-    }
 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It seems like we don&apos;t even need to do that?&lt;/p&gt;</comment>
                    <comment id="13264" author="craigmarvelley" created="Thu, 10 Jun 2010 04:40:57 +0000"  >&lt;p&gt;For ODBC, we definitely don&apos;t. That link suggests the above approach caters to the MSSQL extension. I&apos;ve not tried that one because I&apos;m on Windows and as you probably know it&apos;s not recommended; I imagine I&apos;d have way too many other problems were I to try! I didn&apos;t want to break anything for anyone using the MSSQL driver though, which led to my awkward patch.&lt;/p&gt;

&lt;p&gt;From my point of view, I&apos;d imagine the majority of people using SQL Server will be using a Windows stack, and therefore ODBC (and possibly the new SQL Server Driver for PHP PDO extension, which definitely won&apos;t need manual queries, in future) - so I&apos;d favour an approach that didn&apos;t compromise those drivers.&lt;/p&gt;

&lt;p&gt;As an aside - are there any plans afoot to support the new Microsoft endorsed driver? I imagine if you guys were to do so it would be for Doctrine 2, but do you know of any community effort to get it working in 1.2?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10422" name="index.php" size="1008" author="craigmarvelley" created="Wed, 3 Mar 2010 13:20:00 +0000" />
                    <attachment id="10484" name="mssql_transaction.patch" size="1585" author="craigmarvelley" created="Tue, 16 Mar 2010 15:06:21 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-544] Doctrine_Pager bug with Oracle. getNumResults doesn&apos;t return the correct number of records</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-544</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The function getNumResults() doesn&apos;t work correctly.&lt;/p&gt;

&lt;p&gt;This is my model class&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 ReviewListTable &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Table
{
 &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getAvailable()
 {
   &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createQuery()
   -&amp;gt;select(&apos;DISTINCT(to_char(file_date, \&apos;YYYY-MM-DD\&apos;)) fdate&apos;)
   -&amp;gt;orderBy(&apos;fdate DESC&apos;);
 }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If i execute this fonction, the number of record is 31. If i use the Pager, the result is 5744 records&lt;/p&gt;

&lt;p&gt;Controler:&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;this&lt;/span&gt;-&amp;gt;pager = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Pager(
                           Doctrine_Core::getTable(&apos;ReviewList&apos;)-&amp;gt;getAvailable(),
                           $request-&amp;gt;getParameter(&apos;page&apos;, 1),
                           20);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;View:&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;$rs = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;pager-&amp;gt;execute();
echo $pager-&amp;gt;getNumResults();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="10993">DC-544</key>
            <summary>Doctrine_Pager bug with Oracle. getNumResults doesn&apos;t return the correct number of records</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="garfield-fr">Bertrand Zuchuat</reporter>
                        <labels>
                    </labels>
                <created>Thu, 4 Mar 2010 04:29:53 +0000</created>
                <updated>Thu, 18 Mar 2010 08:02:39 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Pager</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12235" author="jwage" created="Mon, 15 Mar 2010 16:20:49 +0000"  >&lt;p&gt;Hmm. I don&apos;t quite understand. Can you make a test case?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10492" name="DC544TestCase.php" size="4092" author="garfield-fr" created="Thu, 18 Mar 2010 08:02:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-553] issue when changing the connection inside Doctrine_Query::preQuery() on a model using a behavior</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-553</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;We were following:&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/documentation/cookbook/1_1/en/master-and-slave-connections&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/cookbook/1_1/en/master-and-slave-connections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;class MyQuery extends Doctrine_Query&lt;br/&gt;
{&lt;br/&gt;
    // Since php doesn&apos;t support late static binding in 5.2 we need to override&lt;br/&gt;
    // this method to instantiate a new MyQuery instead of Doctrine_Query&lt;br/&gt;
    public static function create($conn = null)&lt;/p&gt;
    {
        return new MyQuery($conn);
    }

&lt;p&gt;    public function preQuery()&lt;br/&gt;
    {&lt;br/&gt;
        // If this is a select query then set connection to one of the slaves&lt;br/&gt;
        if ($this-&amp;gt;getType() == Doctrine_Query::SELECT) &lt;/p&gt;
{
            $this-&amp;gt;_conn = Doctrine_Manager::getInstance()-&amp;gt;getConnection(&apos;slave_&apos; . rand(1, 4));
        // All other queries are writes so they need to go to the master
        }
&lt;p&gt; else &lt;/p&gt;
{
            $this-&amp;gt;_conn = Doctrine_Manager::getInstance()-&amp;gt;getConnection(&apos;master&apos;);
        }
&lt;p&gt;    }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;However we are actually forcing all queries after the first access to the master to be run against the master (including selects). Note the example should probably be changed to use setConnection(). However even when using setConnection() it seems like changing the connection can cause issues when running a select on a model with a behavior (in our case we were using i18n). Therefore we believe there is some issue that is caused through the event system, because otherwise queries work just fine even when changing the connection as per the above described code.&lt;/p&gt;

&lt;p&gt;We managed to fix things, by not setting the connection explicitly and instead simply using setCurrentConnection(&apos;master&apos;), so the bug does not affect us anymore. However this seems to indicate some issues deep inside the event-behavior-template code.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11006">DC-553</key>
            <summary>issue when changing the connection inside Doctrine_Query::preQuery() on a model using a behavior</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="lsmith">Lukas Kahwe</reporter>
                        <labels>
                    </labels>
                <created>Mon, 8 Mar 2010 11:18:28 +0000</created>
                <updated>Mon, 19 Jul 2010 07:45:41 +0000</updated>
                                                    <fixVersion>1.2.1</fixVersion>
                                <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="12056" author="seldaek" created="Mon, 8 Mar 2010 11:26:13 +0000"  >&lt;p&gt;In case the above post is confusing, note that doing $this-&amp;gt;_conn = masterconn worked fine for the INSERT, it just broke when doing a subsequent SELECT  of a translateable (I18n behavior) model and its Translation table with the following exception:&lt;/p&gt;

&lt;p&gt;Exception (Exception): Unknown relation alias Translation (#0)&amp;lt;/h1&amp;gt;thrown in file /Library/WebServer/Documents/liip/infocube/ext/db-doctrine/lib/Doctrine/Relation/Parser.php at line 237&lt;br/&gt;
backtrace:&lt;br/&gt;
#1 Doctrine_Relation_Parser-&amp;gt;getRelation called in file /Library/WebServer/Documents/liip/infocube/ext/db-doctrine/lib/Doctrine/Relation/Parser.php at line 235&lt;/p&gt;</comment>
                    <comment id="12230" author="jwage" created="Mon, 15 Mar 2010 16:12:31 +0000"  >&lt;p&gt;It is hard to understand the issue, can you provide a test case?&lt;/p&gt;</comment>
                    <comment id="12241" author="lsmith" created="Mon, 15 Mar 2010 16:27:01 +0000"  >&lt;p&gt;We already spend well over 2 hours together on project time to find a work around as noted above and I must admit now our motivation is not so big to dig deeper, especially since we didn&apos;t find the cause in this time and have the feeling its pretty impossible to fix without huge risks.&lt;/p&gt;

&lt;p&gt;Essentially I think all you need to do to reproduce the issue is use the cookbook code &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; and issue some write query and afterwards do a select on a model that has the translatable behavior. It then gave us the above Exception.&lt;/p&gt;

&lt;p&gt;&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; Our code worked slightly different since we did not use a random slave, instead we always used a local slave by default, but the first write and any queries thereafter would get send to the master. The code is public and the diff&apos;s show what we had to change to get things working. Note that the slave &quot;localhost&quot; connection was the default connection:&lt;br/&gt;
&lt;a href=&quot;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DQ.php?r1=13118&amp;amp;r2=&quot; class=&quot;external-link&quot;&gt;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DQ.php?r1=13118&amp;amp;r2=&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DR.php?r1=13118&amp;amp;r2=&quot; class=&quot;external-link&quot;&gt;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DR.php?r1=13118&amp;amp;r2=&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="13348" author="lsmith" created="Thu, 17 Jun 2010 05:38:01 +0000"  >&lt;p&gt;we thought we had the issue fixed but ran into another issue today. we then noticed that the issue goes away if we just copy the $tables property from the old connection to the new connection. there is a getTables() method, but there is only a addTable() method, would be nice to have a addTables() method that is faster. or maybe a switchFrom() method that accepts the old connection and does whatever it needs to.&lt;/p&gt;

&lt;p&gt;And again it would be nice to update the cookbook entry.&lt;br/&gt;
Here are our updated Doctrine_Query and Doctrine_Record classes:&lt;br/&gt;
&lt;a href=&quot;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DQ.php&quot; class=&quot;external-link&quot;&gt;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DQ.php&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DR.php&quot; class=&quot;external-link&quot;&gt;http://fisheye.liip.ch/browse/PUB/okapi2/ext/db-doctrine/trunk/inc/DR.php&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="13598" author="seldaek" created="Mon, 19 Jul 2010 07:45:41 +0000"  >&lt;p&gt;We just had another funny debugging session related to this. It turns out that the Table objects have a relation to the connection, and if you query a new model that wasn&apos;t initialized yet using -&amp;gt;from(), it works because it just gets the current connection passed. However, if you query a new model within a JOIN, then it apparently takes the connection from the related model you&apos;re joining from. In our case, the related model was already initialized but had an instance of the old (slave) connection, and so the new model was initialized using the wrong connection, and then the DQL parser exploded trying to resolve relations.&lt;/p&gt;

&lt;p&gt;Long story short, adding $table-&amp;gt;setConnection($conn); to all tables while switching to the master connection resolved it. The code is updated and you can still view it at the above URLs, or straight in the SVN repo at &lt;a href=&quot;http://svn.liip.ch/repos/public/okapi2/ext/db-doctrine/trunk/inc/DQ.php&quot; class=&quot;external-link&quot;&gt;http://svn.liip.ch/repos/public/okapi2/ext/db-doctrine/trunk/inc/DQ.php&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-554] Distinct query does not work</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-554</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt; $limit = 10;&lt;br/&gt;
 $q = &apos;Me&apos;;&lt;br/&gt;
 $field = &apos;contractor&apos;;&lt;/p&gt;

&lt;p&gt; $q = Doctrine_Query::create()&lt;br/&gt;
          -&amp;gt;select(sprintf(&apos;DISTINCT PublicContract.%s&apos;, $field))&lt;br/&gt;
          -&amp;gt;from(&apos;PublicContract&apos;)&lt;br/&gt;
          -&amp;gt;where(sprintf(&apos;PublicContract.%s LIKE ?&apos;, $field), sprintf(&apos;%%%s%%&apos;, $q))&lt;br/&gt;
          -&amp;gt;limit($limit);&lt;/p&gt;

&lt;p&gt;The QUERY is WRONG:&lt;/p&gt;

&lt;p&gt;// SELECT DISTINCT p.id AS p_&lt;em&gt;id, p.contractor AS p&lt;/em&gt;_contractor FROM public_contract p WHERE (p.contractor LIKE ?) LIMIT 10 - (%Me%)&lt;/p&gt;

&lt;p&gt;I can simply GROUP BY the contractor field, because DISTINCT can be considered as a special case of GROUP BY - and have the results I want:&lt;/p&gt;

&lt;p&gt; $q = Doctrine_Query::create()&lt;br/&gt;
          -&amp;gt;select(sprintf(&apos;PublicContract.%s&apos;, $field))&lt;br/&gt;
          -&amp;gt;from(&apos;PublicContract&apos;)&lt;br/&gt;
          -&amp;gt;where(sprintf(&apos;PublicContract.%s LIKE ?&apos;, $field), sprintf(&apos;%%%s%%&apos;, $q))&lt;br/&gt;
         -&amp;gt;groupBy(sprintf(&apos;PublicContract.%s&apos;, $field))&lt;br/&gt;
          -&amp;gt;limit($limit);&lt;/p&gt;</description>
                <environment></environment>
            <key id="11009">DC-554</key>
            <summary>Distinct query does not work</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="mishal">Mishal</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Mar 2010 03:50:36 +0000</created>
                <updated>Mon, 15 Mar 2010 16:11:04 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12229" author="jwage" created="Mon, 15 Mar 2010 16:11:04 +0000"  >&lt;p&gt;Test case or patch?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-575] Select distinct  limit problem</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-575</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;1)Code&lt;br/&gt;
Doctrine_Query::create ()&lt;br/&gt;
-&amp;gt;select ( &quot;u.user_id,mr.message_id,mr.message_senddate,mr.message_title,mr.message_content,mr.message_alias,mr.message_categoryid,&quot; )&lt;br/&gt;
-&amp;gt;from ( &quot;user u&quot; )&lt;br/&gt;
-&amp;gt;leftJoin ( &quot;u.messages mr ON u.user_id = mr.message_sender&quot; )&lt;br/&gt;
-&amp;gt;where ( &quot;u.user_id = ?&quot;, 2 )  &lt;br/&gt;
-&amp;gt;limit(1)&lt;br/&gt;
-&amp;gt;fetchArray ();&lt;/p&gt;

&lt;p&gt;This code must return only one result but it returns all results in which user_id is 2 in the database&lt;/p&gt;

&lt;p&gt;If i looked it in Symfony Debug bar, i saw that;&lt;/p&gt;

&lt;p&gt;2)Symfony debug toolbar values: &lt;/p&gt;

&lt;p&gt;#Query A&lt;br/&gt;
SELECT DISTINCT u2.user_id FROM users u2 LEFT JOIN messages m2 ON (u2.user_id = m2.message_sender) WHERE u2.user_id = 2 LIMIT 1&lt;/p&gt;

&lt;p&gt;#Query B &lt;br/&gt;
SELECT u.user_id AS u_user_id, m.message_id AS mmessage_id, m.message_senddate AS mmessage_senddate, m.message_title AS mmessage_title, m.message_content AS mmessage_content, m.message_alias AS mmessage_alias, m.message_categoryid AS m_message_categoryid FROM users u LEFT JOIN messages m ON (u.user_id = m.message_sender) WHERE u.user_id IN (&apos;2&apos;) AND (u.user_id = 2)&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;And if i test this code in MYSQL query browser i got a result like that;&lt;/p&gt;

&lt;p&gt;SELECT u.user_id AS u_user_id, m.message_id AS mmessage_id, m.message_senddate AS mmessage_senddate, m.message_title AS mmessage_title, m.message_content AS mmessage_content, m.message_alias AS mmessage_alias, m.message_categoryid AS m_message_categoryid&lt;br/&gt;
FROM users u&lt;br/&gt;
LEFT JOIN messages m ON ( u.user_id = m.message_sender )&lt;br/&gt;
WHERE u.user_id&lt;br/&gt;
IN (&lt;br/&gt;
&apos;2&apos;&lt;br/&gt;
)&lt;br/&gt;
AND (&lt;br/&gt;
u.user_id =2&lt;br/&gt;
)&lt;br/&gt;
LIMIT 0 , 30&lt;/p&gt;

&lt;p&gt;If i changed SQL code like below and put the limit at end, the problem solved:&lt;/p&gt;

&lt;p&gt;#Query A&lt;br/&gt;
SELECT DISTINCT u2.user_id FROM users u2 LEFT JOIN messages m2 ON (u2.user_id = m2.message_sender) WHERE u2.user_id = 2&lt;/p&gt;

&lt;p&gt;#Query B&lt;br/&gt;
SELECT u.user_id AS u_user_id, m.message_id AS mmessage_id, m.message_senddate AS mmessage_senddate, m.message_title AS mmessage_title, m.message_content AS mmessage_content, m.message_alias AS mmessage_alias, m.message_categoryid AS m_message_categoryid FROM users u LEFT JOIN messages m ON (u.user_id = m.message_sender) WHERE u.user_id IN (&apos;2&apos;) AND (u.user_id = 2)   LIMIT 1&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;But doctrine&apos;s   limit(1)  metod is Select Distinct &lt;/p&gt;

&lt;p&gt;The query  which starts with ... is at query A but it needs to be at the end of query B&lt;/p&gt;</description>
                <environment>php 5.3.0, mysql 5.1.36, symfony 1.4.3</environment>
            <key id="11061">DC-575</key>
            <summary>Select distinct  limit problem</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="feykintosh">O.</reporter>
                        <labels>
                    </labels>
                <created>Tue, 16 Mar 2010 05:19:42 +0000</created>
                <updated>Wed, 30 Jun 2010 02:57:45 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12272" author="feykintosh" created="Tue, 16 Mar 2010 05:34:16 +0000"  >&lt;p&gt;My schema file.&lt;/p&gt;</comment>
                    <comment id="12295" author="jwage" created="Tue, 16 Mar 2010 15:20:40 +0000"  >&lt;p&gt;It is hard to understand your issue description. Can you make a clear failing Doctrine test case for us to look at? Thanks, Jon&lt;/p&gt;</comment>
                    <comment id="12301" author="feykintosh" created="Wed, 17 Mar 2010 03:57:44 +0000"  >&lt;p&gt;Adding problem screencast: &lt;br/&gt;
&lt;a href=&quot;http://www.screencast-o-matic.com/watch/c6ebiN1qS&quot; class=&quot;external-link&quot;&gt;http://www.screencast-o-matic.com/watch/c6ebiN1qS&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="12302" author="feykintosh" created="Wed, 17 Mar 2010 04:18:39 +0000"  >&lt;p&gt;I found the source of the problem:&lt;br/&gt;
lib\vendor\doctrine\Doctrine\Query.php   in getSqlQuery()  function.&lt;/p&gt;

&lt;p&gt;$limitSubquery  values are default TRUE, but FALSE have to be here.. (to me)&lt;br/&gt;
How can we define the value of the DQL $limitSubquery?&lt;/p&gt;</comment>
                    <comment id="13462" author="willf1976" created="Wed, 30 Jun 2010 02:57:45 +0000"  >&lt;p&gt;Hi O&lt;/p&gt;

&lt;p&gt;I made a patch which will allow you to turn off the limit subquery. If you would like to check it out here is the bug it is posted on:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-701&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-701&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope that helps.&lt;/p&gt;

&lt;p&gt;Will&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10478" name="schema.yml" size="1026" author="feykintosh" created="Tue, 16 Mar 2010 05:34:16 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-581] ORACLE: Missing fields on subquery with Many:Many</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-581</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I use this schema:&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;---
Actuality:
  connection:         web
  tableName:          actuality
  actAs:
    softDelete:       ~
    Timestampable:    ~
    Sluggable:
      fields:         [name]
      indexName:      actuality_sluggable
      canUpdate:      &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  columns:
    id:
      type:           integer(4)
      primary:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned:       &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      sequence:       actuality
    created_at:
      type:           timestamp
    updated_at:
      type:           timestamp
    published_at:
      type:           timestamp
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    unpublished_at:
      type:           timestamp
    name:
      type:           string(255)
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    description_short:
      type:           string(1000)
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    description:
      type:           clob
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    is_professional:
      type:           &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    Categories:
      class: ActualityCategory
      local: actuality_id
      foreign: actuality_category_id
      refClass: ActualityActualityCategory
      foreignAlias: Actualities


ActualityActualityCategory:
  connection:         web
  tableName:          actuality_actuality_category
  options:
    symfony:
      form:   &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      filter: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
  columns:
    actuality_id:
      type:           integer(4)
      primary:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned:       &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    actuality_category_id:
      type:           integer(2)
      primary:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned:       &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    Actuality:
      onDelete:       CASCADE
    

ActualityCategory:
  connection:         web
  tableName:          actuality_category
  actAs:
    softDelete:       ~
    Timestampable:    ~
    Sluggable:
      fields:         [name]
      indexName:      actualityc_sluggable
      canUpdate:      &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  columns:
    id:
      type:           integer(2)
      primary:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned:       &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      sequence:       actualitycategory
    created_at:
      type:           timestamp
    updated_at:
      type:           timestamp
    name:
      type:           string(60)
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Function in my model Actuality&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 retrieveActive($is_authenticated = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
{
  $q = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createQuery(&apos;a&apos;)
  -&amp;gt;leftJoin(&apos;a.Categories c&apos;)
  -&amp;gt;orderBy(&apos;a.published_at DESC&apos;);
  
  &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!$is_authenticated)
  {
    $q-&amp;gt;where(&apos;a.is_professional = ?&apos;, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;);
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $q;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with that, i receive the message &quot;Doctrine_Connection_Oracle_Exception&quot; because Oracle is strict and in the subselect, the field published_at is missing in select. This is the query generate by doctrine:&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 a.id AS a__id, a.published_at AS a__published_at, a.name AS a__name, a.description_short AS a__description_short, a.slug AS a__slug, a2.id AS a2__id, a2.name AS a2__name FROM actuality a LEFT JOIN actuality_actuality_category a3 ON (a.id = a3.actuality_id) LEFT JOIN actuality_category a2 ON a2.id = a3.actuality_category_id WHERE a.id IN (SELECT a4.id FROM ( SELECT DISTINCT a4.id FROM actuality a4 LEFT JOIN actuality_actuality_category a6 ON (a4.id = a6.actuality_id) LEFT JOIN actuality_category a5 ON a5.id = a6.actuality_category_id WHERE a4.is_professional = 0 ORDER BY a4.published_at DESC ) a4 WHERE ROWNUM &amp;lt;= 5) AND (a.is_professional = 0) ORDER BY a.published_at DESC
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If i execute this query and add the field published_at in subquery, this is work.&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 a.id AS a__id, a.published_at AS a__published_at, a.name AS a__name, a.description_short AS a__description_short, a.slug AS a__slug, a2.id AS a2__id, a2.name AS a2__name FROM actuality a LEFT JOIN actuality_actuality_category a3 ON (a.id = a3.actuality_id) LEFT JOIN actuality_category a2 ON a2.id = a3.actuality_category_id WHERE a.id IN (SELECT a4.id FROM ( SELECT DISTINCT a4.id, a4.published_at  FROM actuality a4 LEFT JOIN actuality_actuality_category a6 ON (a4.id = a6.actuality_id) LEFT JOIN actuality_category a5 ON a5.id = a6.actuality_category_id WHERE a4.is_professional = 0 ORDER BY a4.published_at DESC ) a4 WHERE ROWNUM &amp;lt;= 5) AND (a.is_professional = 0) ORDER BY a.published_at DESC
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thanks for your help.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11077">DC-581</key>
            <summary>ORACLE: Missing fields on subquery with Many:Many</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="garfield-fr">Bertrand Zuchuat</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Mar 2010 03:59:20 +0000</created>
                <updated>Thu, 18 Mar 2010 06:09:27 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12318" author="garfield-fr" created="Thu, 18 Mar 2010 05:10:06 +0000"  >&lt;p&gt;I specify another thing. I use this with a pager.&lt;/p&gt;</comment>
                    <comment id="12321" author="garfield-fr" created="Thu, 18 Mar 2010 06:09:27 +0000"  >&lt;p&gt;I create this testcase to find the bug but with that, the test is OK.&lt;/p&gt;

&lt;p&gt;I execute the same code with symfony/doctrine but the query isn&apos;t the same. Why ????&lt;/p&gt;

&lt;p&gt;Extract from symfony exception (Doctrine_Connection-&amp;gt;execute)&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
a.id AS a__id, a.published_at AS a__published_at, a.name AS a__name, a.description_short AS a__description_short,
a.slug AS a__slug, a2.id AS a2__id, a2.name AS a2__name
FROM actuality a
LEFT JOIN actuality_actuality_category a3 ON (a.id = a3.actuality_id)
LEFT JOIN actuality_category a2 ON a2.id = a3.actuality_category_id WHERE a.id
IN (SELECT a4.id FROM ( SELECT DISTINCT a4.id FROM actuality a4 LEFT JOIN actuality_actuality_category a6 ON (a4.id = a6.actuality_id)
LEFT JOIN actuality_category a5 ON a5.id = a6.actuality_category_id
WHERE a4.is_professional = ? ORDER BY a4.published_at DESC ) a4 WHERE ROWNUM &amp;lt;= 5) AND (a.is_professional = ?) ORDER BY a.published_at DESC
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10490" name="DC581TestCase.php" size="6859" author="garfield-fr" created="Thu, 18 Mar 2010 06:06:40 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-585] Hydrate Array does not return full array, when Hydrate Scalar does</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-585</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Description : Upon hydrating as array I will receive one row returned.  If I am to hydrate as Scalar, I will get 200+ rows.  Also, if i echo the sql ($q-&amp;gt;getSqlQuery()) and run that raw, it will also return around 200+ rows.&lt;/p&gt;


&lt;p&gt;$q = Doctrine_Query::create()&lt;br/&gt;
            -&amp;gt;select(&apos;DISTINCT(co.name) AS field, co.name AS value&apos;)&lt;br/&gt;
            -&amp;gt;from(&apos;Model_Country co&apos;)&lt;br/&gt;
            -&amp;gt;leftJoin(&apos;co.City ci&apos;);&lt;/p&gt;

&lt;p&gt;//here we will get only the first row&lt;br/&gt;
$results = $q-&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY);&lt;/p&gt;

&lt;p&gt;//Here we will get all 200+ rows&lt;br/&gt;
$results = $q-&amp;gt;execute(array(), Doctrine::HYDRATE_SCALAR);&lt;/p&gt;

&lt;p&gt;I have yet to dig to deep into this, but if it is indeed a bug, my guess is it is in Doctrine_Hydrator_Graph::hydrateResultSet()&lt;/p&gt;

&lt;p&gt;I can provide more data if needed.&lt;/p&gt;
</description>
                <environment>OS : Ubuntu 9.04&lt;br/&gt;
PHP : PHP 5.2.6-3ubuntu4.5</environment>
            <key id="11085">DC-585</key>
            <summary>Hydrate Array does not return full array, when Hydrate Scalar does</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="solomonjames">James Solomon</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Mar 2010 14:36:24 +0000</created>
                <updated>Fri, 2 Mar 2012 17:44:46 +0000</updated>
                                                                            <due></due>
                    <votes>4</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="12339" author="solomonjames" created="Thu, 18 Mar 2010 15:22:52 +0000"  >&lt;p&gt;I have found this in the google group, and he provides more detailed info, and appears to be the same exact issue : &lt;a href=&quot;http://groups.google.com/group/doctrine-user/msg/8e4a8a673428fff0&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/msg/8e4a8a673428fff0&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="12340" author="solomonjames" created="Thu, 18 Mar 2010 17:30:26 +0000"  >&lt;p&gt;seems to be another similar issue here : &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-328&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-328&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="13013" author="jagalan" created="Wed, 19 May 2010 12:15:32 +0000"  >&lt;p&gt;I&apos;m having that problem and I taked a look into the code, found this:&lt;/p&gt;

&lt;p&gt;I have a query that looks like this:&lt;br/&gt;
 $q = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;select(&apos;af.id as id, af.user_id as user&apos;)&lt;br/&gt;
-&amp;gt;from(&apos;ActivityFeed af&apos;)&lt;br/&gt;
-&amp;gt;innerJoin(&apos;af.user as afu&apos;)&lt;br/&gt;
-&amp;gt;orderBy(&apos;af.time DESC&apos;);&lt;/p&gt;

&lt;p&gt;The sql query without aliases in SELECT or without join is built that way:&lt;br/&gt;
SELECT a.id AS a_&lt;em&gt;id, a.user_id AS a&lt;/em&gt;_user_id ... -&amp;gt; This is returning all the records&lt;/p&gt;

&lt;p&gt;The sql query with aliases in SELECT is built that way:&lt;br/&gt;
SELECT a.id AS a_&lt;em&gt;0, a.user_id AS a&lt;/em&gt;_1 FROM ... -&amp;gt; This is returning only one record&lt;/p&gt;

&lt;p&gt;In Doctrine_Hydrator_Graph::_gatherRowData, line 288 there&apos;s the following call:&lt;/p&gt;

&lt;p&gt;$fieldName = $table-&amp;gt;getFieldName($last);&lt;br/&gt;
Where $last is the last part of the column alias, for example &quot;0&quot; in &quot;a__0&quot;. This way the call asks the table for the name of the &quot;0&quot; field and the table returns &quot;0&quot; so I think we&apos;re not getting the right field name (it must be &quot;id&quot;).&lt;/p&gt;

&lt;p&gt;I&apos;m not understanding the whole hydration process but replacing&lt;/p&gt;

&lt;p&gt;$fieldName = $table-&amp;gt;getFieldName($last);&lt;/p&gt;

&lt;p&gt;with:&lt;/p&gt;

&lt;p&gt;if(isset($this-&amp;gt;_queryComponents[ $cache&lt;span class=&quot;error&quot;&gt;&amp;#91;$key&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;dqlAlias&amp;#39;&amp;#93;&lt;/span&gt;]&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;agg&amp;#39;&amp;#93;&lt;/span&gt;)) {&lt;br/&gt;
              $fieldName = $table-&amp;gt;getFieldName($this-&amp;gt;_queryComponents[ $cache&lt;span class=&quot;error&quot;&gt;&amp;#91;$key&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;dqlAlias&amp;#39;&amp;#93;&lt;/span&gt;]&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;agg&amp;#39;&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;$last&amp;#93;&lt;/span&gt;);&lt;br/&gt;
} else {&lt;br/&gt;
                $fieldName = $table-&amp;gt;getFieldName($last);&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;solves the problem almost in my case.&lt;/p&gt;

&lt;p&gt;Hope it will help to solve the issue. &lt;/p&gt;</comment>
                    <comment id="13190" author="jwage" created="Tue, 8 Jun 2010 14:39:57 +0000"  >&lt;p&gt;It seems the suggested change causes many failures in our test suite. Can you give it a try and confirm?&lt;/p&gt;</comment>
                    <comment id="13721" author="ben.davies" created="Wed, 28 Jul 2010 12:45:51 +0000"  >&lt;p&gt;Just commenting to say that I can confirm this bug exists. It&apos;s happening for me too.  &lt;br/&gt;
I will try and dig deeper when I have some time.&lt;/p&gt;</comment>
                    <comment id="14129" author="jagalan" created="Sat, 28 Aug 2010 10:42:31 +0000"  >&lt;p&gt;As the error is located in Doctrine_Hydrator_Graph, HYDRATE_RECORD has the same behaviour.&lt;/p&gt;

&lt;p&gt;I&apos;m trying to find a solution.&lt;/p&gt;</comment>
                    <comment id="14194" author="ben.davies" created="Tue, 31 Aug 2010 10:21:15 +0000"  >&lt;p&gt;This only occurs if your alias your identifier field.&lt;br/&gt;
Doctrine needs to know which field is the identifier to hydrate records.&lt;br/&gt;
The identifier aliases is formed to x__0, and then, as other commented has found.&lt;br/&gt;
Doctrine then has no way of determining which field is the identifier.&lt;/p&gt;</comment>
                    <comment id="14569" author="enrico" created="Fri, 15 Oct 2010 04:03:09 +0000"  >&lt;p&gt;Hi everybody,&lt;/p&gt;

&lt;p&gt;we really need a unit test here. The provided patch breaks all aliased queries in our application. I will provide a patch and it hopefully solves your problem Juan. If not, please provide more information or add another test-method to the provided unit test.&lt;/p&gt;

&lt;p&gt;I had to rewrite some of the unit tests cause the order of the fields in the generated sql statement has changed due the provided patch.&lt;/p&gt;

&lt;p&gt;Enrico&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/doctrine/doctrine1/commit/e3ae69c2260dae6dfbceb4e24138b2379f3da2e6#commitcomment-169495&quot; class=&quot;external-link&quot;&gt;http://github.com/doctrine/doctrine1/commit/e3ae69c2260dae6dfbceb4e24138b2379f3da2e6#commitcomment-169495&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/estahn/doctrine1/tree/DC-585&quot; class=&quot;external-link&quot;&gt;http://github.com/estahn/doctrine1/tree/DC-585&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="15444" author="loops" created="Fri, 4 Mar 2011 03:56:07 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;


&lt;p&gt;I have a little issue with this bug report...&lt;/p&gt;

&lt;p&gt;I&apos;m currently using Doctrine 1.2 at revision 7691, and I&apos;ve encounter a bug when select the primary key of a model with a custom alias (typically &lt;em&gt;$query-&amp;gt;addSelect( &apos;r.id as my_id&apos; )&lt;/em&gt;), the issue was that Doctrine automatically add &lt;em&gt;`r`.```id``` AS `r&lt;/em&gt;_&lt;em&gt;1`&lt;/em&gt; to the select clause, in addition to the correct &lt;em&gt;`r`.`id` AS `r&lt;/em&gt;_&lt;em&gt;1`&lt;/em&gt; part.&lt;/p&gt;

&lt;p&gt;So, I&apos;ve browse the code to finally found where does this strange thing comes from, and I&apos;ve found it on Doctrine_Query::parseSelect() method, just at the line 663:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;                // Fix for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-585&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-585&lt;/a&gt;&lt;br/&gt;
                // Add selected columns to pending fields&lt;br/&gt;
                if (preg_match(&apos;/^(&lt;span class=&quot;error&quot;&gt;&amp;#91;^\(&amp;#93;&lt;/span&gt;+)\.(\&apos;?)(.*?)(\&apos;?)$/&apos;, $expression, $field)) {&lt;br/&gt;
                    $this-&amp;gt;_pendingFields&lt;span class=&quot;error&quot;&gt;&amp;#91;$componentAlias&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;$alias&amp;#93;&lt;/span&gt; = $field&lt;span class=&quot;error&quot;&gt;&amp;#91;3&amp;#93;&lt;/span&gt;;&lt;br/&gt;
                }&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;So I&apos;m wonder : where does this patch is related to this bug report?&lt;/p&gt;


&lt;p&gt;Whatever, the bug I&apos;ve encounter is very simple : the regular expression that extract the field name takes care about &lt;em&gt;&apos;&lt;/em&gt; but not &lt;em&gt;&#180;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;You will find a patch for the bug &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-585&quot; title=&quot;Hydrate Array does not return full array, when Hydrate Scalar does&quot;&gt;DC-585&lt;/a&gt;-b in a few minutes... This patch just make the regular expression taking account of &lt;em&gt;&apos;&lt;/em&gt; and &lt;em&gt;&#180;&lt;/em&gt; and also remove all useless parentheses in expression (by this way PCRE get less matches to capture and we can earn some precious microseconds).&lt;/p&gt;

&lt;p&gt;Also, this patch should be completed because the query still have two &lt;em&gt;`r`.`id` AS `r&lt;/em&gt;_&lt;em&gt;1`&lt;/em&gt; parts, that may cause some other issues with some databases...&lt;/p&gt;

&lt;p&gt;IMPORTANT NOTE: The previous revision 7674 of Doctrine_Query does not cause the bug encounter with the few lines of code above, just because they were not there. They really must be review.&lt;/p&gt;



&lt;p&gt;Loops&lt;/p&gt;</comment>
                    <comment id="15750" author="loops" created="Thu, 28 Apr 2011 05:03:36 +0000"  >&lt;p&gt;Damn, the bug above was corrected during a few weeks and comes back with the new branch of Doctrine 1.2.14.&lt;/p&gt;

&lt;p&gt;Does anybody can re-apply the corrective patch (renamed &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-585&quot; title=&quot;Hydrate Array does not return full array, when Hydrate Scalar does&quot;&gt;DC-585&lt;/a&gt;-c), please ?&lt;/p&gt;

&lt;p&gt;I repeat it agin, but these few lines of code really need to be review.&lt;/p&gt;

&lt;p&gt;Loops&lt;/p&gt;</comment>
                    <comment id="17241" author="knagode" created="Fri, 13 Jan 2012 20:08:54 +0000"  >&lt;p&gt;I also have this problem .. Anyone know howt o fix it?&lt;/p&gt;

&lt;p&gt;$query-&amp;gt;execute(array(), Doctrine::HYDRATE_ARRAY); // returns one row only&lt;br/&gt;
$query-&amp;gt;execute(array(), Doctrine::HYDRATE_RECORD); // returns one row only&lt;/p&gt;

&lt;p&gt;$query-&amp;gt;execute(array(), Doctrine::HYDRATE_SCALAR); // returns result as expected&lt;/p&gt;</comment>
                    <comment id="17242" author="knagode" created="Sat, 14 Jan 2012 00:40:36 +0000"  >&lt;p&gt;I found solution for my  problem: &lt;/p&gt;

&lt;p&gt;Table had ID field but it was not primary key.  When I deleted this column, doctrine started to work as expected. &lt;/p&gt;</comment>
                    <comment id="17491" author="lacton" created="Fri, 2 Mar 2012 17:44:46 +0000"  >&lt;p&gt;I have run into the same issue.&lt;/p&gt;

&lt;p&gt;Using the default hydration, I get only one record.&lt;/p&gt;

&lt;p&gt;Using &quot;$query-&amp;gt;execute(array(), Doctrine::HYDRATE_SCALAR);&quot;, I get all the expected records.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10950" name="Doctrine-DC-585-b.patch" size="721" author="loops" created="Fri, 4 Mar 2011 04:04:39 +0000" />
                    <attachment id="10976" name="Doctrine-DC-585-c.patch" size="718" author="loops" created="Thu, 28 Apr 2011 05:18:22 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-587] Problem with non equal self referencing many to many relations</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-587</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I think that this bug has been reported already here:&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&lt;br/&gt;
But I thought that it might be useful to submit a very simple test case, with the bug completely isolated.&lt;br/&gt;
When you create a self referenced non equal many-to-many relation like: person has many parents AND has many children (taken from the documentation).&lt;/p&gt;

&lt;p&gt;In the attached test case, after both collections of related records are altered within the foreach statement, Doctrine somehow messes up the Ids in the reference class. Now, it&apos;s important to note, that if you loop through just one of the collections, it won&apos;t fail.&lt;/p&gt;

&lt;p&gt;Thanks in advance!&lt;/p&gt;</description>
                <environment>Windows 7600 / Linux / PHP 5.2.13 / PHP 5.3.0</environment>
            <key id="11090">DC-587</key>
            <summary>Problem with non equal self referencing many to many relations</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="lilawolf">Nil Null</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Mar 2010 22:10:26 +0000</created>
                <updated>Tue, 8 Jun 2010 16:18:20 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10498" name="person.php" size="1102" author="lilawolf" created="Thu, 18 Mar 2010 22:10:26 +0000" />
                    <attachment id="10499" name="relation.php" size="506" author="lilawolf" created="Thu, 18 Mar 2010 22:10:26 +0000" />
                    <attachment id="10500" name="test.php" size="350" author="lilawolf" created="Thu, 18 Mar 2010 22:10:26 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-589] refreshRelated() causes an id to be changed from string to int, causing an unnecessary update query.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-589</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Here is an example:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;class Article &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;title&apos;, &apos;string&apos;, 255);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;body&apos;, &apos;string&apos;, 4096);
    }

    &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;Comment as Comments&apos;, array(
            &apos;local&apos; =&amp;gt; &apos;id&apos;,
            &apos;foreign&apos; =&amp;gt; &apos;articleId&apos;,
        ));
    }
}

class Comment &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;comment&apos;, &apos;string&apos;, 4096);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;articleId&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;Article&apos;, array(
            &apos;local&apos; =&amp;gt; &apos;articleId&apos;,
            &apos;foreign&apos; =&amp;gt; &apos;id&apos;,
        ));
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preUpdate($e)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Exception(&apos;should not get here&apos;);
    }

}

$a = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Article();
$a-&amp;gt;title = &apos;Hi&apos;;
$a-&amp;gt;body = &apos;There&apos;;
$a-&amp;gt;save();

$c = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Comment();
$c-&amp;gt;comment = &apos;1st comment&apos;;
$c-&amp;gt;articleId = $a-&amp;gt;id;
$c-&amp;gt;save();

$a-&amp;gt;refreshRelated(&apos;Comments&apos;);

$a-&amp;gt;title = &apos;Hello&apos;;
$a-&amp;gt;save();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What happens above is that the call to refreshRelated() causes the &apos;id&apos; of the comment to change from string:1 to int:1, which causes the last save of the article to try to save the comment. The exception is there just to illustrate that the Comment is being updated (which should not happen). For us - this is an issue not just because of the extra query, but because some entities in the system (like log entries) actually throw when updated.&lt;/p&gt;

&lt;p&gt;Tested against latest trunk.&lt;/p&gt;

&lt;p&gt;The issue seems to be introduced in r7361.&lt;/p&gt;</description>
                <environment>Ubuntu 9.10, PHP 5.2.10, pgsql 8.3</environment>
            <key id="11092">DC-589</key>
            <summary>refreshRelated() causes an id to be changed from string to int, causing an unnecessary update 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="vladev">Emil Vladev</reporter>
                        <labels>
                    </labels>
                <created>Fri, 19 Mar 2010 08:46:00 +0000</created>
                <updated>Mon, 29 Mar 2010 14:51:08 +0000</updated>
                                                                    <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12504" author="jwage" created="Mon, 29 Mar 2010 14:51:08 +0000"  >&lt;p&gt;How does that revision cause the problem? it doesn&apos;t change any value that is referenced by the object itself. Are you sure the description of the problem is accurate? Maybe it would be best if I could run a Doctrine failing test case to see your problem.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-595] Array hydration fails when sorting DESC</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-595</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Wrong array hydration results.&lt;/p&gt;

&lt;p&gt;Running toArray() on non hydrated collection&lt;br/&gt;
produces different results than using array hydrator.&lt;/p&gt;


&lt;p&gt;Case1. &lt;br/&gt;
Sorting ASC (works)&lt;/p&gt;

&lt;p&gt;$reputationHydrated = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;from(&apos;User_Model_UserReputation ur&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.User u&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.Thread t&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;t.ForumEntry fe&apos;)&lt;br/&gt;
-&amp;gt;where(&apos;u.id = ?&apos;, 1)&lt;br/&gt;
-&amp;gt;orderBy(&apos;ur.event ASC)&lt;br/&gt;
-&amp;gt;execute(null, Doctrine_Core::HYDRATE_ARRAY);&lt;/p&gt;

&lt;p&gt;$reputation = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;from(&apos;User_Model_UserReputation ur&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.User u&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.Thread t&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;t.ForumEntry fe&apos;)&lt;br/&gt;
-&amp;gt;where(&apos;u.id = ?&apos;, 1)&lt;br/&gt;
-&amp;gt;orderBy(&apos;ur.event ASC)&lt;br/&gt;
-&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;$reputationToArray = $reputation-&amp;gt;toArray();&lt;/p&gt;

&lt;p&gt;die($reputationToArray === $reputationHydrated); // true, as expected&lt;/p&gt;


&lt;p&gt;Case 2. &lt;br/&gt;
Sorting DESC (does not work)&lt;/p&gt;

&lt;p&gt;$reputationHydrated = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;from(&apos;User_Model_UserReputation ur&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.User u&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.Thread t&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;t.ForumEntry fe&apos;)&lt;br/&gt;
-&amp;gt;where(&apos;u.id = ?&apos;, 1)&lt;br/&gt;
-&amp;gt;orderBy(&apos;ur.event DESC)&lt;br/&gt;
-&amp;gt;execute(null, Doctrine_Core::HYDRATE_ARRAY);&lt;/p&gt;

&lt;p&gt;$reputation = Doctrine_Query::create()&lt;br/&gt;
-&amp;gt;from(&apos;User_Model_UserReputation ur&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.User u&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;ur.Thread t&apos;)&lt;br/&gt;
-&amp;gt;leftJoin(&apos;t.ForumEntry fe&apos;)&lt;br/&gt;
-&amp;gt;where(&apos;u.id = ?&apos;, 1)&lt;br/&gt;
-&amp;gt;orderBy(&apos;ur.event DESC)&lt;br/&gt;
-&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;$reputationToArray = $reputation-&amp;gt;toArray();&lt;/p&gt;

&lt;p&gt;die($reputationToArray === $reputationHydrated); // false, should be true&lt;/p&gt;

&lt;p&gt;Other hydrators do hydrate as expected.&lt;/p&gt;

&lt;p&gt;Seems that something is wrong in Doctrine_Hydrator_Graph.&lt;/p&gt;</description>
                <environment>Windows, Ubuntu, PostgreSQL,</environment>
            <key id="11112">DC-595</key>
            <summary>Array hydration fails when sorting DESC</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="admirau">admirau</reporter>
                        <labels>
                    </labels>
                <created>Tue, 23 Mar 2010 05:12:57 +0000</created>
                <updated>Tue, 23 Mar 2010 06:12:53 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12436" author="admirau" created="Tue, 23 Mar 2010 06:12:53 +0000"  >&lt;p&gt;Changed one condition in Graph.php, and it works.&lt;br/&gt;
Here is a patch:&lt;/p&gt;

&lt;p&gt;&amp;#8212; Doctrine/Hydrator/Graph.php&lt;br/&gt;
+++ Doctrine/Hydrator/Graph-new.php&lt;br/&gt;
@@ -212,7 +212,7 @@&lt;br/&gt;
                         $indexExists = isset($identifierMap&lt;span class=&quot;error&quot;&gt;&amp;#91;$path&amp;#93;&lt;/span&gt;[$id&lt;span class=&quot;error&quot;&gt;&amp;#91;$parent&amp;#93;&lt;/span&gt;][$id&lt;span class=&quot;error&quot;&gt;&amp;#91;$dqlAlias&amp;#93;&lt;/span&gt;]);&lt;br/&gt;
                         $index = $indexExists ? $identifierMap&lt;span class=&quot;error&quot;&gt;&amp;#91;$path&amp;#93;&lt;/span&gt;[$id&lt;span class=&quot;error&quot;&gt;&amp;#91;$parent&amp;#93;&lt;/span&gt;][$id&lt;span class=&quot;error&quot;&gt;&amp;#91;$dqlAlias&amp;#93;&lt;/span&gt;] : false;&lt;br/&gt;
                         $indexIsValid = $index !== false ? isset($prev&lt;span class=&quot;error&quot;&gt;&amp;#91;$parent&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;$relationAlias&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;$index&amp;#93;&lt;/span&gt;) : false;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;if ( $indexExists || ! $indexIsValid) {&lt;br/&gt;
\ No newline at end of file&lt;br/&gt;
+                        if ( ! $indexExists || ! $indexIsValid) {&lt;br/&gt;
\ No newline at end of file&lt;br/&gt;
                             $element = $this-&amp;gt;getElement($data, $componentName);&lt;br/&gt;
                             $event-&amp;gt;set(&apos;data&apos;, $element);&lt;br/&gt;
                             $listeners&lt;span class=&quot;error&quot;&gt;&amp;#91;$componentName&amp;#93;&lt;/span&gt;-&amp;gt;postHydrate($event);&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Plase check if this does not breaks something else.&lt;br/&gt;
Tests are passing.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-600] Query Cache causes exception when using array parameter and IN in a where clause</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-600</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Following the documentation, I&apos;m using an IN condition in a where clause on a Doctrine_Query with Query cache enabled (APC).  Syntax:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$values = array(1, 2, 3, 4);&lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;del&gt;&amp;gt;from(&apos;SomeModel s&apos;)&lt;/del&gt;&amp;gt;where(&apos;s.column IN ?&apos;, array($values));&lt;/p&gt;

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

&lt;p&gt;The first time this query is run, all is fine, and any subsequent runs will be fine as well, UNLESS the values array changes length, like so:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$values = array(1, 2, 3, 4, 5);&lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;del&gt;&amp;gt;from(&apos;SomeModel s&apos;)&lt;/del&gt;&amp;gt;where(&apos;s.column IN ?&apos;, array($values));&lt;/p&gt;

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

&lt;p&gt;With the query cache enabled, this will throw a PDO &quot;Invalid Parameter Count&quot; exception, because it appears that Doctrine uses the cached query which only has 4 placeholders, but the passed parameters now has a count of 5.&lt;/p&gt;

&lt;p&gt;A change in the length of the parameters array in this situation should cause Doctrine to insert a new entry into the query cache for this query.&lt;/p&gt;

&lt;p&gt;Let me know if you need more information regarding this, if I find time I can try to put together a Test case.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
                <environment>PHP 5.2.11 Linux, Mysql 5.0.x</environment>
            <key id="11135">DC-600</key>
            <summary>Query Cache causes exception when using array parameter and IN in a where clause</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="jklehr">Jay Klehr</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Mar 2010 14:38:22 +0000</created>
                <updated>Wed, 21 Jul 2010 09:07:08 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12517" author="jklehr" created="Tue, 30 Mar 2010 15:06:03 +0000"  >&lt;p&gt;Failing test case exhibiting this bug.&lt;/p&gt;</comment>
                    <comment id="12518" author="jklehr" created="Tue, 30 Mar 2010 15:09:41 +0000"  >&lt;p&gt;I&apos;ve attached a TestCase that I put together that shows this bug.&lt;/p&gt;

&lt;p&gt;Turns out that when using the sqlite adapter, the exception isn&apos;t thrown, so I had to look at the profiler in order to show that the query fetched from the cache has the wrong parameter count.&lt;/p&gt;

&lt;p&gt;I also tested this with the &quot;whereIn()&quot; method instead of just &quot;where()&quot;.  whereIn works correctly (but isn&apos;t as flexible as where, so I don&apos;t believe it&apos;s an acceptable replacement in all situations).&lt;/p&gt;</comment>
                    <comment id="12519" author="jklehr" created="Tue, 30 Mar 2010 15:12:14 +0000"  >&lt;p&gt;fixing my quoted blocks&lt;/p&gt;</comment>
                    <comment id="12520" author="jklehr" created="Tue, 30 Mar 2010 15:19:28 +0000"  >&lt;p&gt;Updated test case.  I discovered that sqlite DOES throw an exception in the array&apos;s length grows in the second query so added another test to my test case to exhibit this.&lt;/p&gt;</comment>
                    <comment id="13633" author="commi.m" created="Wed, 21 Jul 2010 08:36:15 +0000"  >&lt;p&gt;Hi, this bug just hit me hard, and made a quick fix:&lt;/p&gt;

&lt;p&gt;in the Query/Abstract.php&lt;/p&gt;

&lt;p&gt;the function calculateQueryCacheHash was augmented with the param-count:&lt;/p&gt;

&lt;p&gt;    public function calculateQueryCacheHash($params = array())&lt;/p&gt;
    {
        $dql = $this-&amp;gt;getDql();
        /// quickfox by  Till Seifert
        $hash = md5($dql . &apos;|&apos; . count($this-&amp;gt;getFlattenedParams($params)) . &apos;|&apos; . var_export($this-&amp;gt;_pendingJoinConditions, true) . &apos;DOCTRINE_QUERY_CACHE_SALT&apos;);
        return $hash;
    }



&lt;p&gt;and in protected function _execute($params) the params are passed:&lt;/p&gt;

&lt;p&gt;Line:927&lt;br/&gt;
++                 $hash = $this-&amp;gt;calculateQueryCacheHash($dqlParams);&lt;/p&gt;



&lt;p&gt;cann anyone comment on if this could be horribly wrong? for know this fixes this bug for me.&lt;/p&gt;

&lt;p&gt;[EDIT: posted code as attachment, for better readability)&lt;/p&gt;</comment>
                    <comment id="13634" author="commi.m" created="Wed, 21 Jul 2010 08:39:37 +0000"  >&lt;p&gt;proposed fix. not a patch, sorry.&lt;/p&gt;

&lt;p&gt;it&apos;s also faulty: it runs getFlattenedParams twice, and it fails when you have more than 1 &quot;x IN Array&quot; condition. If the global number or queryparams stays the same, no new cache-entry is created, so you wold have somehow incorporate the individual param-parts-sizes in the cache-hash, not just the number of params.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10528" name="DC600TestCase.php" size="7523" author="jklehr" created="Tue, 30 Mar 2010 15:19:28 +0000" />
                    <attachment id="10702" name="quickfix.txt" size="410" author="commi.m" created="Wed, 21 Jul 2010 08:39:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                )

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

                )

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

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

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

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

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

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





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

<item>
            <title>[DC-606] [Oracle] Query on M:M with relation name doesn&apos;t work</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-606</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;My schema:&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;---
Actuality:
  connection:         web
  tableName:          actuality
  actAs:
    softDelete:       ~
    Timestampable:    ~
    Sluggable:
      fields:         [name]
      builder:        [tool, slugify]
      indexName:      actuality_sluggable
      canUpdate:      &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  columns:
    id:
      type:           integer(4)
      primary:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      unsigned:       &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      sequence:       actuality
    created_at:
      type:           timestamp
    updated_at:
      type:           timestamp
    published_at:
      type:           timestamp
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    unpublished_at:
      type:           timestamp
    name:
      type:           string(255)
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    description_short:
      type:           string(1000)
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    description:
      type:           clob
      notnull:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    is_professional:
      type:           &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;:        &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  relations:
    Categories:
      class: ActualityCategory
      local: actuality_id
      foreign: actuality_category_id
      refClass: ActualityActualityCategory
      foreignAlias: Actualities
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And my query:&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 retrieveCloud($is_professional, $limit = 20)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createQuery(&apos;ac&apos;)
    -&amp;gt;leftJoin(&apos;ac.Actualities a2&apos;)
    -&amp;gt;where(&apos;ac.id IN (SELECT aac.actuality_category_id FROM Actuality a LEFTJOIN a.ActualityActualityCategory aac WHERE a.published_at &amp;lt; ? AND a.is_professional = ?)&apos;, array(date(&apos;Y-m-d H:i:s&apos;), $is_professional))
    -&amp;gt;orderBy(&apos;ac.name&apos;)
    -&amp;gt;limit($limit)
    -&amp;gt;execute();
  }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I have this error: Doctrine_Connection_Oracle_Exception&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;ORA-01008: not all variables bound : SELECT a.id AS a__id, a.created_at AS a__created_at, a.updated_at AS a__updated_at, a.name AS a__name, a.deleted_at AS a__deleted_at, a.slug AS a__slug, a2.id AS a2__id, a2.created_at AS a2__created_at, a2.updated_at AS a2__updated_at, a2.published_at AS a2__published_at, a2.unpublished_at AS a2__unpublished_at, a2.name AS a2__name, a2.description_short AS a2__description_short, a2.description AS a2__description, a2.is_professional AS a2__is_professional, a2.deleted_at AS a2__deleted_at, a2.slug AS a2__slug FROM actuality_category a LEFT JOIN actuality_actuality_category a3 ON (a.id = a3.actuality_category_id) LEFT JOIN actuality a2 ON a2.id = a3.actuality_id AND (a2.deleted_at IS NULL) WHERE a.id IN (SELECT a4.id FROM ( SELECT DISTINCT a4.id FROM actuality_category a4 LEFT JOIN actuality_actuality_category a6 ON (a4.id = a6.actuality_category_id) LEFT JOIN actuality a5 ON a5.id = a6.actuality_id AND (a5.deleted_at IS NULL) WHERE a4.id IN (SELECT a8.actuality_category_id AS a5__actuality_category_id FROM actuality a7 LEFT JOIN actuality_actuality_category a8 ON a7.id = a8.actuality_id WHERE (a7.published_at &amp;lt; :oci_b_var_1 AND a7.is_professional = :oci_b_var_2)) AND (a4.deleted_at IS NULL) ORDER BY a4.name ) a4 WHERE ROWNUM &amp;lt;= 20) AND (a.id IN (SELECT a5.actuality_category_id AS a5__actuality_category_id FROM actuality a4 LEFT JOIN actuality_actuality_category a5 ON a4.id = a5.actuality_id WHERE (a4.published_at &amp;lt; :oci_b_var_3 AND a4.is_professional = :oci_b_var_4)) AND (a.deleted_at IS NULL)) ORDER BY a.name
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="11147">DC-606</key>
            <summary>[Oracle] Query on M:M with relation name doesn&apos;t work</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="garfield-fr">Bertrand Zuchuat</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Mar 2010 04:20:23 +0000</created>
                <updated>Mon, 29 Mar 2010 04:20:23 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-608] Limit and Offset breaks query with multiple non-join FROM statements</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-608</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;blockquote&gt;
&lt;p&gt;$query = $query-&amp;gt;select(&apos;sf_guard_permission.id,&lt;br/&gt;
      cms_section_translation.slug||\&apos; \&apos;||SUBSTRING(&quot;name&quot;, POSITION(\&apos;@\&apos; in &quot;name&quot;) + 1) as name,&lt;br/&gt;
      sf_guard_permission.description,&lt;br/&gt;
      sf_guard_permission.created_at, sf_guard_permission.updated_at&apos;);&lt;br/&gt;
    $query = $query-&amp;gt;from(&apos;sfGuardPermission sf_guard_permission&apos;);&lt;br/&gt;
    $query = $query-&amp;gt;addfrom(&apos;CmsSection cms_section&apos;);&lt;br/&gt;
    $query = $query-&amp;gt;innerJoin(&apos;cms_section.WithCmsSectionTranslation cms_section_translation&apos;);&lt;br/&gt;
    $query = $query-&amp;gt;where(&apos;cast(SUBSTRING(&quot;name&quot;, 1, POSITION(\&apos;@\&apos; in &quot;name&quot;) - 1) as integer) = cms_section.id&apos;);&lt;br/&gt;
    $query = limit(20);&lt;br/&gt;
    $query = offset(1);&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Generated:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT s.id AS s_&lt;em&gt;id, s.description AS s&lt;/em&gt;&lt;em&gt;description, s.created_at AS  s&lt;/em&gt;&lt;em&gt;created_at, s.updated_at AS s&lt;/em&gt;&lt;em&gt;updated_at, c2.slug||&apos;  &apos;||SUBSTR(&quot;name&quot;, POSITION(&apos;@&apos; in &quot;name&quot;) + 1) AS c2&lt;/em&gt;_0 FROM  sf_guard_permission s, cms_section c INNER JOIN cms_section_translation  c2 ON c.id = c2.sec_id WHERE s.id IN (SELECT doctrine_subquery_alias.id  FROM (SELECT DISTINCT s2.id, c3.deleted_at FROM sf_guard_permission s2  cms_section c3 INNER JOIN cms_section_translation c4 ON c3.id =  c4.sec_id WHERE cast(SUBSTR(&quot;name&quot;, 1, POSITION(&apos;@&apos; in &quot;name&quot;) - 1) as  integer) = c3.id ORDER BY c3.deleted_at DESC LIMIT 20) AS  doctrine_subquery_alias) AND (cast(SUBSTR(&quot;name&quot;, 1, POSITION(&apos;@&apos; in  &quot;name&quot;) - 1) as integer) = c.id) ORDER BY c.deleted_at DESC&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Notice:&lt;br/&gt;
SELECT DISTINCT s2.id, c3.deleted_at FROM sf_guard_permission s2 &lt;font color=&quot;red&quot;&gt; comma that is missing &lt;/font&gt; cms_section c3&lt;/p&gt;</description>
                <environment></environment>
            <key id="11152">DC-608</key>
            <summary>Limit and Offset breaks query with multiple non-join FROM statements</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="sid.gbf">Sid GBF</reporter>
                        <labels>
                    </labels>
                <created>Tue, 30 Mar 2010 13:38:28 +0000</created>
                <updated>Tue, 30 Mar 2010 13:38:28 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10526" name="query.diff" size="552" author="sid.gbf" created="Tue, 30 Mar 2010 13:38:28 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-609] Symfony doctrine doesnt save an M:M table if one of the tables is in a 1:1 relationship with another table</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-609</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Symfony doctrine doesnt save an M:M table if one of the tables is in a 1:1 relationship with another table. Refer to Screen.png for ER diagram.&lt;/p&gt;

&lt;p&gt;I have included the schema files as attachments.&lt;/p&gt;

&lt;p&gt;You will notice in Screen shot 2010-03-31 at 3.30.56 AM.png, an item is selected in &quot;Amenities list&quot;. When the form is submitted, everything saves in the db except for the item in the &quot;Amenities list&quot; (Screen shot 2010-03-31 at 3.31.37 AM.png)&lt;/p&gt;
</description>
                <environment>MAC, Symfony PHP framework</environment>
            <key id="11154">DC-609</key>
            <summary>Symfony doctrine doesnt save an M:M table if one of the tables is in a 1:1 relationship with another table</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="krz">Chris F</reporter>
                        <labels>
                    </labels>
                <created>Tue, 30 Mar 2010 15:42:04 +0000</created>
                <updated>Wed, 31 Mar 2010 06:39:54 +0000</updated>
                                    <version>1.2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12528" author="krz" created="Wed, 31 Mar 2010 06:39:54 +0000"  >&lt;p&gt;The problem could be because i am embedding a form that has a M:M relation with another table.&lt;/p&gt;

&lt;p&gt;Which is a similar issue to &lt;a href=&quot;http://trac.symfony-project.org/ticket/5867&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/ticket/5867&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many have mentioned to override the saveEmbeddedForms() function inside BaseFormDoctrine.&lt;/p&gt;

&lt;p&gt;The patch at: &lt;a href=&quot;http://trac.symfony-project.org/ticket/5867&quot; class=&quot;external-link&quot;&gt;http://trac.symfony-project.org/ticket/5867&lt;/a&gt; doesnt work. How can we fix this?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10532" name="Ad.yml" size="1766" author="krz" created="Tue, 30 Mar 2010 15:44:27 +0000" />
                    <attachment id="10534" name="Amenity.yml" size="303" author="krz" created="Tue, 30 Mar 2010 15:44:27 +0000" />
                    <attachment id="10533" name="Housing.yml" size="1001" author="krz" created="Tue, 30 Mar 2010 15:44:27 +0000" />
                    <attachment id="10535" name="HousingAmenity.yml" size="560" author="krz" created="Tue, 30 Mar 2010 15:44:39 +0000" />
                    <attachment id="10530" name="Screen shot 2010-03-31 at 3.30.56 AM.png" size="26945" author="krz" created="Tue, 30 Mar 2010 15:42:04 +0000" />
                    <attachment id="10531" name="Screen shot 2010-03-31 at 3.31.37 AM.png" size="28450" author="krz" created="Tue, 30 Mar 2010 15:42:04 +0000" />
                    <attachment id="10529" name="Screen.png" size="42709" author="krz" created="Tue, 30 Mar 2010 15:42:04 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-610] Chaining innerjoins can only be made uni-directional; order matters</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-610</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The following code fails&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;This doesn&apos;t work&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Doctrine_Query::create()
	-&amp;gt;select(&apos;Table t1&apos;)
	-&amp;gt;innerJoin(&apos;f1.Foreign2 f2 WITH f1.field = 2&apos;)
	-&amp;gt;innerJoin(&apos;t1.Foreign1 f1&apos;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Doctrine seems only to be happy when we change the order of the inner joins&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;This works&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Doctrine_Query::create()
	-&amp;gt;select(&apos;Table t1&apos;)
	-&amp;gt;innerJoin(&apos;t1.Foreign1 f1&apos;)
	-&amp;gt;innerJoin(&apos;f1.Foreign2 f2 WITH f1.field = 2&apos;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>I&amp;#39;ve witnessed the problem in Doctrine 1.2.2 and 1.2.1</environment>
            <key id="11155">DC-610</key>
            <summary>Chaining innerjoins can only be made uni-directional; order matters</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="exceptione">Exception e</reporter>
                        <labels>
                    </labels>
                <created>Tue, 30 Mar 2010 17:07:53 +0000</created>
                <updated>Fri, 31 Dec 2010 17:18:07 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12521" author="exceptione" created="Tue, 30 Mar 2010 17:09:16 +0000"  >&lt;p&gt;fixed typo&lt;/p&gt;</comment>
                    <comment id="15078" author="dquintard" created="Fri, 31 Dec 2010 17:17:05 +0000"  >&lt;p&gt;What about this issue.&lt;br/&gt;
I&apos;ve got the same:&lt;/p&gt;

&lt;p&gt;$q2 = Doctrine_Query::create()&lt;br/&gt;
			-&amp;gt;select(&apos;*&apos;)&lt;br/&gt;
			-&amp;gt;from(&apos;Model_TForfaitType ft&apos;)&lt;br/&gt;
			-&amp;gt;innerJoin(&apos;ft.TServiceForfait sf&apos;);&lt;br/&gt;
		echo $q2-&amp;gt;getSqlQuery();&lt;br/&gt;
		$results = $q2-&amp;gt;fetchArray();&lt;br/&gt;
		echo &quot;results:&quot;.count($results).&quot;&amp;lt;br&amp;gt;&quot;; =&amp;gt; 3 results&lt;/p&gt;

&lt;p&gt;		$q3 = Doctrine_Query::create()&lt;br/&gt;
			-&amp;gt;select(&apos;*&apos;)&lt;br/&gt;
			-&amp;gt;from(&apos;Model_TServiceForfait sf&apos;)&lt;br/&gt;
			-&amp;gt;innerJoin(&apos;sf.TForfaitType ft&apos;);&lt;br/&gt;
		echo $q3-&amp;gt;getSqlQuery();		&lt;br/&gt;
		$results = $q3-&amp;gt;fetchArray();&lt;br/&gt;
		echo &quot;results:&quot;.count($results).&quot;&amp;lt;br&amp;gt;&quot;; =&amp;gt; 16 results&lt;/p&gt;

&lt;p&gt;		$q4 = Doctrine_Query::create()&lt;br/&gt;
			-&amp;gt;select(&apos;*&apos;)&lt;br/&gt;
			-&amp;gt;from(&apos;Model_TServiceForfait,Model_TForfaitType&apos;);&lt;br/&gt;
		echo $q4-&amp;gt;getSqlQuery();		&lt;br/&gt;
		$results = $q4-&amp;gt;fetchArray();&lt;br/&gt;
		echo &quot;results:&quot;.count($results).&quot;&amp;lt;br&amp;gt;&quot;; =&amp;gt; 16 results&lt;/p&gt;

&lt;p&gt;Moreover i tried with Doctrine 1.3 and this problem is not resolved.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-614] Separate the properties of the parent and the children</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-614</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I want to talk about the inheritance, simple type and columns_aggregation.&lt;/p&gt;

&lt;p&gt;Here an example of parent classes and two sub-classes : &lt;a href=&quot;http://pastebin.com/5qJKtgp1&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/5qJKtgp1&lt;/a&gt;&lt;br/&gt;
Here the generated models classes : &lt;a href=&quot;http://pastebin.com/j2PmT7sd&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/j2PmT7sd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To sum up : The parent class is Show, and the sub-classes are Video and Playlist.&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;A Show have a title.&lt;/li&gt;
	&lt;li&gt;A Video have a filename.&lt;/li&gt;
	&lt;li&gt;A Playlist have a user.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The problem that appear with the generated models, Is that the following code is working.&lt;br/&gt;
$playlist = Doctrine_Core::getTable (&quot;Model_Playlist&quot;)-&amp;gt;find (3);&lt;br/&gt;
$playlist-&amp;gt;filename;&lt;/p&gt;

&lt;p&gt;Or, the POO concept want that the filename property doesn&apos;t exist/available on a Playlist object. And Doctrine should throw an Exception ! Or, It is not the case.&lt;/p&gt;

&lt;p&gt;The solution is to move the generated code of the sub-classes into there own classes.&lt;br/&gt;
Here the complete solution : &lt;a href=&quot;http://pastebin.com/LzTG10P7&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/LzTG10P7&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem with the one-to-one or many-to-many relationship is still the same.&lt;/p&gt;

&lt;p&gt;The solution is more POO compliant.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11165">DC-614</key>
            <summary>Separate the properties of the parent and the children</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Fri, 2 Apr 2010 05:45:08 +0000</created>
                <updated>Fri, 2 Apr 2010 05:58:41 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Inheritance</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-615] New sequence generation for PostgreSQL SQL code results in errors</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-615</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;With 1.2.2 we get errors for our generated PostgreSQL code: &quot;sequence &amp;lt;sequence name&amp;gt; already exists&quot;. I tracked down the issue to the following:&lt;/p&gt;

&lt;p&gt;Doctrine_Export_Pgsql::createTableSql() has the following new 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;if&lt;/span&gt; (isset($options[&apos;sequenceName&apos;])) {
            $sql[] = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createSequenceSql($options[&apos;sequenceName&apos;]);
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is fine, but this CREATE SEQUENCE code is now added after the CREATE TABLE code. This does not work okay for PostgreSQL, since PostgreSQL will automatically create the index for you if it does not yet exist. If CREATE SEQUENCE is required for some reason, then it should ge before the CREATE TABLE to be useful (it could for example be useful if different increment intervals or starting numbers should be set for the sequence).&lt;/p&gt;

&lt;p&gt;I tried moving the new code up, but that did not yet give me the desired results. The issue is that Doctrine_Export::exportClassesSql() collects all the SQL in an array and finally does:&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;rsort($sql);
&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $sql;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This can break any statement set in there that should be run in a specific order. For the PostgreSQL code, this will put all the CREATE TABLE calls in font of the CREATE SEQUENCE calls, resulting in the errors that we see.&lt;/p&gt;

&lt;p&gt;Suggested fix options:&lt;/p&gt;

&lt;p&gt;1) Do not sort the SQL queries, but accept them as generated by the db specific Export class (but I&apos;m only suggesting this, because I am not aware of the reason to do an rsort() in the first place).&lt;/p&gt;

&lt;p&gt;2) Change the PostgreSQL export code to make it immune to the sorting.&lt;/p&gt;

&lt;p&gt;We did the latter in our code. The CREATE SEQUENCE and CREATE TABLE are concatenated into one statement string (&quot;&amp;lt;squence&amp;gt;;&amp;lt;table&amp;gt;&quot;) that is added to the list of SQL queries. This provides us a work-around for the problem. The first solution is more clean IMO, but I lack knowledge to tell if the rsort() is here for technical or aesthetic reasons. &lt;/p&gt;</description>
                <environment></environment>
            <key id="11168">DC-615</key>
            <summary>New sequence generation for PostgreSQL SQL code results in errors</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mmakaay">Maurice Makaay</reporter>
                        <labels>
                    </labels>
                <created>Fri, 2 Apr 2010 16:53:14 +0000</created>
                <updated>Sat, 22 Jan 2011 08:41:30 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14251" author="mmakaay" created="Fri, 3 Sep 2010 06:10:48 +0000"  >&lt;p&gt;An additional issue for the PostgreSQL sequence handling: the Doctrine code does create a sequence field in the tables. However, the sequence system seems not to be in use at all for generating new id fields. As a result, the sequences remain at their initial value of 1.&lt;/p&gt;

&lt;p&gt;We noticed this when we tried to manually insert a record in the database. Five records were already available. The manual INSERT failed, because of a duplicate index error on the id field. After a few attempts, it did work. That was because the PostgreSQL sequence had reached a value of 6, which was a non-existing id for the table at that point.&lt;/p&gt;

&lt;p&gt;I think that a choice has to be made here: either use sequences or don&apos;t:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;When id&apos;s are always generated without using the sequence features of PostgreSQL, then do not create the id fields as sequences, but make them standard primary key integer fields instead, so no unused sequence objects will be created in the database.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;When id generation makes use of sequence features, then it&apos;s okay to use sequences for id fields. When doing this, loading a new dataset into the database might require some additional attention for the sequences. After import, the sequences should be updated to represent the first free id value for the table that it is providing id values for. When data import makes use of the sequences directly for generating id&apos;s, then this would not be necessary of course.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I hope this helps in improving Doctrine.&lt;/p&gt;</comment>
                    <comment id="15158" author="mmakaay" created="Sat, 22 Jan 2011 08:41:30 +0000"  >&lt;p&gt;The issue with the duplicate id&apos;s is fixed on our system.&lt;/p&gt;

&lt;p&gt;When defining &quot;sequence: &amp;lt;something&amp;gt;&quot; in a YAML file for a field, Doctrine will generate two sequences: one as specified in the YAML data and one as autogenerated by PostgreSQL. Doctrine inserts will use one, direct inserts via SQL will use the other. By specifying an field as primary and autoincrement, a correct and single sequence will be generated.&lt;/p&gt;

&lt;p&gt;This work-around works for us. The Doctrine team will have to decide on what the expected behavior for &quot;sequence&quot; is. The current workings seem a bit off IMO.&lt;/p&gt;

&lt;p&gt;I hope this helps. Thanks.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10541" name="PostreSQL.createTableSql.sequence.fix.diff" size="1685" author="mmakaay" created="Fri, 2 Apr 2010 16:53:14 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-617] migration problem</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-617</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I attached a testcase that reproduces all problem that I noticed (previously reported in &quot;serious symfony doctrine:migrate issues - symfony 1.4&quot; on symfony-dev)&lt;/p&gt;

&lt;p&gt;There is a problem with an empty ON UPDATE when migrate to version 5&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42601&amp;#93;&lt;/span&gt;: Syntax error: 7 B&#321;&#260;D:  b&#322;&#261;d sk&#322;adni w lub blisko &quot;ON&quot;&lt;br/&gt;
LINE 1: ... (object_c_id) REFERENCES object_c(id) ON UPDATE  ON DELETE ...&lt;br/&gt;
                                                             ^. Failing Query: &quot;ALTER TABLE object_b ADD CONSTRAINT object_b_object_c_id_object_c_id FOREIGN KEY (object_c_id) REFERENCES object_c(id) ON UPDATE  ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE&quot;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;When  migrateing from 5 to 3&lt;br/&gt;
Failing Query: &quot;DROP INDEX object_b_object_c_id_idx&quot; - this index doesn&apos;t exist - should be &quot;object_b_object_c_id&quot;&lt;/p&gt;

&lt;p&gt;Also&lt;br/&gt;
        $this-&amp;gt;changeColumn(&apos;object_a&apos;, &apos;name&apos;, &apos;string&apos;, &apos;2048&apos;, array(&lt;br/&gt;
             ));&lt;br/&gt;
        $this-&amp;gt;changeColumn(&apos;object_b&apos;, &apos;name&apos;, &apos;string&apos;, &apos;2048&apos;, array(&lt;br/&gt;
             ));&lt;br/&gt;
doesn&apos;t work for me&lt;/p&gt;</description>
                <environment>Symfony 1.4.3, Linux, PostgreSQL, Pgpool II</environment>
            <key id="11177">DC-617</key>
            <summary>migration problem</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="m">MichalKJP</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Apr 2010 12:07:49 +0000</created>
                <updated>Fri, 22 Jun 2012 14:01:48 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Migrations</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14308" author="ludo.fleury" created="Wed, 8 Sep 2010 10:27:25 +0000"  >&lt;p&gt;My own Quick Fix for  DROP INDEX (into Export class)&lt;br/&gt;
Skip Formatter-&amp;gt;getIndexName() in Export-&amp;gt;dropIndex()&lt;br/&gt;
see : &lt;a href=&quot;http://www.pastie.org/1145916&quot; class=&quot;external-link&quot;&gt;http://www.pastie.org/1145916&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="14309" author="m" created="Wed, 8 Sep 2010 10:38:12 +0000"  >&lt;p&gt;I already tested this solution and I can confirm that also works for me.&lt;/p&gt;

&lt;p&gt;I am afraid that Johnatan spends much time on the new version and did not have time to correct these bugs for the old version. So we still repair migrations manualy.&lt;/p&gt;</comment>
                    <comment id="18131" author="sarcas" created="Fri, 22 Jun 2012 14:01:48 +0000"  >&lt;p&gt;We&apos;ve had this issue for a while - while Ludo&apos;s fix does work, there is an SQL injection issue in that the &apos;$name&apos; doesn&apos;t get escaped.&lt;/p&gt;

&lt;p&gt;You can do this:  $name = $this-&amp;gt;conn-&amp;gt;quoteIdentifier($name); which also steps around the issue for now.&lt;/p&gt;

&lt;p&gt;The problem appears to be that the indexes &lt;b&gt;aren&apos;t&lt;/b&gt; being created with the _idx string on the end when using the migrations. This is probably down to the index creation process rather than the index removal process.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10545" name="testcase.tar.bz2" size="49650" author="m" created="Tue, 6 Apr 2010 12:07:49 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-618] [PATCH] Local key relations without modifed fields but with modified relations are not saved</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-618</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Assume the following test setup:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Email&amp;#93;&lt;/span&gt; * &amp;#8212; 1 &lt;span class=&quot;error&quot;&gt;&amp;#91;Author&amp;#93;&lt;/span&gt; 1 &amp;#8212; * &lt;span class=&quot;error&quot;&gt;&amp;#91;Book&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Assume further that you have a new Email, Author and Book object. Email and book have modified fields, author does not, except for the foreign key relation.&lt;/p&gt;

&lt;p&gt;Now, when you save the Email object, the related Author is not saved because isModified($deep = false) returns false since no local field is modified. The solution is to pass the parameter $deep = true to isModified().&lt;/p&gt;

&lt;p&gt;Patch and test case are attached. No existing test is broken by this fix.&lt;/p&gt;

&lt;p&gt;PS: This patch fixes the correlated bug that objects with I18N behaviour are not saved if only their Translation objects are modified, but not their own fields.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11178">DC-618</key>
            <summary>[PATCH] Local key relations without modifed fields but with modified relations are not saved</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="11502">DC-740</parent>
                        <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bschussek">Bernhard Schussek</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Apr 2010 13:41:52 +0000</created>
                <updated>Sun, 10 Jul 2011 23:28:08 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10547" name="DC618TestCase.php" size="3518" author="bschussek" created="Tue, 6 Apr 2010 13:48:26 +0000" />
                    <attachment id="11028" name="directadmin-logo.gif" size="1508" author="bozzine" created="Sun, 10 Jul 2011 23:26:45 +0000" />
                    <attachment id="10546" name="ticket_dc618.patch" size="671" author="bschussek" created="Tue, 6 Apr 2010 13:48:26 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-619] preHydrate/postHydrate events do not use proper sub-class component</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-619</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I am trying to use preHydrate/postHydrate with my models that use inheritance. The problem is that when using the parent table is used to query the records, the preHydrate/postHydrate events are passed to the parent record class instead of the proper sub-class for the current record.&lt;/p&gt;

&lt;p&gt;Using the example schema below, if I do a findAll() on the Person table and it contained two Student records and one Professor record... preHydrate would get called on Person instead of Student and Professor. This also applies for any listeners that are registered on Student/Professor and not Person.&lt;/p&gt;

&lt;p&gt;Person:&lt;br/&gt;
  columns:&lt;br/&gt;
    name: &lt;/p&gt;
{ type: string(50) }

&lt;p&gt;Student:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Person&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyType: 1&lt;/p&gt;

&lt;p&gt;Professor:&lt;br/&gt;
  inheritance:&lt;br/&gt;
    extends: Person&lt;br/&gt;
    type: column_aggregation&lt;br/&gt;
    keyField: type&lt;br/&gt;
    keyValue: 2&lt;/p&gt;
</description>
                <environment>PHP 5.2.11 (cli), Doctrine 1.2 (Revision: 7537)</environment>
            <key id="11179">DC-619</key>
            <summary>preHydrate/postHydrate events do not use proper sub-class component</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mlehner">Matt Lehner</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Apr 2010 14:55:23 +0000</created>
                <updated>Mon, 14 Jun 2010 09:28:51 +0000</updated>
                                    <version>1.2.0</version>
                <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Inheritance</component>
                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-623] Impossible to create non-unique slugs</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-623</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I want to create a non-unique slug of a title field from my table.&lt;/p&gt;

&lt;p&gt;But I&apos;ve found that when I change unique from &apos;true&apos; to &apos;false&apos; the slugs were not created or updated&lt;/p&gt;

&lt;p&gt;In lib\Doctrine\Template\Listener\Sluggable.php inside preUpdate() function the first if() statement disables the unique (false) option.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11193">DC-623</key>
            <summary>Impossible to create non-unique slugs</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="adwise">Adwise Internetmarketing</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Apr 2010 08:28:02 +0000</created>
                <updated>Tue, 31 Aug 2010 11:51:12 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Sluggable</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14176" author="jmather" created="Mon, 30 Aug 2010 16:44:12 +0000"  >&lt;p&gt;Theoretically this should clear up the issue. Sorry for not having the time for a complete test at the moment,&lt;/p&gt;</comment>
                    <comment id="14178" author="webpragmatist" created="Mon, 30 Aug 2010 16:59:52 +0000"  >&lt;p&gt;The patch by Jacob doesn&apos;t work. The reason for the unique check is to bypass appending a numeric value to the end of a slug in the even two exist.&lt;/p&gt;

&lt;p&gt;It just needs to somehow be directly sent to the urlize function.&lt;/p&gt;</comment>
                    <comment id="14196" author="jmather" created="Tue, 31 Aug 2010 11:51:12 +0000"  >&lt;p&gt;I would just like to post an update after I&apos;ve been able to test:&lt;/p&gt;

&lt;p&gt;The only functionality that i found actually broken was updating a slug with unique set to false.&lt;/p&gt;

&lt;p&gt;The reason was the wrapped if.&lt;/p&gt;

&lt;p&gt;If you set unique to false, slugs will still fail to update as canUpdate must also be set to true.&lt;/p&gt;

&lt;p&gt;The patch, so far as I can determine, does correct the underlying issue if a slug failing to update when unique is false and canUpdate is true.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10750" name="dc-623.patch" size="1661" author="jmather" created="Mon, 30 Aug 2010 16:44:12 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-624] Validator_Readonly fails for new objects</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-624</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If Readonly validator is on for some field, it fails when you trying to create new object (ie. by loading fixtures).&lt;/p&gt;

&lt;p&gt;Fix proposition is in attachment.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11196">DC-624</key>
            <summary>Validator_Readonly fails for new objects</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tomwys">Tomasz Wysocki</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Apr 2010 13:52:37 +0000</created>
                <updated>Fri, 9 Apr 2010 13:52:37 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Validators</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10563" name="Readonly.php" size="1664" author="tomwys" created="Fri, 9 Apr 2010 13:52:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-625] Doctrine_Query throws exception for custom hydrator that extends stock hydrator</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-625</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have a custom hydrator that extends Doctrine_Hydrator_ScalarDriver, for the sole purpose of simplifying the column keys (by passing false as the 3rd parameter on _gatherRowData):&lt;/p&gt;

&lt;p&gt;class Doctrine_Hydrator_AssocDriver extends Doctrine_Hydrator_ScalarDriver&lt;br/&gt;
{&lt;br/&gt;
    public function hydrateResultSet($stmt)&lt;br/&gt;
    {&lt;br/&gt;
        $cache = array();&lt;br/&gt;
        $result = array();&lt;/p&gt;

&lt;p&gt;        while ($data = $stmt-&amp;gt;fetch(Doctrine_Core::FETCH_ASSOC)) &lt;/p&gt;
{
            $result[] = $this-&amp;gt;_gatherRowData($data, $cache, false);
        }

&lt;p&gt;        return $result;&lt;br/&gt;
    }&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;The processPendingFields method in Doctrine_Query is unnecessarily throwing a Doctrine_Query_Exception at line 465.  This can be resolved by skipping hydration methods that extend None, Scalar and SingleScalar.&lt;/p&gt;

&lt;p&gt;A diff of the changes is attached.&lt;/p&gt;</description>
                <environment>Windows Vista, Apache 2.2, PHP 5.3, MySQL 5.1</environment>
            <key id="11198">DC-625</key>
            <summary>Doctrine_Query throws exception for custom hydrator that extends stock hydrator</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="jaredmellentine">Jared Mellentine</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Apr 2010 17:33:17 +0000</created>
                <updated>Tue, 20 Apr 2010 16:22:39 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10564" name="Query.diff" size="1171" author="jaredmellentine" created="Fri, 9 Apr 2010 17:33:17 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-628] Two queries on the same table seems to share set of fields </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-628</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Two queries:&lt;/p&gt;

&lt;p&gt;1.              $ab1 = Doctrine_Query::create()&lt;br/&gt;
                        -&amp;gt;from(&apos;Model_UserAddressbook ab&apos;)&lt;br/&gt;
                        -&amp;gt;leftJoin(&apos;ab.UserPersons up&apos;)&lt;br/&gt;
                        -&amp;gt;leftJoin(&apos;ab.AdminUsers au&apos;);  // second one doesn&apos;t have this join&lt;/p&gt;

&lt;p&gt;2.              $ab2 = Doctrine_Query::create()&lt;br/&gt;
                        -&amp;gt;from(&apos;Model_UserAddressbook ab&apos;)&lt;br/&gt;
                        -&amp;gt;leftJoin(&apos;ab.UserPersons up&apos;);&lt;/p&gt;

&lt;p&gt;When executing the following fetchOne:&lt;/p&gt;

&lt;p&gt;A.) $x1 = $ab2-&amp;gt;fetchOne()-&amp;gt;toArray();  // has fields from addressbook, and subarray UserPersons, OK&lt;br/&gt;
B.) $x2 = $ab1-&amp;gt;fetchOne()-&amp;gt;toArray();  // has fields from addressbook, and subarray UserPersons and AdminUsers, OK&lt;br/&gt;
C.) $x3 = $ab2-&amp;gt;fetchOne()-&amp;gt;toArray();  // has fields from addressbook, and subarray UserPersons and AdminUsers, NOT OK&lt;/p&gt;

&lt;p&gt;$x1 and $x3 should have the same set of fields, but $x3 has somehow received set of fields from $x2.&lt;/p&gt;

&lt;p&gt;I haven&apos;t turned on any caching, but even if the caching is on, the result sets shouldn&apos;t mix, right?&lt;/p&gt;

&lt;p&gt;I&apos;m talking just about field names (set of fields), not fields data.&lt;/p&gt;</description>
                <environment>OS: Vista 64&lt;br/&gt;
Zend Framework 1.10.1&lt;br/&gt;
MySQL: 5.1.39</environment>
            <key id="11217">DC-628</key>
            <summary>Two queries on the same table seems to share set of fields </summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="vlatko">Vlatko Basic</reporter>
                        <labels>
                    </labels>
                <created>Wed, 14 Apr 2010 04:42:03 +0000</created>
                <updated>Mon, 14 Jun 2010 09:24:49 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-629] Doctrine Integer Validator should use intval() rather than round(floatval())</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-629</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;echo PHP_INT_MAX;
echo &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
echo strval(round(floatval(PHP_INT_MAX)));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;on 64 bit machine, default php install, you get:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;9223372036854775807&lt;br/&gt;
9.22337203685E+18&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;float precision is set to 12 by default. setting it higher offers no benefit, with it set to 20+, it still doesn&apos;t match up (and is actually not reliably past a certain length, i&apos;d have to dig again to find a reference though), but as you can see, no go:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;9223372036854775807&lt;br/&gt;
9223372036854775808&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;as a result, very large #&apos;s do NOT validate as doctrine integers, even though they are.&lt;/p&gt;

&lt;p&gt;fix, use intval() instead. as far as I can tell, and as far as our 400+ unit tests in our application show, PHP_INT_MAX is fully supported everywhere else except for in Validator.php@170:&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;170c170
&amp;lt;                  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (string) $&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; == strval(round(floatval($&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;)));
---
&amp;gt;                  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (string) $&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; == strval(intval($&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt;));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Ubuntu 9.10 x64, php 5.2.10</environment>
            <key id="11219">DC-629</key>
            <summary>Doctrine Integer Validator should use intval() rather than round(floatval())</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="isleshocky77">Stephen Ostrow</reporter>
                        <labels>
                    </labels>
                <created>Wed, 14 Apr 2010 15:41:01 +0000</created>
                <updated>Tue, 8 Jun 2010 17:13:14 +0000</updated>
                                    <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>
                <version>1.2.0-RC1</version>
                <version>1.2.0</version>
                <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                                                <component>Validators</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13224" author="jwage" created="Tue, 8 Jun 2010 17:13:14 +0000"  >&lt;p&gt;This breaks a test:&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_Ticket_1783_TestCase...................................................failed


Doctrine_Ticket_1783_TestCase : method testValidateLargeIntegers failed on line 17 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-630] Add Undelete functionality to SoftDelete behaviour</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-630</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Can an undelete function be added to the Doctrine ORM which will reset deleted_at fields to null and conform to cascade rules (just as the original delete did)?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11220">DC-630</key>
            <summary>Add Undelete functionality to SoftDelete behaviour</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="harryhobbes">Harry Birrell</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Apr 2010 01:35:57 +0000</created>
                <updated>Thu, 15 Apr 2010 01:35:57 +0000</updated>
                                                                    <component>Behaviors</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-631] Documentation </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-631</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/Doctrine_Record/1_2#method_importfrom&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/Doctrine_Record/1_2#method_importfrom&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The description of the $type parameter is : Format type: xml, yml, json&lt;br/&gt;
But it could take an array.&lt;/p&gt;

&lt;p&gt;So the documentation have to be update for this point.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11222">DC-631</key>
            <summary>Documentation </summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Apr 2010 05:18:30 +0000</created>
                <updated>Thu, 15 Apr 2010 05:18:30 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-634] getPopularTags() query fails on Postgresql</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-634</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When I run:&lt;br/&gt;
Doctrine::getTable(&apos;TaggableTag&apos;)-&amp;gt;getPopularTags();&lt;br/&gt;
I get: ERROR: column &quot;i2__1&quot; does not exist&lt;/p&gt;

&lt;p&gt;The failing query on PostgreSql is:&lt;/p&gt;

&lt;p&gt;SELECT t.id AS t_id, t.name AS tname, COUNT(DISTINCT i.id) AS i_0,&lt;br/&gt;
(COUNT(DISTINCT i.id)) AS i__1&lt;br/&gt;
FROM taggable_tag t&lt;br/&gt;
LEFT JOIN cms_model_image_taggable_tag c ON (t.id = c.tag_id)&lt;br/&gt;
LEFT JOIN image i ON i.id = c.id&lt;br/&gt;
WHERE t.id IN&lt;br/&gt;
(SELECT doctrine_subquery_alias.id&lt;br/&gt;
FROM&lt;br/&gt;
(SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1&lt;br/&gt;
FROM taggable_tag t2&lt;br/&gt;
LEFT JOIN cms_model_image_taggable_tag c2 ON (t2.id = c2.tag_id)&lt;br/&gt;
LEFT JOIN image i2 ON i2.id = c2.id&lt;br/&gt;
GROUP BY t2.id HAVING i2__1 &amp;gt; 0&lt;br/&gt;
ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)&lt;br/&gt;
GROUP BY t.id HAVING i__1 &amp;gt; 0&lt;br/&gt;
ORDER BY i__1 DESC&lt;/p&gt;

&lt;p&gt;Seems that this just a PostgreSql issue.&lt;br/&gt;
On Mysql it runs just fine.&lt;/p&gt;

&lt;p&gt;The corrected, working query is:&lt;/p&gt;

&lt;p&gt;SELECT t.id AS t_&lt;em&gt;id, t.name AS t&lt;/em&gt;&lt;em&gt;name, COUNT(DISTINCT i.id) AS i&lt;/em&gt;_0,&lt;br/&gt;
   (COUNT(DISTINCT i.id)) AS i__1&lt;br/&gt;
FROM taggable_tag t&lt;br/&gt;
LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c ON (t.id = c.tag_id)&lt;br/&gt;
LEFT JOIN image i ON i.id = c.id&lt;br/&gt;
WHERE t.id IN&lt;br/&gt;
    (SELECT doctrine_subquery_alias.id&lt;br/&gt;
     FROM&lt;br/&gt;
       (SELECT DISTINCT t2.id, (COUNT(DISTINCT i2.id)) AS i2__1&lt;br/&gt;
        FROM taggable_tag t2&lt;br/&gt;
        LEFT JOIN cms_&lt;em&gt;model&lt;/em&gt;_image_taggable_tag c2 ON (t2.id = c2.tag_id)&lt;br/&gt;
        LEFT JOIN image i2 ON i2.id = c2.id&lt;br/&gt;
        GROUP BY t2.id HAVING COUNT(DISTINCT i2.id) &amp;gt; 0&lt;br/&gt;
        ORDER BY i2__1 DESC LIMIT 10) AS doctrine_subquery_alias)&lt;br/&gt;
GROUP BY t.id, t.name HAVING COUNT(DISTINCT i.id) &amp;gt; 0&lt;br/&gt;
ORDER BY i__1 DESC&lt;/p&gt;

&lt;p&gt;For more details, please read the discussion here:&lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/2647537/doctrine-sql-query-works-on-mysql-on-postgresql-wont&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/2647537/doctrine-sql-query-works-on-mysql-on-postgresql-wont&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Windows, Postgresql</environment>
            <key id="11227">DC-634</key>
            <summary>getPopularTags() query fails on Postgresql</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="admirau">admirau</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Apr 2010 14:47:56 +0000</created>
                <updated>Thu, 15 Apr 2010 14:47:56 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Extensions</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-635] synchronizeWithArray and link-table</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-635</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Tree tables : tags, compo_show_tag, shows&lt;/p&gt;

&lt;p&gt;&quot;compo_show_tag&quot; make a link between tags and shows. It&apos;s a many-to-many relationship.&lt;/p&gt;

&lt;p&gt;Assume that all the Tags / Shows are already create. The max id is 300 for shows and tags.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$itemArray							= array ();&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;					= 38;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&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;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 36;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 200;&lt;/p&gt;

&lt;p&gt;$item = new Model_Tag ();&lt;br/&gt;
$item-&amp;gt;synchronizeWithArray($itemArray, true);&lt;/p&gt;

&lt;p&gt;echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 36&lt;br/&gt;
echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 200&lt;/p&gt;

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

&lt;p&gt;Above create two entry into the compo_show_table. Because all element are existing.&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;$itemArray							= array ();&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;					= 38;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&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;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 36;&lt;/p&gt;

&lt;p&gt;$item = new Model_Tag ();&lt;br/&gt;
$item-&amp;gt;synchronizeWithArray($itemArray, true);&lt;/p&gt;

&lt;p&gt;echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 36&lt;/p&gt;

&lt;p&gt;$item-&amp;gt;save ();&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Above remove the relation between Show#200 and Tag#38, but keep the relation between Show#36 and Tag#38.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$itemArray							= array ();&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;					= 38;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&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;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 36;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 150;&lt;br/&gt;
$item = new Model_Tag ();&lt;br/&gt;
$item-&amp;gt;synchronizeWithArray($itemArray, true);&lt;/p&gt;

&lt;p&gt;echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 36&lt;br/&gt;
echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 150&lt;/p&gt;

&lt;p&gt;$item-&amp;gt;save ();&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Above create a new relation, like the first example.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$itemArray							= array ();&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;					= 38;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&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;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 36;&lt;br/&gt;
$itemArray&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;shows&amp;quot;&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;_identifier&amp;quot;&amp;#93;&lt;/span&gt;		= 140;&lt;/p&gt;

&lt;p&gt;$item = new Model_Tag ();&lt;br/&gt;
$item-&amp;gt;synchronizeWithArray($itemArray, true);&lt;/p&gt;

&lt;p&gt;echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 36&lt;br/&gt;
echo $item-&amp;gt;shows&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;-&amp;gt;idShow; //Output : 140&lt;/p&gt;

&lt;p&gt;$item-&amp;gt;save ();&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Bug is above.&lt;br/&gt;
We except that Doctrine remove the relation between Show#150 and Tag#38 and add a new one between Show#140 and Tag#38. &lt;br/&gt;
Here the bug because Doctrine doesn&apos;t change anything. &lt;/p&gt;

&lt;p&gt;Thanks.&lt;br/&gt;
Armetiz.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11231">DC-635</key>
            <summary>synchronizeWithArray and link-table</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Fri, 16 Apr 2010 09:04:56 +0000</created>
                <updated>Fri, 16 Apr 2010 09:07:30 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-637] Many-to-many: Using Association Class (refclass) property in query adds leftJoin</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-637</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When trying to use a refclass property - i.e. normalization table column - in a query, an unnecessary join is added to the query created, which is then used to &quot;access&quot; the property.&lt;/p&gt;

&lt;p&gt;This issue has already been discussed back in May 2008 but still seems to persist.&lt;br/&gt;
Please see the google group discussion &lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/c655832a450ccd1a/9cb6eca6ae1c3dee&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/c655832a450ccd1a/9cb6eca6ae1c3dee&lt;/a&gt; for example + comments.&lt;/p&gt;

&lt;p&gt;Unfortunately it is hardly possible to write a test case for this, as working SQL is generated, but the query is just not right (test case basically would have to assert the query string, wich does not make much sense).&lt;br/&gt;
Another way to test if it does &quot;what it should&quot;, could be to assert contents of $q-&amp;gt;getTableAliasMap() - but does not seem ideal either.&lt;/p&gt;

&lt;p&gt;John Wage commented on this issue &lt;br/&gt;
&quot;Can you create a ticket for this with a failing test case? I believe this&lt;br/&gt;
should be possible and we should investigate a fix for it. &lt;br/&gt;
Thanks, Jon &quot;&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/c655832a450ccd1a/9cb6eca6ae1c3dee#msg_c73934a38515cadb&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/c655832a450ccd1a/9cb6eca6ae1c3dee#msg_c73934a38515cadb&lt;/a&gt;&lt;/p&gt;</description>
                <environment>PHP 5.3.2 (cli) (built: Mar  4 2010 22:12:20)&lt;br/&gt;
mysql 5.1.45&lt;br/&gt;
centOS</environment>
            <key id="11246">DC-637</key>
            <summary>Many-to-many: Using Association Class (refclass) property in query adds leftJoin</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="grass">Pablo Grass</reporter>
                        <labels>
                    </labels>
                <created>Tue, 20 Apr 2010 06:31:54 +0000</created>
                <updated>Tue, 20 Apr 2010 06:39:21 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10581" name="example.php" size="1782" author="grass" created="Tue, 20 Apr 2010 06:31:54 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-640] Slugs aren&apos;t created when inserting/updating a table row</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-640</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Basically the slug column doesn&apos;t get updated in spite of all fields being added correctly, as far as i can tell.&lt;br/&gt;
It seems to be related to additional options because when i don&apos;t have either of the uniqueBy or canUpdate options specified, it just works.&lt;/p&gt;

&lt;p&gt;What&apos;s been missing is the &apos;slug&apos; column value in the sql statements (providing 3 examples):&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;2400 Query INSERT INTO `custom_category` (`block_id`, `name`) VALUES (&apos;1&apos;, &apos;slug test&apos;)
2526 Query INSERT INTO `custom_category` (`name`, `block_id`) VALUES (&apos;please &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; work..&apos;, &apos;1&apos;)
2560 Query UPDATE `custom_category` SET `name` = &apos;still not ok&apos; WHERE `id` = &apos;12&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The generated schema.sql includes the correct create table statement (it&apos;s also correctly inserted in the db):&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 `custom_category` (
  `id` INT UNSIGNED AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `block_id` INT UNSIGNED NOT NULL,
  `slug` VARCHAR(255),
  UNIQUE INDEX `custom_category_sluggable_idx` (`slug`, `block_id`, `name`),
  INDEX `block_id_idx` (`block_id`),
  PRIMARY KEY(`id`)
) ENGINE = INNODB;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The schema.yml entry is the following:&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;CustomCategory:
  connection: removed
  tableName: custom_category
  actAs:
    Sluggable:
      fields: [name]
      uniqueBy: [block_id, name]
      canUpdate: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  columns:
    id:
      type: integer(4)
      unsigned: &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;
      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;
    name:
      type: string(255)
      notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
    block_id:
      type: integer(4)
      unsigned: &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:
    Products:
      class: Product
      foreignAlias: CustomCategories
      refClass: ProductCustomCategory
    Block:
      class: Block
      local: block_id
      foreign: id
      foreignType: many
      foreignAlias: CustomCategories
      type: one
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And finally the appropriate auto generated base class (removed doc block):&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php
&lt;span class=&quot;code-comment&quot;&gt;// Connection Component Binding
&lt;/span&gt;Doctrine_Manager::getInstance()-&amp;gt;bindComponent(&apos;CustomCategory&apos;, &apos;removed&apos;);

&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class BaseCustomCategory &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; aaDoctrineRecord
{
    &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;custom_category&apos;);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;id&apos;, &apos;integer&apos;, 4, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;primary&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;autoincrement&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;length&apos; =&amp;gt; &apos;4&apos;,
             ));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;name&apos;, &apos;string&apos;, 255, array(
             &apos;type&apos; =&amp;gt; &apos;string&apos;,
             &apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;length&apos; =&amp;gt; &apos;255&apos;,
             ));
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasColumn(&apos;block_id&apos;, &apos;integer&apos;, 4, array(
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,
             &apos;unsigned&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;notnull&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;,
             &apos;length&apos; =&amp;gt; &apos;4&apos;,
             ));
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUp()
    {
        parent::setUp();
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasMany(&apos;Product as Products&apos;, array(
             &apos;refClass&apos; =&amp;gt; &apos;ProductCustomCategory&apos;,
             &apos;local&apos; =&amp;gt; &apos;custom_category_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;product_id&apos;));

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Block&apos;, array(
             &apos;local&apos; =&amp;gt; &apos;block_id&apos;,
             &apos;foreign&apos; =&amp;gt; &apos;id&apos;));

        $sluggable0 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Template_Sluggable(array(
             &apos;fields&apos; =&amp;gt;
             array(
              0 =&amp;gt; &apos;name&apos;,
             ),
             &apos;uniqueBy&apos; =&amp;gt;
             array(
              0 =&amp;gt; &apos;block_id&apos;,
              1 =&amp;gt; &apos;name&apos;,
             ),
             &apos;canUpdate&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;actAs($sluggable0);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Using Symfony 1.4 form svn:&lt;br/&gt;
&lt;br/&gt;
URL: &lt;a href=&quot;http://svn.symfony-project.com/branches/1.4&quot;&gt;http://svn.symfony-project.com/branches/1.4&lt;/a&gt;&lt;br/&gt;
Revision: 29223&lt;br/&gt;
Last Changed Rev: 29218&lt;br/&gt;
Last Changed Date: 2010-04-20 08:04:09 +0200 (Di, 20 Apr 2010) </environment>
            <key id="11251">DC-640</key>
            <summary>Slugs aren&apos;t created when inserting/updating a table row</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="perplexa">Daniel K&#246;nig</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Apr 2010 03:59:16 +0000</created>
                <updated>Mon, 3 May 2010 08:31:15 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Sluggable</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12817" author="caponica" created="Sat, 1 May 2010 14:00:57 +0000"  >&lt;p&gt;What is the code that you&apos;re using to generate the INSERT query?&lt;/p&gt;</comment>
                    <comment id="12820" author="perplexa" created="Mon, 3 May 2010 08:31:15 +0000"  >&lt;p&gt;just instantiating the object, calling the setters, followed by a save().&lt;/p&gt;

&lt;p&gt;it&apos;s related to the uniqueBy and canUpdate options, though - it works like a charm without these two.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-643] Doctrine_Collection problem duplicate record</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-643</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;blockquote&gt;
&lt;p&gt;$oVideo	= Doctrine_Core::getTable (&quot;Model_Video&quot;)-&amp;gt;find (500);&lt;br/&gt;
$oVideo	= new Model_Video ();&lt;br/&gt;
$oVideo-&amp;gt;assignIdentifier (500);&lt;/p&gt;

&lt;p&gt;$oTag	= Doctrine_Core::getTable (&quot;Model_Tag&quot;)-&amp;gt;find (500);&lt;br/&gt;
$oVideo-&amp;gt;tags-&amp;gt;clear ();&lt;br/&gt;
$oVideo-&amp;gt;tags[] = $oTag;&lt;br/&gt;
$oVideo-&amp;gt;save ();&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The previous code can be execute a lot of time. &lt;/p&gt;

&lt;p&gt;Now, let us create the Doctrine_Collection.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$oVideo	= Doctrine_Core::getTable (&quot;Model_Video&quot;)-&amp;gt;find (500);&lt;br/&gt;
$oVideo	= new Model_Video ();&lt;br/&gt;
$oVideo-&amp;gt;assignIdentifier (500);&lt;/p&gt;

&lt;p&gt;$oTag	= Doctrine_Core::getTable (&quot;Model_Tag&quot;)-&amp;gt;find (500);&lt;br/&gt;
$oVideo-&amp;gt;tags	= new Doctrine_Collection (&quot;Model_Tag&quot;);&lt;br/&gt;
$oVideo-&amp;gt;tags[] = $oTag;&lt;br/&gt;
$oVideo-&amp;gt;save ();&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Doctrine create a relation between the video and tag. It doesn&apos;t update it. &lt;br/&gt;
If the relation already exists into the database, Doctrine create an other record, or the DB throw an integrity error if you have constraint.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11257">DC-643</key>
            <summary>Doctrine_Collection problem duplicate record</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Apr 2010 09:53:22 +0000</created>
                <updated>Thu, 22 Apr 2010 09:53:22 +0000</updated>
                                    <version>1.2.2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-648] Behavior geographical generates latitude DOUBLE(18, 2), longitude DOUBLE(18, 2) - it&apos;s not exact</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-648</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The problem was already described by another person at &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-385&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-385&lt;/a&gt;&lt;br/&gt;
and was fixed but now is broken again.&lt;/p&gt;

&lt;p&gt;When using the Geographical behaviour in a YML schema the latitude is stored in Mysql as a Double(18,2) instead of a Double as it was in the previous versions. It appears that all doubles in yml are defaulting to (18,2).&lt;/p&gt;</description>
                <environment>Doctrine 1.2.2</environment>
            <key id="11265">DC-648</key>
            <summary>Behavior geographical generates latitude DOUBLE(18, 2), longitude DOUBLE(18, 2) - it&apos;s not exact</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="indiekiduk">Malcolm Hall</reporter>
                        <labels>
                    </labels>
                <created>Sat, 24 Apr 2010 13:20:03 +0000</created>
                <updated>Wed, 19 Jan 2011 05:26:19 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Behaviors</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12744" author="indiekiduk" created="Sat, 24 Apr 2010 13:39:55 +0000"  >&lt;p&gt;The problem lies in DataDict/Mysql.php&lt;/p&gt;

&lt;p&gt;Previously it was:&lt;/p&gt;

&lt;p&gt;case &apos;double&apos;:&lt;br/&gt;
return &apos;DOUBLE&apos;;&lt;/p&gt;

&lt;p&gt;now it&apos;s:&lt;/p&gt;

&lt;p&gt;case &apos;double&apos;:&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;/p&gt;

&lt;p&gt;Perhaps this could be improved so that if there is no length specified it returns just double with no length or scale instead of defaulting to 18, ATTR_DECIMAL_PLACES? I expect that most people that use the double type in yaml wouldn&apos;t want only 2 decimals.&lt;/p&gt;</comment>
                    <comment id="13181" author="jwage" created="Tue, 8 Jun 2010 13:53:29 +0000"  >&lt;p&gt;Can you provide a patch that fixes the situation for you? we&apos;ll see if that has any breakage of current tests.&lt;/p&gt;</comment>
                    <comment id="13706" author="spike008t" created="Mon, 26 Jul 2010 13:56:18 +0000"  >&lt;p&gt;I have the same trouble, and I fix it by specified directly the precision of the double into Doctrine_Template_Geographical class.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&apos;type&apos;     =&amp;gt;  &apos;double(18,8)&apos;,&lt;/p&gt;&lt;/blockquote&gt;</comment>
                    <comment id="14681" author="janusz.slota" created="Mon, 8 Nov 2010 08:54:54 +0000"  >&lt;p&gt;You can fix it with:&lt;br/&gt;
Geographical:&lt;br/&gt;
&amp;nbsp;&amp;nbsp;latitude:&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;type: float(18,8)&lt;br/&gt;
&amp;nbsp;&amp;nbsp;longitude:&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;type: float(18,8)&lt;/p&gt;

&lt;p&gt;instead of:&lt;br/&gt;
Geographical: ~&lt;/p&gt;</comment>
                    <comment id="15149" author="spike008t" created="Wed, 19 Jan 2011 05:26:19 +0000"  >&lt;p&gt;diff on Template/Geographical.php&lt;/p&gt;

&lt;p&gt;Hope that could help&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10913" name="patch.diff" size="1091" author="spike008t" created="Wed, 19 Jan 2011 05:26:19 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-649] Getting Doctrine_Validator_Exception on Doctrine_Record::replace() when using unique</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-649</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Using this code:&lt;/p&gt;

&lt;p&gt;$user = new User();&lt;br/&gt;
$user-&amp;gt;mail = &apos;mail@mail.mail&apos;;&lt;br/&gt;
$user-&amp;gt;save();&lt;br/&gt;
$user2 = new User();&lt;br/&gt;
$user2-&amp;gt;mail = &apos;mail@mail.mail&apos;;&lt;br/&gt;
$user2-&amp;gt;replace();&lt;/p&gt;

&lt;p&gt;I get the following exception:&lt;/p&gt;

&lt;p&gt;Fatal error: Uncaught exception &apos;Doctrine_Validator_Exception&apos; with message &apos;Validation failed in class User: 1 field had validation error: 1 validator failed on mail (unique)&apos; in D:\Workspace\Doctrine\Doctrine\Transaction.php:265&lt;br/&gt;
Stack trace:&lt;br/&gt;
#0 D:\Workspace\Doctrine\Doctrine\Connection.php(1395): Doctrine_Transaction-&amp;gt;commit(NULL)&lt;br/&gt;
#1 D:\Workspace\Doctrine\Doctrine\Connection\UnitOfWork.php(143): Doctrine_Connection-&amp;gt;commit()&lt;br/&gt;
#2 D:\Workspace\Doctrine\Doctrine\Record.php(1748): Doctrine_Connection_UnitOfWork-&amp;gt;saveGraph(Object(User), true)&lt;br/&gt;
#3 D:\Workspace\test.php: Doctrine_Record-&amp;gt;replace()&lt;br/&gt;
#4 &lt;/p&gt;
{main}
&lt;p&gt;thrown in D:\Workspace\Doctrine\Doctrine\Transaction.php on line 265&lt;/p&gt;</description>
                <environment>PHP 5.3.2, MySQL 5.1.46</environment>
            <key id="11268">DC-649</key>
            <summary>Getting Doctrine_Validator_Exception on Doctrine_Record::replace() when using unique</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="p4lschool">p4l</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Apr 2010 11:41:15 +0000</created>
                <updated>Mon, 26 Apr 2010 11:41:15 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-651] [PATCH] Doctrine_Record::option(&apos;orderBy&apos;, ...) of join&apos;s right side being applied to refTable in m2m relationship</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-651</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When using the &lt;tt&gt;Doctrine_Record::option(&apos;orderBy&apos;, ...)&lt;/tt&gt; feature on a table definition, where that table is the target of a many-to-many join, the specified orderBy columns are applied to the relation table&apos;s alias. So for example, given the following definitions:&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;hasColumn(&apos;uid&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;option(&apos;orderBy&apos;, &apos;uid&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;hasMany(&apos;Group as groups&apos;, array(&apos;refClass&apos; =&amp;gt; &apos;UserGroup&apos;, &apos;local&apos; =&amp;gt; &apos;user_uid&apos;, &apos;foreign&apos; =&amp;gt; &apos;group_id&apos;));
  }
}

class Group &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;gid&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;hasMany(&apos;User as users&apos;, array(&apos;refClass&apos; =&amp;gt; &apos;UserGroup&apos;, &apos;local&apos; =&amp;gt; &apos;group_gid&apos;, &apos;foreign&apos; =&amp;gt; &apos;user_id&apos;));
  }
}

class UserGroup &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;user_uid&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;group_gid&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 as user&apos;, array(&apos;local&apos; =&amp;gt; &apos;user_uid&apos;, &apos;foreign&apos; =&amp;gt; &apos;uid&apos;));
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;hasOne(&apos;Group as group&apos;, array(&apos;local&apos; =&amp;gt; &apos;group_gid&apos;, &apos;foreign&apos; =&amp;gt; &apos;gid&apos;));
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;the following queries:&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;select(&apos;u.*&apos;)
  -&amp;gt;from(&apos;User u&apos;)
  -&amp;gt;leftJoin(&apos;u.groups g WITH g.gid=?&apos;, 1);
echo $query-&amp;gt;getSqlQuery() . &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;

$query = Doctrine_Query::create()
  -&amp;gt;select(&apos;g.*&apos;)
  -&amp;gt;from(&apos;Group g&apos;)
  -&amp;gt;leftJoin(&apos;g.users u WITH u.uid=?&apos;, 1);
echo $query-&amp;gt;getSqlQuery() . &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will output the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;SELECT u.uid AS u__uid FROM user u LEFT JOIN user_group u2 ON (u.uid = u2.user_uid) LEFT JOIN group g ON g.gid = u2.group_id AND (g.gid = ?) ORDER BY u.uid&lt;br/&gt;
SELECT g.gid AS g__gid FROM group g LEFT JOIN user_group u2 ON (g.gid = u2.group_gid) LEFT JOIN user u ON u.uid = u2.user_id AND (u.uid = ?) ORDER BY u.uid, u2.uid&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The &lt;tt&gt;orderBy&lt;/tt&gt; &lt;tt&gt;option()&lt;/tt&gt; call is applied to the &lt;tt&gt;User&lt;/tt&gt; definition. The SQL for the first query is correct (where &lt;tt&gt;User&lt;/tt&gt; is on the left side of the join). The SQL for the second query (where &lt;tt&gt;User&lt;/tt&gt; is on the right-most side of the join), however, is obviously incorrect (&lt;tt&gt;UserGroup&lt;/tt&gt; doesn&apos;t even have a &lt;tt&gt;uid&lt;/tt&gt; column). Basically, &lt;tt&gt;User&lt;/tt&gt;&apos;s &lt;tt&gt;orderBy&lt;/tt&gt; option is being applied to both the &lt;tt&gt;User&lt;/tt&gt; table and its respective reference table, &lt;tt&gt;UserGroup&lt;/tt&gt;, when it is the target of a join.&lt;/p&gt;

&lt;p&gt;After digging through the source for a while, I believe I&apos;ve come up with a patch for this issue (which should be checked by someone more knowledgeable of Doctrine&apos;s internals). Basically, in the &lt;tt&gt;Doctrine_Query::buildSqlQuery()&lt;/tt&gt; function, a call is made to &lt;tt&gt;Doctrine_Relation::getOrderByStatement()&lt;/tt&gt; with the reference table (&lt;tt&gt;UserGroup&lt;/tt&gt;)&apos;s alias (&lt;tt&gt;u2&lt;/tt&gt;), which in turn makes a call to &lt;tt&gt;Doctrine_Table::getOrderByStatement()&lt;/tt&gt; on the referenced table (&lt;tt&gt;User&lt;/tt&gt;), filling in the &lt;tt&gt;ORDER BY&lt;/tt&gt; clause with &lt;tt&gt;User&lt;/tt&gt; columns using &lt;tt&gt;UserGroup&lt;/tt&gt;&apos;s alias. My solution was to reorder the logic so that the test for a reference class is made before the initial call to &lt;tt&gt;getOrderByStatement()&lt;/tt&gt; is made. It seems to work against my test case and the test cases in the repository. I&apos;ll post my patch momentarily.&lt;/p&gt;

&lt;p&gt;This bug was first mentioned in the comments in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-313&quot; title=&quot;Ordering m2m relationship with column from related table (with orderBy option)&quot;&gt;DC-313&lt;/a&gt;, but the original ticket comes across as more of a feature request for the &lt;tt&gt;hasMany()&lt;/tt&gt; &lt;tt&gt;orderBy&lt;/tt&gt; feature.&lt;/p&gt;</description>
                <environment>CentOS 5.4&lt;br/&gt;
PHP 5.3.2&lt;br/&gt;
MySQL 5.1.44, for unknown-linux-gnu (x86_64)</environment>
            <key id="11270">DC-651</key>
            <summary>[PATCH] Doctrine_Record::option(&apos;orderBy&apos;, ...) of join&apos;s right side being applied to refTable in m2m relationship</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="suhock">suhock</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Apr 2010 12:22:21 +0000</created>
                <updated>Wed, 31 Aug 2011 12:43:09 +0000</updated>
                                    <version>1.2.2</version>
                <version>1.2.3</version>
                                <fixVersion>1.2.2</fixVersion>
                <fixVersion>1.2.3</fixVersion>
                <fixVersion>1.2.4</fixVersion>
                                <component>Query</component>
                <component>Relations</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="12750" author="suhock" created="Mon, 26 Apr 2010 12:45:12 +0000"  >&lt;p&gt;attached a test case for this bug&lt;/p&gt;</comment>
                    <comment id="12751" author="suhock" created="Mon, 26 Apr 2010 13:01:03 +0000"  >&lt;p&gt;patch against /branches/1.2 HEAD (should also work apply to 1.2.2 tag)&lt;/p&gt;</comment>
                    <comment id="14179" author="dordille" created="Mon, 30 Aug 2010 17:22:44 +0000"  >&lt;p&gt;I can confirm this as an issue.  However I don&apos;t think the above patch adequately fixes the problem it seems like with it an order by is still added for the ref column however the relation alias is lost.&lt;/p&gt;

&lt;p&gt;My query with the patch became&lt;br/&gt;
SELECT g.gid AS g__gid FROM group g LEFT JOIN user_group u2 ON (g.gid = u2.group_gid) LEFT JOIN user u ON u.uid = u2.user_id AND (u.uid = ?) ORDER BY u.uid, uid &lt;/p&gt;

&lt;p&gt;I made an another patch that prevents this extra order by clause from being added and have attached it.&lt;/p&gt;
</comment>
                    <comment id="14428" author="suhock" created="Tue, 21 Sep 2010 08:53:25 +0000"  >&lt;p&gt;I tried out the new patch (Query_orderby_relation.diff), but it provides a reversed diff (patching goes from a patched version to the original). After applying it manually, it fails the provided test case and several additional test cases from the repository.&lt;/p&gt;

&lt;p&gt;The original patch DOES pass the provided test case, when applied against 1.2.2, 1.2.3, or the 1.2 branch from the repository. It does not pass, however, Doctrine_Query_Orderby_TestCase. As the previous poster mentioned, it fails to resolve aliases in instances where the &apos;orderBy&apos; option is specified in a relation definition.&lt;/p&gt;

&lt;p&gt;I deleted the original patch and am providing a revised patch (Ticket_DC651.patch) against branch 1.2 HEAD (also works with 1.2.3), which fixes this issue. It passes all working test cases, including Doctrine_Query_Orderby_TestCase and DC651TestCase.&lt;/p&gt;</comment>
                    <comment id="16406" author="deraujoj" created="Wed, 31 Aug 2011 12:43:08 +0000"  >&lt;p&gt;I had this issue recently on a application I&apos;m working on as described the oderBy option was applied on the joined table on a column that even doesn&apos;t exist in it. I used the DC651 patch provided and it solved the issue, so far I haven&apos;t seen any side effect to it. &lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10585" name="DC651TestCase.php" size="3335" author="suhock" created="Mon, 26 Apr 2010 12:45:12 +0000" />
                    <attachment id="10751" name="Query_orderBy_relation.diff" size="1122" author="dordille" created="Mon, 30 Aug 2010 17:22:56 +0000" />
                    <attachment id="10806" name="Ticket_DC651.patch" size="1448" author="suhock" created="Tue, 21 Sep 2010 08:53:25 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-652] unidirectionnal hasMany definition</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-652</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Here the definition of the Domain Model : &lt;a href=&quot;http://pastebin.com/i80d73s8&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/i80d73s8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To resume, Show is a mother class. Video, is a direct extend from Show.&lt;br/&gt;
ShowContainer  is an abstract class that expend Show. It define an hasMany relation to Video, through CompoShowShow.&lt;br/&gt;
Program and Playlist are extends ShowContainer.&lt;/p&gt;

&lt;p&gt;the following DQL Query work fine.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$query	= Doctrine_Query::create ()&lt;br/&gt;
	-&amp;gt;from (&quot;Model_Program program&quot;)&lt;br/&gt;
	-&amp;gt;leftJoin (&quot;program.children children&quot;);&lt;br/&gt;
$oShow = $query-&amp;gt;fetchOne ();&lt;br/&gt;
var_dump (get_class ($oShow-&amp;gt;children&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;)); //Output Model_Video&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;But, the following code isn&apos;t working :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$oProgram			= Doctrine_Core::getTable (&quot;Model_Program&quot;)-&amp;gt;find (2);&lt;br/&gt;
$oProgram-&amp;gt;children;&lt;/p&gt;

&lt;p&gt;//Throw Exception&lt;br/&gt;
//Message: Unknown record property / related component &quot;children&quot; on &quot;Model_Program&quot; &lt;br/&gt;
//Doctrine\Record.php(1381)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The Program#2 is in the database.&lt;/p&gt;

&lt;p&gt;Here we are.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11276">DC-652</key>
            <summary>unidirectionnal hasMany definition</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Apr 2010 10:22:27 +0000</created>
                <updated>Mon, 14 Jun 2010 09:29:07 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13203" author="jwage" created="Tue, 8 Jun 2010 16:17:14 +0000"  >&lt;p&gt;We&apos;ll need some more information. I don&apos;t see the Model_Program model anywhere. Can you create a failing test case?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-655] When Export from Models to database is made some constraints may not be created</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-655</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When exporting my schema from yaml I noticed that some CONSTRAINT are not created, but all the models are. After analyzing the code I found that an issue is not related to YAML but is related to Doctrine_Table::getExportableFormat(). I have models creation option to create it in PEAR-like style.&lt;/p&gt;

&lt;p&gt;So, when you have a schema like this:&lt;/p&gt;

&lt;p&gt;----------------&lt;br/&gt;
Partner_Code:&lt;br/&gt;
  tableName: partner_code&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    code:&lt;br/&gt;
      type: string(64)&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;/p&gt;

&lt;p&gt;Partner_Channel:&lt;br/&gt;
  tableName: partner_channel&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    name:&lt;br/&gt;
      type: string(64)&lt;br/&gt;
      notnull: true&lt;br/&gt;
  relations:&lt;br/&gt;
    Codes:&lt;br/&gt;
      class: Partner_Code&lt;br/&gt;
      local: channel_id&lt;br/&gt;
      foreign: code_id&lt;br/&gt;
      refClass: Partner_Channel_Code&lt;br/&gt;
      foreignAlias: Partner_Channel&lt;br/&gt;
      foreignType: one&lt;br/&gt;
      type: many&lt;/p&gt;

&lt;p&gt;Partner_Channel_Code:&lt;br/&gt;
  tableName: partner_channel_x_code&lt;br/&gt;
  columns:&lt;br/&gt;
    channel_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    code_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      unsigned: true&lt;br/&gt;
      primary: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
----------------&lt;/p&gt;

&lt;p&gt;it generates sql like this:&lt;/p&gt;

&lt;p&gt;----------------&lt;br/&gt;
CREATE TABLE partner_channel (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(64) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
CREATE TABLE partner_channel_x_code (channel_id INT UNSIGNED, code_id INT UNSIGNED, PRIMARY KEY(channel_id, code_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
CREATE TABLE partner_code (id INT UNSIGNED AUTO_INCREMENT, code VARCHAR(64) NOT NULL UNIQUE, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
ALTER TABLE partner_channel_x_code ADD CONSTRAINT partner_channel_x_code_channel_id_partner_channel_id FOREIGN KEY (channel_id) REFERENCES partner_channel(id);&lt;br/&gt;
----------------&lt;/p&gt;

&lt;p&gt;But should also generate:&lt;/p&gt;

&lt;p&gt;----------------&lt;br/&gt;
ALTER TABLE partner_channel_x_code ADD CONSTRAINT partner_channel_x_code_code_id_partner_code_id FOREIGN KEY (code_id) REFERENCES partner_code(id);&lt;br/&gt;
----------------&lt;/p&gt;

&lt;p&gt;But if I just change the schema with this changes (notice the Channel changed to Shannel):&lt;/p&gt;

&lt;p&gt;----------------&lt;br/&gt;
Partner_Channel:&lt;br/&gt;
  relations:&lt;br/&gt;
    Codes:&lt;br/&gt;
      refClass: Partner_Shannel_Code&lt;/p&gt;

&lt;p&gt;Partner_Shannel_Code:&lt;br/&gt;
  tableName: partner_channel_x_code&lt;br/&gt;
----------------&lt;/p&gt;

&lt;p&gt;Everything is created.&lt;/p&gt;

&lt;p&gt;----------------&lt;br/&gt;
CREATE TABLE partner_channel (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(64) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
CREATE TABLE partner_code (id INT UNSIGNED AUTO_INCREMENT, code VARCHAR(64) NOT NULL UNIQUE, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
CREATE TABLE partner_channel_x_code (channel_id INT UNSIGNED, code_id INT UNSIGNED, PRIMARY KEY(channel_id, code_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;&lt;br/&gt;
ALTER TABLE partner_channel_x_code ADD CONSTRAINT partner_channel_x_code_code_id_partner_code_id FOREIGN KEY (code_id) REFERENCES partner_code(id);&lt;br/&gt;
ALTER TABLE partner_channel_x_code ADD CONSTRAINT partner_channel_x_code_channel_id_partner_channel_id FOREIGN KEY (channel_id) REFERENCES partner_channel(id);&lt;br/&gt;
----------------&lt;/p&gt;

&lt;p&gt;So as I figured out is that when creating the tables alphabetic order has an influence on creating the CONSTRAINT for that Model in sql. I suppose line 715 of the Doctrine/Table.php near $key = $this-&amp;gt;_checkForeignKeyExists(...) is operating, but I am not sure (when inserting into DB some tables are not created yet?).&lt;/p&gt;

&lt;p&gt;Do not know how to markup here, it&apos;s my first issue in Jira, please press &quot;edit&quot; to see the yaml code formatted &lt;/p&gt;</description>
                <environment>FreeBSD 6.1, Apache 2.2.4, PHP 5.3.2, MySQL 5.0.41</environment>
            <key id="11289">DC-655</key>
            <summary>When Export from Models to database is made some constraints may not be created</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="c0ba">Oleg Stepura</reporter>
                        <labels>
                    </labels>
                <created>Thu, 29 Apr 2010 11:01:05 +0000</created>
                <updated>Fri, 11 Jun 2010 09:05:00 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="12778" author="c0ba" created="Thu, 29 Apr 2010 12:57:26 +0000"  >&lt;p&gt;Also what I noticed today is that this YAML schema:&lt;/p&gt;

&lt;p&gt;Partner_Channel:&lt;br/&gt;
  tableName: partner_channel&lt;br/&gt;
  comment: List of channels.&lt;/p&gt;

&lt;p&gt;Does not add comment to the MySQL table when trying to do this through the cli build-all-load command. Neither the generated Model nor the exported sql chema have this option (&apos;comment&apos;).&lt;/p&gt;

&lt;p&gt;maybe this should be a different bug report...&lt;/p&gt;</comment>
                    <comment id="13272" author="gx" created="Fri, 11 Jun 2010 08:40:46 +0000"  >&lt;p&gt;For your missing table comment, try nesting &quot;comment&quot; into &quot;options&quot;, like this:&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;YAML&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Partner_Channel:
  tableName: partner_channel
  options:
    comment: List of channels.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&amp;#8212;&lt;/p&gt;

&lt;p&gt;Now for the missing constraints issue, I confirm! See #&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-502&quot; title=&quot;sometimes not all the constraints are created for a many to many relation&quot;&gt;DC-502&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="13274" author="c0ba" created="Fri, 11 Jun 2010 09:05:00 +0000"  >&lt;p&gt;Hi! As for the comments - your decision seems like a workaround. Is it so or is it the way it should work? Do you know how this kind of stuff will work in 2.0 version?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-661] Subquery Doctrine Couldn&apos;t find class</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-661</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I&apos;m trying to create a query like this one :&lt;/p&gt;

&lt;p&gt;SELECT nombre, (select count( * ) from alojamiento a left join localidad l on a.localidad_id=l.id where p.id=l.provincia_id and a.activo=true) as total from provincia p &lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create() &lt;br/&gt;
         -&amp;gt;select(&apos;p.nombre&apos;) &lt;br/&gt;
         -&amp;gt;addSelect(&apos;(select count( * ) from alojamiento a left join                   &lt;br/&gt;
                 localidad l on a.localidad_id=l.id where p.id=l.provincia_id and         &lt;br/&gt;
                 a.activo=true)&apos;) &lt;br/&gt;
         -&amp;gt;from(&apos;provincia p&apos;); &lt;/p&gt;

&lt;p&gt;but it fails : error 500, couldn&apos;t find class a.&lt;/p&gt;


&lt;p&gt;And :&lt;br/&gt;
$q = Doctrine_Query::create() -&amp;gt;select(&apos;nombre&apos;) -&amp;gt;addSelect(&apos;(select count( * ) from alojamiento left join localidad on&lt;br/&gt;
 alojamiento.localidad_id=localidad.id where&lt;br/&gt;
 provincia.id=localidad.provincia_id and alojamiento.activo=true)&apos;) -&amp;gt;from(&apos;provincia&apos;);&lt;/p&gt;

&lt;p&gt;leads to : SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S22&amp;#93;&lt;/span&gt;: Column not found: 1054 Unknown column &apos;a.localidad_id&apos; in &apos;on clause&apos;.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11313">DC-661</key>
            <summary>Subquery Doctrine Couldn&apos;t find class</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="guinsel">Mauro E.</reporter>
                        <labels>
                    </labels>
                <created>Tue, 4 May 2010 04:28:31 +0000</created>
                <updated>Tue, 8 Jun 2010 14:09:05 +0000</updated>
                                    <version>1.2.2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13175" author="jwage" created="Tue, 8 Jun 2010 13:37:10 +0000"  >&lt;p&gt;You are using table names in your query and not model names.&lt;/p&gt;

&lt;p&gt;For future reference, the Jira is for reporting bugs/issues. You can ask user questions on the Doctrine mailing lists: &lt;a href=&quot;http://www.doctrine-project.org/community&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/community&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="13182" author="guinsel" created="Tue, 8 Jun 2010 13:53:49 +0000"  >&lt;p&gt;My model names are: alojamiento, localidad and provincia I don&apos;t use table names.&lt;/p&gt;</comment>
                    <comment id="13183" author="jwage" created="Tue, 8 Jun 2010 13:56:28 +0000"  >&lt;p&gt;Can you provide a test case because I am not able to reproduce any problems. All of our subquery tests are passing currently and I can&apos;t seem to find any problems like you describe.&lt;/p&gt;</comment>
                    <comment id="13185" author="guinsel" created="Tue, 8 Jun 2010 14:05:36 +0000"  >&lt;p&gt;Hope it is not my stupid fault, I apologize if it&apos;s my fault.&lt;/p&gt;

&lt;p&gt;My schema.yml is:&lt;/p&gt;

&lt;p&gt;Alojamiento:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Timestampable:&lt;br/&gt;
    Sluggable:&lt;br/&gt;
      unique: true&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;nombre&amp;#93;&lt;/span&gt;&lt;br/&gt;
      canUpdate: true&lt;br/&gt;
    SoftDelete:&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    localidad_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      notnull: true&lt;br/&gt;
    nombre:&lt;br/&gt;
      type: string(255)&lt;br/&gt;
      notnull: true&lt;br/&gt;
    activo:&lt;br/&gt;
      type: boolean&lt;br/&gt;
      notnull: true&lt;br/&gt;
      default: false&lt;br/&gt;
  relations:&lt;br/&gt;
    Localidad:&lt;br/&gt;
      foreignType: one&lt;/p&gt;

&lt;p&gt;Localidad:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Sluggable:&lt;br/&gt;
      unique: true&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;nombre&amp;#93;&lt;/span&gt;&lt;br/&gt;
      canUpdate: true&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    nombre:&lt;br/&gt;
      type: string(250)&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
    provincia_id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      notnull: true&lt;br/&gt;
  relations:&lt;br/&gt;
    Provincia:&lt;br/&gt;
      onDelete: CASCADE&lt;br/&gt;
      local: provincia_id&lt;br/&gt;
      foreign: id&lt;/p&gt;

&lt;p&gt;Provincia:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Sluggable:&lt;br/&gt;
      unique: true&lt;br/&gt;
      fields: &lt;span class=&quot;error&quot;&gt;&amp;#91;nombre&amp;#93;&lt;/span&gt;&lt;br/&gt;
      canUpdate: true&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer(4)&lt;br/&gt;
      primary: true&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    nombre:&lt;br/&gt;
      type: string(250)&lt;br/&gt;
      unique: true&lt;br/&gt;
      notnull: true&lt;br/&gt;
  relations:&lt;br/&gt;
    Localidades:&lt;br/&gt;
      type: many&lt;br/&gt;
      class: Localidad&lt;br/&gt;
      local: id&lt;br/&gt;
      foreign: provincia_id&lt;br/&gt;
      orderBy: nombre&lt;/p&gt;</comment>
                    <comment id="13186" author="jwage" created="Tue, 8 Jun 2010 14:09:05 +0000"  >&lt;p&gt;You can read about how to create unit tests here &lt;a href=&quot;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/unit-testing/en#unit-testing&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/unit-testing/en#unit-testing&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-666] Unable to create relations with several fields</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-666</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have 2 tables.&lt;/p&gt;

&lt;p&gt;t1 :&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;id &lt;span class=&quot;error&quot;&gt;&amp;#91;Primary Key&amp;#93;&lt;/span&gt;&lt;br/&gt;
field1&lt;br/&gt;
field2&lt;br/&gt;
...&lt;br/&gt;
fieldn&lt;br/&gt;
t2_id &lt;span class=&quot;error&quot;&gt;&amp;#91;related to t2.id&amp;#93;&lt;/span&gt;&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
primary key: id&lt;/p&gt;

&lt;p&gt;t2:&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
id &lt;span class=&quot;error&quot;&gt;&amp;#91;related to t1.t2_id&amp;#93;&lt;/span&gt;&lt;br/&gt;
fixed_set &lt;span class=&quot;error&quot;&gt;&amp;#91;predefined set of values (for example &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;)&amp;#93;&lt;/span&gt;&lt;br/&gt;
field1&lt;br/&gt;
field2&lt;br/&gt;
...&lt;br/&gt;
fieldn&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
primary key: id + fixed_set&lt;/p&gt;

&lt;p&gt;I need to use relation like follows:&lt;br/&gt;
SELECT * &lt;br/&gt;
FROM t1&lt;br/&gt;
LEFT JOIN t2 ON (t1.t2_id = t2.id AND t2.fixed_set = &quot;a&quot;)&lt;/p&gt;

&lt;p&gt;There is followed text in phpdoc from Relation.php:&lt;br/&gt;
&amp;#8212;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;local                   the local field(s)&lt;br/&gt;
     *&lt;/li&gt;
	&lt;li&gt;foreign                 the foreign reference field(s)&lt;br/&gt;
&amp;#8212;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;But it is unable to use several fields in &quot;local&quot; and &quot;foreign&quot;, only one &quot;local&quot; and &quot;foreign&quot; field.&lt;/p&gt;</description>
                <environment>Windows Server 2003 SP2&lt;br/&gt;
Apache 2.2.14&lt;br/&gt;
PHP 5.3.1&lt;br/&gt;
Doctrine 1.2.2</environment>
            <key id="11320">DC-666</key>
            <summary>Unable to create relations with several fields</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="pavel">Pavel</reporter>
                        <labels>
                    </labels>
                <created>Wed, 5 May 2010 11:03:01 +0000</created>
                <updated>Sat, 7 Aug 2010 15:38:53 +0000</updated>
                                    <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>
                <version>1.2.0-RC1</version>
                <version>1.2.0</version>
                <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                                                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-667] migration fails for long foreign key names</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-667</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When having a model with short name and i18n field which is versioned, everthing is right. There are no problems when doing diff and migration again and again. Nothing will happen because nothing changed.&lt;br/&gt;
For example: &lt;br/&gt;
mytest:&lt;br/&gt;
  actAs:&lt;br/&gt;
    I18n:&lt;br/&gt;
      fields:         [ description_front ]  &lt;br/&gt;
      actAs:  &lt;br/&gt;
        Timestampable:  &lt;br/&gt;
        Versionable:           &lt;br/&gt;
  columns:&lt;br/&gt;
    title: &lt;/p&gt;
{type: string(255)}
&lt;p&gt;    description_front: &lt;/p&gt;
{type: string(255)}

&lt;p&gt;But when using a longer model name like &apos;mytestmytestmytest&apos; then some strange errors occurred in my simple example. After creating the &apos;translation&apos; and &apos;transalation_version&apos; table in &apos;1273139712_version2.php&apos; and creating the foreign keys in &apos;1273139713_version3.php&apos; there shouldn&apos;d be a &apos;1273146011_version4.php&apos; generated by doing a diff, because everthing was already done. And of course when doing a migration with this last version, you will get errors. &lt;/p&gt;</description>
                <environment>CentOS release 5.4 (Final)&lt;br/&gt;
&lt;br/&gt;
Linux xxx 2.6.18-164.10.1.el5 #1 SMP Thu Jan 7 20:00:41 EST 2010 i686 athlon i386 GNU/Linux&lt;br/&gt;
&lt;br/&gt;
PHP 5.3.2 (cli) (built: Mar  4 2010 21:52:46)&lt;br/&gt;
Copyright (c) 1997-2010 The PHP Group&lt;br/&gt;
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies&lt;br/&gt;
&lt;br/&gt;
MySQL Server version: 5.1.42-log MySQL Community Server (GPL)&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
</environment>
            <key id="11321">DC-667</key>
            <summary>migration fails for long foreign key names</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mweber">Michael Weber</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 May 2010 09:19:20 +0000</created>
                <updated>Thu, 6 May 2010 09:19:20 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Migrations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="10593" name="doctrine_test.zip" size="760651" author="mweber" created="Thu, 6 May 2010 09:19:20 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-668] Call to undefined method Doctrine_Adapter_Mysqli::setAttribute() </title>
                <link>http://www.doctrine-project.org/jira/browse/DC-668</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;i&apos;m trying to switch to php5.3.1.&lt;br/&gt;
using the same connection as before, mysql://, i get &lt;/p&gt;

&lt;p&gt;Warning: PDO::__construct() &lt;span class=&quot;error&quot;&gt;&amp;#91;pdo.--construct&amp;#93;&lt;/span&gt;: OK packet 6 bytes shorter than expected in C:\wamp\bin\php\php5.2.9-2\PEAR\Doctrine\lib\Doctrine\Connection.php  on line 470&lt;/p&gt;

&lt;p&gt;after researching this error, i found out that it is related to the new password in mysql5.&lt;br/&gt;
i tried changing the password for the connection, and made sure there is no old_password set in my.ini, without any success.&lt;/p&gt;

&lt;p&gt;so i&apos;m trying to connect using mysqli adapter, and now i get this error:&lt;br/&gt;
PHP Fatal error:  Call to undefined method Doctrine_Adapter_Mysqli::setAttribute() in C:\wamp\bin\php\php5.2.9-2\PEAR\Doctrine\lib\Doctrine\Connection.php on line 496&lt;/p&gt;

&lt;p&gt;how can i connect to mysql5.1 with php5.3, and what is the best connection to pick. mysql or mysqli.&lt;/p&gt;</description>
                <environment>windows xp, apache2.2 web server, php5.3.1, doctrine1.2.2, zend framework 1.10.3, mysql 5.1</environment>
            <key id="11323">DC-668</key>
            <summary>Call to undefined method Doctrine_Adapter_Mysqli::setAttribute() </summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="nadim">nadim</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 May 2010 09:31:36 +0000</created>
                <updated>Tue, 8 Jun 2010 11:57:44 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13170" author="jwage" created="Tue, 8 Jun 2010 11:57:44 +0000"  >&lt;p&gt;What is Doctrine_Adapter_Mysqli? Is this your own class?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-676] Validation exception thrown only if internal nesting level == 1</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-676</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I wonder why Validation exception is thrown only if internal nesting level of transaction is 1 and the manual nesting level is not considered. &lt;/p&gt;

&lt;p&gt;Line 262 - lib/Doctrine/Transaction.php: &lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;if ($this-&amp;gt;_internalNestingLevel == 1) {
    $tmp = $this-&amp;gt;invalid;
    $this-&amp;gt;invalid = array();
    throw new Doctrine_Validator_Exception($tmp);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I have a large database with a lot of tables and relationships. At some case the validation exception is not thrown if the validation fails. &lt;/p&gt;

&lt;p&gt;If I add $this-&amp;gt;_nestingLevel into this condition: &lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;if ($this-&amp;gt;_internalNestingLevel == 1 || $this-&amp;gt;_nestingLevel == 1) {
    $tmp = $this-&amp;gt;invalid;
    $this-&amp;gt;invalid = array();
    throw new Doctrine_Validator_Exception($tmp);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then the validation exception is thrown as excepted. &lt;/p&gt;

&lt;p&gt;I don&apos;t know why you ignore here the nesting level. &lt;/p&gt;

&lt;p&gt;It would be great if you could explain me more about these lines. &lt;/p&gt;

&lt;p&gt;I ran the unit test with this modification and got the same result. &lt;/p&gt;</description>
                <environment>PHP 5.3.1, Mac OS X 10.6</environment>
            <key id="11344">DC-676</key>
            <summary>Validation exception thrown only if internal nesting level == 1</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="dreamcocoa">Fabian Spillner</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 May 2010 17:27:22 +0000</created>
                <updated>Tue, 8 Jun 2010 16:20:02 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Validators</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12907" author="dreamcocoa" created="Mon, 10 May 2010 18:24:17 +0000"  >&lt;p&gt;Additional information: On doctrine 1.1.x the exception is thrown without this modification. &lt;/p&gt;</comment>
                    <comment id="12908" author="dreamcocoa" created="Tue, 11 May 2010 02:50:16 +0000"  >&lt;p&gt;It seems, the problem is the counter of internal nesting level. I output these member variables: &lt;/p&gt;

&lt;p&gt;Doctrine 1.1.2&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;Doctrine_Transaction::commit invalid is not empty - internal nesting level: 1 nesting level: 2

ok 1 - Article cannot be created if empty: Doctrine_Validator_Exception: Validation failed in class Article

  1 field had validation error:

    * 1 validator failed on slug_title (notnull)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Doctrine 1.2.2&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;Doctrine_Transaction::commit invalid is not empty - internal nesting level: 0 nesting level: 1

not ok 1 - Empty Artcile could be created!
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12913" author="dreamcocoa" created="Tue, 11 May 2010 08:30:25 +0000"  >&lt;p&gt;Yeah! I found the reason: &lt;/p&gt;

&lt;p&gt;I attached a template (listener) into my model which validates the body and this 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-none&quot;&gt;// ...
if ($obj-&amp;gt;getAuthor()-&amp;gt;getAge())  # this creates new empty Author object
{
  // ...
}
// ...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On Doctrine 1.1, the method saveGraph() of class UnitOfWork executes first saveRelatedLocalKeys and then the hooks methods (preSave, etc.) and my code works!&lt;/p&gt;

&lt;p&gt;On Doctrine 1.2, the method saveGraph() call *&lt;b&gt;first&lt;/b&gt;* the hooks method and then the saveRelatedLocalKeys which save the empty author object and then destroy the internal nesting level &lt;br/&gt;
and the validation exception is not thrown. &lt;/p&gt;

&lt;p&gt;Workaround for my listener: &lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;// ...
if ($obj-&amp;gt;relatedExists(&quot;Author&quot;) &amp;amp;&amp;amp; $obj-&amp;gt;getAuthor()-&amp;gt;getAge())  # relatedExists() needed to avoid create empty Author object
{
  // ...
}
// ...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What do you think: It&apos;s a bug or a feature?&lt;/p&gt;</comment>
                    <comment id="12914" author="dreamcocoa" created="Tue, 11 May 2010 09:16:25 +0000"  >&lt;p&gt;A test case attached to reproduce the bug. &lt;/p&gt;

&lt;p&gt;The test passes if you remove the custom save() method of Ticket_DC676_Author class.&lt;/p&gt;

&lt;p&gt;The problem: default &quot;foobar&quot; modifies the Author and is modified. Doctrine tries to save it, &lt;br/&gt;
but because there is more than two transactions, the validation exception is not thrown for Article object. &lt;/p&gt;</comment>
                    <comment id="12915" author="jwage" created="Tue, 11 May 2010 11:42:43 +0000"  >&lt;p&gt;Something that really helps with determining what we should do is to find the exact changeset that causes the behavior. If we can look at what code was changed, we can then understand better what to do.&lt;/p&gt;</comment>
                    <comment id="13024" author="dreamcocoa" created="Thu, 20 May 2010 10:10:24 +0000"  >&lt;p&gt;This changeset affects the problem: &lt;br/&gt;
&lt;a href=&quot;http://trac.doctrine-project.org/changeset/6126/branches/1.2/lib/Doctrine/Connection/UnitOfWork.php&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/changeset/6126/branches/1.2/lib/Doctrine/Connection/UnitOfWork.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But I really don&apos;t like this logic how the validation exception is handled. I would seperate these things: &lt;/p&gt;

&lt;p&gt;The method validate() should throw exception, and the method commit() should commit only if model is valid and nothing more. &lt;/p&gt;

&lt;p&gt;1. go recursive into the model and call the validate() method&lt;/p&gt;

&lt;p&gt;2. if not valid, exception is thrown&lt;/p&gt;

&lt;p&gt;3. elseif ok, commit is called&lt;/p&gt;

&lt;p&gt;PS. Sorry for late answer: I had a lot of work ... &lt;/p&gt;</comment>
                    <comment id="13026" author="jwage" created="Thu, 20 May 2010 10:28:56 +0000"  >&lt;p&gt;Do you see something with that commit that could be changed that fixes your issue?&lt;/p&gt;</comment>
                    <comment id="13167" author="jwage" created="Tue, 8 Jun 2010 11:45:59 +0000"  >&lt;p&gt;Whoops. This change is causing some problems. It causes lots of tests to fail in our test suite. Reverting for now. Can you try your change against our test suite and see if you can determine anything? Thanks, Jon&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10600" name="DC676TestCase.php" size="3698" author="dreamcocoa" created="Tue, 11 May 2010 09:16:25 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-680] HYDRATE_ARRAY causes timeout with no fields selected</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-680</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Calling HYDRATE_ARRAY on a query with&lt;/p&gt;

&lt;p&gt;a) No values selected&lt;br/&gt;
b) select(&apos;*&apos;)&lt;br/&gt;
c) select(&apos;Table.*&apos;)&lt;/p&gt;

&lt;p&gt;causes the entire query object to be loaded, rather than just returning an array of all values. If a limit(1) is used, the correct result is returned. But as soon as it becomes a collection, the entire query object is returned.&lt;/p&gt;

&lt;p&gt;Code to produce problem..&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;Order ord&apos;)
        -&amp;gt;limit(2)
        -&amp;gt;execute(array(), Doctrine_Core::HYDRATE_ARRAY);
        
        print_r($query);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Windows 7, Ubuntu 9.10 (Linux), PHP 5.2.10, Zend Framework 1.10</environment>
            <key id="11355">DC-680</key>
            <summary>HYDRATE_ARRAY causes timeout with no fields selected</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="davidma7685">David Ash</reporter>
                        <labels>
                    </labels>
                <created>Thu, 13 May 2010 14:42:20 +0000</created>
                <updated>Thu, 13 May 2010 14:42:20 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-684] After adding a Reference, the ForeignKeys in the DB are not updatet</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-684</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;After query a record from the DB, where a foreign key is null, and changing only the reference belonging to this foreign key, and only these reference no other value of the record, a save of the record doesn&apos;t lead to a change in the foreign key field.&lt;/p&gt;

&lt;p&gt;For example: I&apos;ll save a user record with some data of a regestration and give him the possibillity to add a city where he cames from later in his account settings, if no other user attribute is changed, the state of the user record is still CLEAN. The result is that I can access the user-&amp;gt;City property correctly only as long as no refresh from the db is done. So the changing of the foreign key belonging to the city isn&apos;t persistent in the DB.&lt;/p&gt;

&lt;p&gt;Example Code:&lt;br/&gt;
		$user = new Model_User();&lt;br/&gt;
		$user-&amp;gt;firstName = md5(rand());&lt;br/&gt;
		$user-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;		$id = $user-&amp;gt;id;&lt;br/&gt;
		unset($user);&lt;br/&gt;
		assert(! $user);&lt;/p&gt;

&lt;p&gt;		$user = Model_UserTable::getInstance()-&amp;gt;find($id);&lt;br/&gt;
		assert(!$user-&amp;gt;relatedExists(&apos;City&apos;));		&lt;/p&gt;

&lt;p&gt;		$user-&amp;gt;City-&amp;gt;name = &apos;Mainz&apos;;&lt;br/&gt;
		$user-&amp;gt;save();&lt;br/&gt;
		unset($user);&lt;/p&gt;

&lt;p&gt;		$user = Model_UserTable::getInstance()-&amp;gt;find($id);&lt;br/&gt;
		$user-&amp;gt;refresh(true);&lt;br/&gt;
		assert($user-&amp;gt;City-&amp;gt;name == &apos;Mainz&apos;);	&lt;/p&gt;

&lt;p&gt;The last assert failse. I realized the problem while updating just a referenz using the fromArray() method like $user-&amp;gt;City-&amp;gt;fromArray(). The city would be saved correctly in DB but the foreign key in the user table would not be updated. After debugging I recognized that the $user is not replaced in UnitOfWork::saveGraph() because the $user is still in CLEAN state.&lt;/p&gt;

&lt;p&gt;Using &quot; $user-&amp;gt;coreSetRelated(&apos;Country&apos;, $user-&amp;gt;Country);&quot; or &quot;$user-&amp;gt;state(Doctrine_Record::STATE_DIRTY);&quot; after &quot;$user-&amp;gt;City-&amp;gt;name = &apos;Mainz&apos;&quot; would fix the prob in this case. As well as creating a new City instance an set $user-&amp;gt;City with this instance like:&lt;/p&gt;

&lt;p&gt;                $city = new Model_City();&lt;br/&gt;
                $city-&amp;gt;name = &apos;Mainz&apos;;&lt;br/&gt;
                $user-&amp;gt;City = $city;&lt;/p&gt;

&lt;p&gt;Also $user-&amp;gt;isModified(true) is true. So I fixed the issues in my case by changing the state of my records to DIRTY if the &quot;$this-&amp;gt;state() == CLEAN &amp;amp;&amp;amp; $user-&amp;gt;isModified(true) == true&quot; in the preSave() method of an abstract class that my Base classes are extending....&lt;/p&gt;</description>
                <environment>Ubuntu 9.04, PHP 5.2.6, MySQL 5.1, Zend Framework</environment>
            <key id="11363">DC-684</key>
            <summary>After adding a Reference, the ForeignKeys in the DB are not updatet</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="lk2.0">Lars Kosubek</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 May 2010 15:02:09 +0000</created>
                <updated>Tue, 26 Oct 2010 08:13:33 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Record</component>
                <component>Relations</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14380" author="mars105" created="Wed, 15 Sep 2010 09:12:04 +0000"  >&lt;p&gt;Spend the last hour trying to get a workaround on this one.&lt;/p&gt;

&lt;p&gt;It apear to me that the solution is not easy. The object is modified while in STATE_LOCKED state, meaning that any state change in Record::_set() is not passed back to UnitOfWork::saveGraph() and therfor not saved in the database.&lt;/p&gt;

&lt;p&gt;Finaly I&apos;ve managed to make a realy dirty fix, I&apos;ll attach it if it come handy to somebody.&lt;br/&gt;
Keep in mind this is only a workaround and has NOT been tested. Use at your own risk...&lt;/p&gt;</comment>
                    <comment id="14381" author="mars105" created="Wed, 15 Sep 2010 09:13:00 +0000"  >&lt;p&gt;Dirty fix, see comments.&lt;br/&gt;
! NOT tested thoroughly !&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10797" name="DC_684_dirty_fix.patch" size="1490" author="mars105" created="Wed, 15 Sep 2010 09:13:00 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-689] Columns of type &apos;array&apos; adds default clause to the create table statement which isn&apos;t supported by MySQL.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-689</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The column type &apos;array&apos; creates a column of the type &apos;LONGTEXT&apos; but also adds the default value to the column declaration which makes the creation of the table fail.&lt;/p&gt;

&lt;p&gt;MySQL does not support default values for TEXT, BLOB or LONGTEXT. I don&apos;t know when this behavior was added to MySQL or if it always has been like that. MySQL 5.0.51 will accept it without any SQL mode set, 5.0.83 won&apos;t.&lt;/p&gt;</description>
                <environment>MySQL version 5.0.83, Doctrine 1.2.2, Revision: 7490</environment>
            <key id="11383">DC-689</key>
            <summary>Columns of type &apos;array&apos; adds default clause to the create table statement which isn&apos;t supported by MySQL.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="daniel">Daniel Holmstrom</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 May 2010 09:31:17 +0000</created>
                <updated>Fri, 11 Jun 2010 08:31:26 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13163" author="jwage" created="Tue, 8 Jun 2010 11:06:26 +0000"  >&lt;p&gt;Could you provide a test and patch?&lt;/p&gt;</comment>
                    <comment id="13270" author="daniel" created="Fri, 11 Jun 2010 08:29:41 +0000"  >&lt;p&gt;(Un)fortunately I&apos;ll be computer-free for a month now, so I have no time to write test or do a proper patch. I&apos;ll attach the patch I use for reference.&lt;/p&gt;

&lt;p&gt;Since the default clause depends on the native type which isn&apos;t known when the default clause is constructed (in getDefaultFieldDeclaration) I&apos;ve simply added a check that sets the default clause to an empty string if the native type is one of those which isn&apos;t allowed to have a default value. I&apos;m not sure, however, what the line in Doctrine/Export/Mysql.php::276:&lt;/p&gt;

{return $this-&amp;gt;conn-&amp;gt;dataDict-&amp;gt;$method($name, $field);}

&lt;p&gt; does and if that is affected by this also.&lt;/p&gt;

&lt;p&gt;I guess you want the list of native types not allowed to have default values somewhere else, but I don&apos;t have the required knowledge about the internals of Doctrine to do this.&lt;/p&gt;</comment>
                    <comment id="13271" author="daniel" created="Fri, 11 Jun 2010 08:31:26 +0000"  >&lt;p&gt;Attached patch giving example of how to fix &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-689&quot; title=&quot;Columns of type &amp;#39;array&amp;#39; adds default clause to the create table statement which isn&amp;#39;t supported by MySQL.&quot;&gt;DC-689&lt;/a&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10639" name="DC-689_example_patch.patch.gz" size="477" author="daniel" created="Fri, 11 Jun 2010 08:31:26 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-692] Can not create a subquery in where</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-692</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi All&lt;/p&gt;

&lt;p&gt;I can not figure out how to make a subquery work in doctrine. I get the subquery to look fine in DQL but when doctrine converts the DQL to SQL the subquery is automatically removed.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br/&gt;
This PHP:&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;$q = Doctrine_Query::create(); 
$q-&amp;gt;from(&apos;Customer Customer&apos;); 
$q-&amp;gt;addWhere(&apos; Customer.id in (SELECT Customer.id as customer_id FROM Customer Customer)&apos;); 
$q-&amp;gt;addSelect(&apos;Customer.id&apos;); 
$q-&amp;gt;addSelect(&apos;Customer.id as customer_id&apos;);
$q-&amp;gt;limit(20); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Creates this DQL:&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 Customer.id, Customer.id as customer_id FROM Customer Customer WHERE Customer.id in (SELECT Customer.id as customer_id FROM Customer Customer) LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which creates this broken 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;SELECT p.id AS p__id, p.id AS p__0 FROM product_customers p WHERE (p.id in ()) LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Notice that the subquery has been replaced with just &quot;()&quot;.&lt;/p&gt;

&lt;p&gt;Is there something wrong with my execution, does doctrine just not support subqueries, or is there a bug here?&lt;/p&gt;

&lt;p&gt;Thanks much in advance.&lt;/p&gt;

&lt;p&gt;Sincerely&lt;/p&gt;

&lt;p&gt;Will Ferrer&lt;/p&gt;</description>
                <environment>XP Xamp</environment>
            <key id="11387">DC-692</key>
            <summary>Can not create a subquery in where</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="willf1976">will ferrer</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 May 2010 21:42:53 +0000</created>
                <updated>Wed, 19 May 2010 00:18:41 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12993" author="willf1976" created="Wed, 19 May 2010 00:18:41 +0000"  >&lt;p&gt;I have found a way around my problem (looked through the code to figure out how it worked) &amp;#8211; seems that if I put &apos;SQL:&apos; in front of my sub query, and use SQL instead of DQL in the sub query like so:&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;$q = Doctrine_Query::create(); 
$q-&amp;gt;from(&apos;Customer Customer&apos;); 
$q-&amp;gt;addWhere(&apos; Customer.id in (SQL:SELECT p.id AS p__0 FROM product_customers p)&apos;); 
$q-&amp;gt;addSelect(&apos;Customer.id&apos;); 
$q-&amp;gt;addSelect(&apos;Customer.id as customer_id&apos;); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The correct sql is made:&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 p.id AS p__id, p.id AS p__0 FROM product_customers p WHERE (p.id in (SELECT p.id AS p__0 FROM product_customers p)) LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I am not still not sure what is up with trying to use the DQL instead. Looking through the code I see that on line 842 of Doctrine_Query my DQL subquery was being passed to the function $this-&amp;gt;createSubquery()-&amp;gt;parseDqlQuery($trimmed) like so:&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; $q = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;createSubquery()-&amp;gt;parseDqlQuery($trimmed);
$trimmed = $q-&amp;gt;getSqlQuery();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;$trimmed was coming back as false here which is why my subquery wasn&apos;t working.&lt;/p&gt;

&lt;p&gt;Hope that is helpful.&lt;/p&gt;

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

&lt;p&gt;Will Ferrer&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-704] Where fields not escaped properly when deleting associations.</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-704</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;We noticed that in both Doctrine/Record.php and Doctrine/Connection/UnitOfWork.php the fields in the where clause arent being escaped properly. A few of our fields happen to be keywords, but it seems that these queries arent escaping the names of fields that happen to be keywords.&lt;/p&gt;

&lt;p&gt;I have verified the field name is in the keywords list for my driver.&lt;/p&gt;

&lt;p&gt;This happens near the following code:&lt;br/&gt;
Doctrine/Record.php:2465&lt;br/&gt;
Doctrine/Record.php:2476&lt;br/&gt;
Doctrine/Connection/UnitOfWork.php: 443&lt;/p&gt;</description>
                <environment>Debian 5, PHP 5.3, Symfony 1.4.4, sfDoctrinePlugin, Pgsql driver</environment>
            <key id="11414">DC-704</key>
            <summary>Where fields not escaped properly when deleting associations.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="grmartin">Glenn R. Martin</reporter>
                        <labels>
                    </labels>
                <created>Tue, 25 May 2010 12:33:50 +0000</created>
                <updated>Mon, 14 Jun 2010 08:26:40 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Record</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13149" author="jwage" created="Tue, 8 Jun 2010 10:19:55 +0000"  >&lt;p&gt;Can you provide a patch with the changes?&lt;/p&gt;</comment>
                    <comment id="13306" author="grmartin" created="Mon, 14 Jun 2010 08:26:40 +0000"  >&lt;p&gt;The following is the patch you requested. This is what &lt;b&gt;WE&lt;/b&gt; did for our specific case to fix this... though it wont work with any other driver... What we really should have done (if I had been given time) was to pull the escape characters from the database driver so this would work on every database, not just Postgres.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10645" name="diff.patch" size="3009" author="grmartin" created="Mon, 14 Jun 2010 08:26:40 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-707] When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-707</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi,&lt;/p&gt;


&lt;p&gt;When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...&lt;/p&gt;



&lt;p&gt;Here is a test case, simply made of the code samples given in documentation : &lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/hierarchical-data/en#nested-set:working-with-trees:creating-a-root-node&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/hierarchical-data/en#nested-set:working-with-trees:creating-a-root-node&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;/*
 * Creating a Root Node
 */
$category = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$category-&amp;gt;name = &apos;Root Category 1&apos;;
$category-&amp;gt;save();

$treeObject = Doctrine_Core::getTable(&apos;Category&apos;)-&amp;gt;getTree();
$treeObject-&amp;gt;createRoot($category);


/*
 * Inserting a Node
 */
$child1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$child1-&amp;gt;name = &apos;Child Category 1&apos;;

$child2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$child2-&amp;gt;name = &apos;Child Category 1&apos;;

$child1-&amp;gt;getNode()-&amp;gt;insertAsLastChildOf($category);
$child2-&amp;gt;getNode()-&amp;gt;insertAsLastChildOf($category);




/*
 * BUGGY !
 */
$category-&amp;gt;getNode()-&amp;gt;hasChildren();   &lt;span class=&quot;code-comment&quot;&gt;// will &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, we except &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; as we just instert 2 children to &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; root node...
&lt;/span&gt;

$category-&amp;gt;refresh();
$category-&amp;gt;getNode()-&amp;gt;hasChildren(); &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;... that&apos;s now ok !&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.2 (cli) (built: Apr 12 2010 15:44:21) &lt;br/&gt;
Copyright (c) 1997-2010 The PHP Group&lt;br/&gt;
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [enabled]&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
MySQL&lt;br/&gt;
&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Server: Localhost via UNIX socket&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Server version: 5.1.41-3ubuntu12.1&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Protocol version: 10</environment>
            <key id="11420">DC-707</key>
            <summary>When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="julien">Julien G</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 May 2010 05:03:06 +0000</created>
                <updated>Sat, 7 Aug 2010 15:39:17 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-708] Wrong definition for MySQL string primary column</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-708</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If you define a primary column, the attribute &lt;b&gt;notnull&lt;/b&gt; is removed from the column definition because Doctrine assumes that primary columns are always not null.&lt;/p&gt;

&lt;p&gt;Now suppose you have a schema like this, with a &lt;b&gt;string&lt;/b&gt; primary column.&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;Client:
  columns:
    serial:    { type: string(50), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    name:      { type: string(36), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That&apos;s fine, but causes problems with MySQL where the column is created with a default value of &quot;&quot; (empty string) and not &amp;lt;none&amp;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;CREATE TABLE client (serial VARCHAR(50), name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note that the 2nd column is well defined and has &amp;lt;none&amp;gt; as default value (as seen from phpMyAdmin).&lt;/p&gt;

&lt;p&gt;I attached a quick-workaround to disable the code which removes the &lt;b&gt;notnull&lt;/b&gt; attribute from column definition.&lt;/p&gt;

&lt;p&gt;After that the SQL code is 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;CREATE TABLE client (serial VARCHAR(50) NOT NULL, name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.1, WinXP-SP3, Doctrine 1.2.2, MySQL 5.1.41</environment>
            <key id="11422">DC-708</key>
            <summary>Wrong definition for MySQL string primary column</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="nicorac">Claudio Nicora</reporter>
                        <labels>
                    </labels>
                <created>Fri, 28 May 2010 08:41:16 +0000</created>
                <updated>Mon, 12 Jul 2010 16:32:44 +0000</updated>
                                    <version>1.2.2</version>
                                <fixVersion>1.2.2</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13078" author="nicorac" created="Fri, 28 May 2010 09:08:46 +0000"  >&lt;p&gt;Attached a better patch where the &lt;b&gt;notnull&lt;/b&gt; attribute is removed only if the primary column type is &lt;b&gt;string&lt;/b&gt;&lt;/p&gt;</comment>
                    <comment id="13079" author="nicorac" created="Fri, 28 May 2010 09:25:01 +0000"  >&lt;p&gt;The same behaviour happens even for integer columns, so the &lt;b&gt;notnull&lt;/b&gt; attribute should never be removed, not only for string columns. New patch attached, old one removed.&lt;/p&gt;</comment>
                    <comment id="13145" author="jwage" created="Tue, 8 Jun 2010 09:58:05 +0000"  >&lt;p&gt;The patch I see currently just comments out the offending code. Is that intended? It cannot be committed if so &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>
                    <comment id="13155" author="nicorac" created="Tue, 8 Jun 2010 10:33:26 +0000"  >&lt;p&gt;My patch only removed the effect, but it&apos;s not surely the best solution.&lt;/p&gt;

&lt;p&gt;I&apos;ve no sufficient knowledge on Doctrine to say that commenting out (or removing) that line will not affect other parts; that&apos;s why I only commented out the code instead of removing it (both on my side and on the attached patch).&lt;/p&gt;

&lt;p&gt;If you think I&apos;m not adding new bugs, I agree that removing the offending code is the cleanest way.&lt;/p&gt;</comment>
                    <comment id="13156" author="jwage" created="Tue, 8 Jun 2010 10:36:00 +0000"  >&lt;p&gt;We can&apos;t just remove the code. It will change the behavior of the builder drastically which breaks backwards compatibility.&lt;/p&gt;</comment>
                    <comment id="13168" author="nicorac" created="Tue, 8 Jun 2010 11:46:12 +0000"  >&lt;p&gt;That&apos;s what I was afraid of.&lt;br/&gt;
Maybe you should change the code that generates the SQL for MySQL to make it include the &quot;NOT NULL&quot; clause to primary keys.&lt;/p&gt;</comment>
                    <comment id="13169" author="jwage" created="Tue, 8 Jun 2010 11:48:02 +0000"  >&lt;p&gt;Hi, if you want to provide a patch that fixes your situation I can test it against our test suite and see if we can include it. You can also run your changes against the test suite to see if it causes any problems.&lt;/p&gt;</comment>
                    <comment id="13285" author="nicorac" created="Sun, 13 Jun 2010 05:39:19 +0000"  >&lt;p&gt;Hi, I attached a patch against Export/Mysql.php instead of the previous against Import/Builder.php.&lt;br/&gt;
It works on my side; can you please test it with your test suite?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10642" name="export_mysql_patch.diff" size="765" author="nicorac" created="Sun, 13 Jun 2010 05:39:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-722] String(512) is being implemented as TEXT instead varchar(512) on MySQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-722</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Well&lt;br/&gt;
the titles says it all.&lt;/p&gt;

&lt;p&gt;Just now I realized the TEXT type for fields that I&apos;ve defined in the code as String(512).&lt;br/&gt;
What I understand is that TEXT has performance disvantages. Why not use varchar when there are little needs instead TEXT?&lt;/p&gt;

&lt;p&gt;Thanks in advice.&lt;br/&gt;
Greetings!&lt;/p&gt;</description>
                <environment>LAMP over Ubuntu 10.04</environment>
            <key id="11462">DC-722</key>
            <summary>String(512) is being implemented as TEXT instead varchar(512) on MySQL</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="mateo">Mateo Tibaquir&#225;</reporter>
                        <labels>
                    </labels>
                <created>Tue, 8 Jun 2010 23:49:39 +0000</created>
                <updated>Tue, 8 Jun 2010 23:49:39 +0000</updated>
                                    <version>1.2.2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-723] String = 512 becomes TEXT</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-723</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I don&apos;t know if this is a feature or a bug, but if I define a field type = string, length = 512, Doctrine creates this as a TEXT field in MySQL.  Seems to do this for a length over 255 characters, e.g. 256.  This seems like overkill possibly.  Feels like the field should be defined either as TINYTEXT or VARCHAR (which can go up to 63335 characters in length).&lt;/p&gt;

&lt;p&gt;Is there any way to control this behavior?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11463">DC-723</key>
            <summary>String = 512 becomes TEXT</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="drak">Karma Dordrak (Drak)</reporter>
                        <labels>
                    </labels>
                <created>Tue, 8 Jun 2010 23:50:18 +0000</created>
                <updated>Wed, 9 Jun 2010 13:04:27 +0000</updated>
                                    <version>1.2.2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13255" author="jwage" created="Wed, 9 Jun 2010 13:04:27 +0000"  >&lt;p&gt;No, it is not possible right now. The portable Doctrine types and lengths are converted to certain types for the different databases. In Doctrine2 you can specify the SQL that will create your column in the mapping if you desire something more customize or database specific&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-724] Blameable relations import problem</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-724</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The import works only when i DISABLE the update relation. When i activate the update relation i get an sql error&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: 1452 Cannot add or update a child row: a foreign key constraint fails (`clubicious`.`location`, CONSTRAINT `location_updated_by_sf_guard_user_id` FOREIGN KEY (`updated_by`) REFERENCES `sf_guard_user` (`id`))&lt;/p&gt;

&lt;p&gt;The relation is created correct i think the problem is in the importer???&lt;/p&gt;

&lt;p&gt;Location:&lt;br/&gt;
  actAs:&lt;br/&gt;
    Timestampable: ~&lt;br/&gt;
    Sortable: ~&lt;br/&gt;
    Blameable:&lt;br/&gt;
      columns:&lt;br/&gt;
        created:&lt;br/&gt;
          length: null&lt;br/&gt;
        updated:&lt;br/&gt;
          length: null&lt;br/&gt;
      relations:&lt;br/&gt;
        created:&lt;br/&gt;
          disabled: false&lt;br/&gt;
          class:    sfGuardUser&lt;br/&gt;
        updated:&lt;br/&gt;
          disabled: false&lt;br/&gt;
          class:    sfGuardUser&lt;br/&gt;
  columns:&lt;br/&gt;
    name:         &lt;/p&gt;
{ type: string(255), notnull: true }

&lt;p&gt;My fixtures:&lt;br/&gt;
sfGuardUser:&lt;br/&gt;
  gfranke:&lt;br/&gt;
    id: 1&lt;br/&gt;
    first_name: Gordon&lt;br/&gt;
    last_name: Franke&lt;br/&gt;
    email_address: franke@clubicious.com&lt;br/&gt;
    username: gfranke&lt;br/&gt;
    password: startgf&lt;br/&gt;
Location:&lt;br/&gt;
  location_atomic:&lt;br/&gt;
    name:         Atomic Cafe&lt;br/&gt;
    CreatedBy:    gfranke&lt;br/&gt;
    UpdatedBy:    gfranke&lt;/p&gt;

&lt;p&gt;  location_max:&lt;br/&gt;
    name:         Max &amp;amp; Moritz&lt;br/&gt;
    CreatedBy:    gfranke&lt;br/&gt;
    UpdatedBy:    gfranke&lt;/p&gt;</description>
                <environment>symfony 1.4.5 with latest doctrine 1.2 branch with sfDoctrineGuardPlugin</environment>
            <key id="11464">DC-724</key>
            <summary>Blameable relations import problem</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="gimler">Gordon Franke</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Jun 2010 06:06:06 +0000</created>
                <updated>Tue, 13 Jul 2010 07:00:31 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Extensions</component>
                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13573" author="timschofield" created="Tue, 13 Jul 2010 07:00:31 +0000"  >&lt;p&gt;Same Problem with Doctrine 1.2.2 and  Zend Framework 1.10&lt;/p&gt;

&lt;p&gt;Work around for me was to disable all Blameable relations in my schema.yml&lt;/p&gt;

&lt;p&gt;Then run &lt;/p&gt;

&lt;p&gt;./doctrine build-all-reload&lt;/p&gt;

&lt;p&gt;So that fixtures can load&lt;/p&gt;


&lt;p&gt;Then enable all Blameable relations in the schema.yml&lt;/p&gt;

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

&lt;p&gt;./doctrine generate-models-yaml&lt;/p&gt;

&lt;p&gt;So models are generated with the correct relations&lt;/p&gt;

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

&lt;p&gt;Tim&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-727] ReOpen DC-46 - Unexpected behavior with whereIn() and empty array</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-727</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I reopen the &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-46&quot; title=&quot;Unexpected behavior with whereIn() and empty array&quot;&gt;&lt;del&gt;DC-46&lt;/del&gt;&lt;/a&gt; as it&apos;seems not fix at all. &lt;br/&gt;
When I do a whereIn with empty array, the condition is just drop and I get no Exception.&lt;/p&gt;

&lt;p&gt;Here is a simple test case:&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;require_once(&apos;doctrine/lib/Doctrine.php&apos;);
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));
$manager = Doctrine_Manager::getInstance();
$manager-&amp;gt;setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
$conn = Doctrine_Manager::connection(&apos;mysql:&lt;span class=&quot;code-comment&quot;&gt;//root:root@localhost/test_doctrine&apos;);
&lt;/span&gt;echo &lt;span class=&quot;code-quote&quot;&gt;&quot;Connection is set up\n&quot;&lt;/span&gt;;

class Record &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;record&apos;);
    }
}

&lt;span class=&quot;code-comment&quot;&gt;// Create the db
&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt; {Doctrine::dropDatabases();}&lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt;(Exception $e){} &lt;span class=&quot;code-comment&quot;&gt;// Drop &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; exist :-)
&lt;/span&gt;Doctrine::createDatabases();Doctrine::createTablesFromArray(array(&apos;Record&apos;));

&lt;span class=&quot;code-comment&quot;&gt;// Test
&lt;/span&gt;echo Doctrine::getTable(&apos;Record&apos;)-&amp;gt;createQuery()-&amp;gt;select(&apos;id&apos;)-&amp;gt;whereIn(&apos;id&apos;, array())-&amp;gt;getSqlQuery() , &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
echo Doctrine::getTable(&apos;Record&apos;)-&amp;gt;createQuery()-&amp;gt;select(&apos;id&apos;)-&amp;gt;whereIn(&apos;id&apos;, array())-&amp;gt;fetchArray() , &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;

&lt;span class=&quot;code-comment&quot;&gt;// Result is:
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// SELECT r.id AS r__id FROM record r
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// Array&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22) &lt;br/&gt;
mysql Ver 14.14 Distrib 5.1.41, for apple-darwin9.5.0 (i386) using readline 5.1 &lt;br/&gt;
Doctrine version 1.2.2 from SVN: &lt;a href=&quot;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&quot;&gt;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&lt;/a&gt;</environment>
            <key id="11473">DC-727</key>
            <summary>ReOpen DC-46 - Unexpected behavior with whereIn() and empty 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="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jeanmonod">David Jeanmonod</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Jun 2010 02:45:58 +0000</created>
                <updated>Wed, 12 Oct 2011 10:45:42 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="13334" author="gx" created="Wed, 16 Jun 2010 07:41:36 +0000"  >&lt;p&gt;The problem is that the change for &quot;new&quot; behavior (throw exception instead of return unchanged query) was only done in _&lt;em&gt;processWhereIn()&lt;/em&gt; but not cascaded to &lt;em&gt;andWhereIn()&lt;/em&gt; and &lt;em&gt;orWhereIn()&lt;/em&gt; (another example we should avoid code duplication).&lt;br/&gt;
The patch is simple, &lt;b&gt;but&lt;/b&gt; it causes &lt;em&gt;Doctrine_Ticket_1558_TestCase&lt;/em&gt; to fail. Indeed that (old) test expects the &quot;old&quot; behavior (return unchanged query, don&apos;t throw exception)... So the 2 fixes are incompatible, you&apos;ll have to choose :/&lt;/p&gt;

&lt;p&gt;I still attach a new test case and 2 versions of a patch (the first one just applies changes of _processWhereIn also to the 2 other functions but adds more duplicate code, the second is a little refactored and seems better to me).&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;</comment>
                    <comment id="13335" author="gx" created="Wed, 16 Jun 2010 07:51:37 +0000"  >&lt;p&gt;added a more specific test case (expects Doctrine_Query_Exception instead of simple Exception)&lt;/p&gt;</comment>
                    <comment id="14799" author="dracoblue" created="Mon, 22 Nov 2010 05:36:33 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;the issue is still present in 1.2.3. Are there any plans to apply it?&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;/p&gt;</comment>
                    <comment id="16575" author="jimpersson" created="Wed, 12 Oct 2011 10:45:42 +0000"  >&lt;p&gt;I would like to add that this also applies to delete-queries which can cause serious data loss.&lt;br/&gt;
We had a case where a table of serialized data was completely emptied which caused a database cascade that deleted quite a lot of data.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10659" name="DC-727_refactored.patch" size="2116" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10658" name="DC-727_with_duplicates.patch" size="1879" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10657" name="DC727TestCase.php" size="1321" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10660" name="DC727TestCase_more_specific.php" size="1459" author="gx" created="Wed, 16 Jun 2010 07:51:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-728] Updating slug in I18N behaviour yields non-unique slug</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-728</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;There seems to be a bug in the way, doctrine tries to find a unique slug for a table that is I18N-enabled and has a slug in it.&lt;/p&gt;

&lt;p&gt;Following example:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Problem:
  actAs:
    I18n:
      fields: [name]
      actAs:
        Sluggable: { fields: [name], uniqueBy: [lang, name], canUpdate: true }
  columns:
    name: { type: string(255), notnull: true }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Now, if we insert a new entry, the slug get&apos;s created as expected. If we now insert another entry that would yield the same slug, the slug is made unique by adding the postfix as expected - all well so far.&lt;/p&gt;

&lt;p&gt;Now, if we try to update the entry with the slug with the postfix, what i think is an error happens (Excerpt from Sluggable.php, lib/Doctrine/Template/Listener/Sluggable.php):&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
public function getUniqueSlug($record, $slugFromFields)
...
if ($record-&amp;gt;exists()) {
            $identifier = $record-&amp;gt;identifier();
            $whereString .= &apos; AND r.&apos; . implode(&apos; != ? AND r.&apos;, $table-&amp;gt;getIdentifierColumnNames()) . &apos; != ?&apos;;
            $whereParams = array_merge($whereParams, array_values($identifier));
        }

        foreach ($this-&amp;gt;_options[&apos;uniqueBy&apos;] as $uniqueBy) {
            if (is_null($record-&amp;gt;$uniqueBy)) {
                $whereString .= &apos; AND r.&apos;.$uniqueBy.&apos; IS NULL&apos;;
            } else {
                $whereString .= &apos; AND r.&apos;.$uniqueBy.&apos; = ?&apos;;
                $value = $record-&amp;gt;$uniqueBy;
                if ($value instanceof Doctrine_Record) {
                    $value = current((array) $value-&amp;gt;identifier());
                }
                $whereParams[] = $value;
            }
        }
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;So, the $record-&amp;gt;exists() check evaluates to true and $table-&amp;gt;getIdentifierColumnNames() yields the fields id and lang, so the whereString is something like&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
AND r.id != ? AND r.lang != ?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Now for the problematic part:&lt;br/&gt;
uniqueBy is lang and name; so the code adds to the whereString:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
AND r.lang = ? AND r.name = ?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;So the resulting whereString has something like&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
r.lang != ? AND r.lang = ?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;which will never yield a result in my eyes, thus, the postfix is never incremented an