<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 02:27:21 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+Critical+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+Critical+ORDER+BY+key+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="28" total="28"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DC-1058] Warning: Invalid argument supplied for foreach() in SqlWalker.php line 899</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1058</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hallo, i get the error&lt;br/&gt;
Warning: Invalid argument supplied for foreach() in /var/www/phverbose/vendor/doctrine/Doctrine/ORM/Query/SqlWalker.php line 899&lt;/p&gt;

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

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

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


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

<item>
            <title>[DC-1053] Renaming a doctrine &apos;string&apos; field may result in loss of data as the field&apos;s type changes. (MySQL)</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1053</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Consider the following schema:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;schema.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;MyTable:
  columns:
    some_text:        string
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Doctrine creates the table with:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;CREATE TABLE `my_table` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `some_text` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, the following migration should rename the field from &lt;tt&gt;some_text&lt;/tt&gt; to &lt;tt&gt;just_text&lt;/tt&gt;:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php
class Version1 &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Migration_Base
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function up()
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;renameColumn(&apos;my_table&apos;, &apos;some_text&apos;, &apos;just_text&apos;);
    }

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

&lt;p&gt;...however the field gets renamed and the type becomes &lt;tt&gt;VARCHAR(255)&lt;/tt&gt;, as the resulting &lt;tt&gt;SHOW CREATE TABLE my_table&lt;/tt&gt; shows:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;CREATE TABLE `my_table` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `a_varchar` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Doctrine_Connection_Mssql&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function update(Doctrine_Table $table, array $fields, array $identifier)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (empty($fields)) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        }

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

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

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

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

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

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

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

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

&lt;p&gt;In Doctrine_Query:getLimitSubquery() there is a call to Doctrine_Connection_Mssql::modifyLimitSubquery().&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function modifyLimitSubquery(Doctrine_Table $rootTable, $query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
{
	&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;modifyLimitQuery($query, $limit, $offset, $isManip, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This in turn calls Doctrine_Connection_Mssql::modifyLimitQuery() wihtout passing the $queryOrigin parameter:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function modifyLimitQuery($query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isSubQuery = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, Doctrine_Query $queryOrigin = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($limit === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; || !($limit &amp;gt; 0)) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $query;
        }

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

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; &amp;amp;&amp;amp; $orderby === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Connection_Exception(&lt;span class=&quot;code-quote&quot;&gt;&quot;OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons.&quot;&lt;/span&gt;);
        }
        
        $count = intval($limit);
        $offset = intval($offset);

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

        $orderbySql = $queryOrigin-&amp;gt;getSqlQueryPart(&apos;orderby&apos;);
        $orderbyDql = $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&apos;);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderby !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
            $orders = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;parseOrderBy(implode(&apos;, &apos;, $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&apos;)));

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

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

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

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

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

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

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

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

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


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


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

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

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

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


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


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

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

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

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

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


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

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

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

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

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

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

&lt;p&gt;This is due to &lt;a href=&quot;http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255&quot; class=&quot;external-link&quot;&gt;this line&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
} &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! isset($prev[$parent][$relationAlias])) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

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

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

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

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

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

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

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

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

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

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

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

&lt;p&gt;With patch &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-651&quot; title=&quot;[PATCH] Doctrine_Record::option(&amp;#39;orderBy&amp;#39;, ...) of join&amp;#39;s right side being applied to refTable in m2m relationship&quot;&gt;DC-651&lt;/a&gt; applied my code in Query.php at line 1315 noew looks as follows:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
                &lt;span class=&quot;code-comment&quot;&gt;// Note: Only include orderBy values &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; tables we&apos;re actually selecting from (both the root table or
&lt;/span&gt;                &lt;span class=&quot;code-comment&quot;&gt;// tables referenced from it)
&lt;/span&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (in_array(&lt;span class=&quot;code-quote&quot;&gt;&quot;{$map[&apos;table&apos;]-&amp;gt;getTableName()} {$sqlAlias}&quot;&lt;/span&gt;, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;from&apos;]) || array_key_exists($alias, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sqlParts[&apos;from&apos;])) {
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($map[&apos;relation&apos;])) {
                        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($map[&apos;ref&apos;])) {
                            $orderBy = $map[&apos;relation&apos;][&apos;refTable&apos;]-&amp;gt;processOrderBy($sqlAlias, $map[&apos;relation&apos;][&apos;orderBy&apos;], &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($map[&apos;relation&apos;][&apos;orderBy&apos;] &amp;amp;&amp;amp; $orderBy == $map[&apos;relation&apos;][&apos;orderBy&apos;]) {
                                $orderBy = $map[&apos;relation&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            }
                        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                            $orderBy = $map[&apos;relation&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderBy == $map[&apos;relation&apos;][&apos;orderBy&apos;]) {
                                $orderBy = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
                            }
                        }
                    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                        $orderBy = $map[&apos;table&apos;]-&amp;gt;getOrderByStatement($sqlAlias, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                    }
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                        $orderBy = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

&lt;p&gt;I believe the fix may be to amend as:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;        $from = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateModels(
            Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_fromPrefix,
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_from);
        $to = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateModels(
            Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_MODEL_CLASS_PREFIX) . self::$_toPrefix,
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_to                
        );
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

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

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

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

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

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

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

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

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


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

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

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

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

&lt;p&gt;For example, here is my table :&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
News:
  tableName: ne_news
  columns:
    id:           { type: integer(4), primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, autoincrement: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    author_id:    { type: integer(4), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    name:         { type: string(255) }
    description:  { type: text }
  relations:
    author: { class: sfGuardUser, onDelete: NULL, local: author_id, foreign: id, foreignAlias: sfGuardUser }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the fixture :&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
SfGuardUser:
  sadmin:
    username:       admin
    password:       admin
    is_super_admin: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
  author1:
    username: myname
    
News:
  News1:
    name: Test 1
    description: Description of news 1
    author: author1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

&lt;p&gt;If i add a news.class.php and extends the autogenerated class it fails.&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setAuthor($v)
    {
        &lt;span class=&quot;code-comment&quot;&gt;//__log(&apos;extending setter&apos;);
&lt;/span&gt;        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_set(&apos;author&apos;, $v);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

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

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

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

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

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

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

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

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

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

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


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

        date_of_birth:
            type: date

BASE MODEL

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

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

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

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

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

BASE MODEL

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

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

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

    fieldname:
         . . .
        notnull: false
        default: null

BASE MODEL

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

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

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

<item>
            <title>[DC-659] Sluggable behavior does not check uniqueness on insert if a slug is manually set, causing SQL error/crash</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-659</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The Sluggable behavior has the following code:
&lt;br class=&quot;atl-forced-newline&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Sluggable.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    /**
     * Set the slug value automatically when a record is inserted
     *
     * @param Doctrine_Event $event
     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; void
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preInsert(Doctrine_Event $event)
    {
        $record = $event-&amp;gt;getInvoker();
        $name = $record-&amp;gt;getTable()-&amp;gt;getFieldName($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_options[&apos;name&apos;]);

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

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

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

&lt;p&gt;If this kind of &quot;don&apos;t do a preInsert check if I manunally set the slug&quot; behavior is a &lt;em&gt;FEATURE&lt;/em&gt; then it would be best to have an option to allow it to be disabled. If it is a &lt;em&gt;BUG&lt;/em&gt; then I would suggest that the preInsert method should be changed to:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Sluggable.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    /**
     * Set the slug value automatically when a record is inserted
     *
     * @param Doctrine_Event $event
     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; void
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function preInsert(Doctrine_Event $event)
    {
        $record = $event-&amp;gt;getInvoker();
        $name = $record-&amp;gt;getTable()-&amp;gt;getFieldName($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_options[&apos;name&apos;]);

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


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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

&lt;p&gt;I&apos;m pretty sure my usage scenario is not marginal but let me know what you think.&lt;/p&gt;</comment>
                    <comment id="12902" author="jwage" created="Mon, 10 May 2010 14:08:13 +0000"  >&lt;p&gt;This is already possible if I understand what you describe.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$q-&amp;gt;useResultCache(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, 3600, &apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you can do:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$cacheDriver-&amp;gt;delete(&apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

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

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

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

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

&lt;p&gt;In Doctrine/Query/Abstract.php right after the line&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$cacheDriver-&amp;gt;save($hash, $cached, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getResultCacheLifeSpan());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ve added &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!empty($GLOBALS[&apos;rcache_users_in_query&apos;])) {
                	MyCache::keepRelatedCacheKey($GLOBALS[&apos;rcache_users_in_query&apos;], $hash);
                }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

&lt;p&gt;When a user on my system does the update, I then delete all relevant Doctrine keys with something like&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_null($cacheDriver)) $cacheDriver = Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_RESULT_CACHE);
		
		foreach($arKeys as $key) {
			$cacheDriver-&amp;gt;delete($key);			
		}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then delete my other cache key.&lt;/p&gt;

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

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

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

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

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

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

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

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


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

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

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

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

<item>
            <title>[DC-586] Doctrine outputs invalid SQL when using Limit and Order By conditions in MSSQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-586</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I have a Doctrine model which connects to a MSSQL database. I was trying to run the following query:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$q = Doctrine_Query::create()
    -&amp;gt;select(&apos;*&apos;)
    -&amp;gt;from(&apos;Comment c&apos;)
    -&amp;gt;innerJoin(&apos;c.RecordType&apos;)
    -&amp;gt;innerJoin(&apos;c.Department&apos;)
    -&amp;gt;limit(10)
    -&amp;gt;orderBy(&apos;c.Counter&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The code failed with a SQL Syntax exception so I took a look at the generated query and found the following (SELECT fields shortened for readabilty):&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;SELECT * FROM (
	SELECT TOP 10 * FROM (
		SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ...
		FROM comments c
			INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = &apos;RecordType&apos;
			INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = &apos;Department&apos;
		ORDER BY [c].[counter]
	) AS [inner_tbl]
	ORDER BY [inner_tbl].[counter] AS [c__counter] DESC
) AS [outer_tbl]
ORDER BY [outer_tbl].[counter] AS [c__counter] ASC
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

&lt;p&gt;So I decided to prod around the Mssql.php connection class and found the following:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;140 &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function modifyLimitQuery($query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isSubQuery = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
141 {
...
169                    $field_array = explode(&apos;,&apos;, $fields_string);
170                    $field_array = array_shift($field_array);
171                    $aux2 = preg_split(&apos;/ as /&apos;, $field_array);
172                    $aux2 = explode(&apos;.&apos;, end($aux2));
173
174                    $aliases[$i] = trim(end($aux2));
...
232 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Line 171 seems to be in charge of setting up the orderBy aliases but it is looking for a lower case &apos; as &apos; string which doesn&apos;t exist in this SQL expression. Changing that to a case insensitive regular expression search seems to fix the problem:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;171                    $aux2 = preg_split(&apos;/ as /i&apos;, $field_array);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here is the resulting SQL with the change:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;SELECT * FROM (
	SELECT TOP 10 * FROM (
		SELECT TOP 10 [c].[counter] AS [c__counter], [c].[loanid] AS [c__loanid]... ... ...
		FROM comments c
			INNER JOIN [SystemTypes] [s] ON [c].[recordtype] = [s].[code] AND [s].[fieldname] = &apos;RecordType&apos;
			INNER JOIN [SystemTypes] [s2] ON [c].[department] = [s2].[code] AND [s2].[fieldname] = &apos;Department&apos;
		ORDER BY [c].[counter]
	) AS [inner_tbl]
	ORDER BY [inner_tbl].[c__counter] DESC
) AS [outer_tbl]
ORDER BY [outer_tbl].[c__counter] ASC]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

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

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

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

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

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


&lt;p&gt;When using HYDRATE_RECORD_HIERARCHY, the first top-level category is empty. Everything is assigned to the other one. Only single-root trees work properly.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10935">DC-515</key>
            <summary>HYDRATE_RECORD_HIERARCHY broken with many roots</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="krojew">Kamil Rojewski</reporter>
                        <labels>
                    </labels>
                <created>Mon, 22 Feb 2010 15:30:42 +0000</created>
                <updated>Wed, 9 Jun 2010 03:11:58 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12304" author="krojew" created="Wed, 17 Mar 2010 05:46:20 +0000"  >&lt;p&gt;If you look at Doctrine_Collection::toHierarchy() you&apos;ll notice that there is NO reference to root_id, therefore it treats the entire collection as 1 tree (which is false). The bug is 100% repeatable. I&apos;ve made a fast walkaround ba adding a multi-tree hydrator:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;class MultiRootHydrator &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Hydrator_RecordDriver
{
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function hydrateResultSet($stmt)
  {
    $result = parent::hydrateResultSet($stmt);

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

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

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

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

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

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

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

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


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

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

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


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

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

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

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

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

&lt;p&gt;I cant overcome this problem right now, unfortunatelly (well I can&lt;br/&gt;
just remove all default values from table definitions or use&lt;br/&gt;
Doctrine_Query for updating staff.. but I&apos;d like to use models &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/sad.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; &lt;/p&gt;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

}

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

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

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

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

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

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