<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed Jun 19 18:36: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+AND+priority+%3D+Blocker+ORDER+BY+key+DESC&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+AND+priority+%3D+Blocker+ORDER+BY+key+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="19" total="19"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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>
</channel>
</rss>