<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed Jun 19 05:39:55 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+component+%3D+%22Nested+Set%22+ORDER+BY+priority+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+component+%3D+%22Nested+Set%22+ORDER+BY+priority+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="10" total="10"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<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-899] Expose hardDelete method on node object when SoftDelete behavior is used</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-899</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When combining SoftDelete and NestedSet behavior, there&apos;s no way of calling hardDelete method on node object. According to documentation, to peform a delete on a nested set, delete should be called in node object, which will call delete method on the object itself.&lt;/p&gt;</description>
                <environment>MySQL</environment>
            <key id="12027">DC-899</key>
            <summary>Expose hardDelete method on node object when SoftDelete behavior is used</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="fvaresi">Fernando Varesi</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Oct 2010 10:55:52 +0000</created>
                <updated>Fri, 22 Oct 2010 10:55:52 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Behaviors</component>
                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-870] NestedSet not moving children of child nodes correctly</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-870</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The best way I can explain the issue is with code. Please see the below:&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;&amp;lt;?php

$root = new Test();
$root-&amp;gt;name = &apos;1&apos;;
$root-&amp;gt;save();

// Create root node
$tree = Doctrine::getTable(&apos;Test&apos;)-&amp;gt;getTree();
$tree-&amp;gt;createRoot($root);

// Create child node
$child1 = new Test();
$child1-&amp;gt;name = &apos;2&apos;;
$child1-&amp;gt;save();

// Add child
$child1-&amp;gt;getNode()-&amp;gt;moveAsLastChildOf($root);

// Create child node
$child2 = new Test();
$child2-&amp;gt;name = &apos;3&apos;;
$child2-&amp;gt;save();

// Add child2 as node of child1
$child2-&amp;gt;getNode()-&amp;gt;moveAsLastChildOf($child1);

// Create child node
$child3 = new Test();
$child3-&amp;gt;name = &apos;4&apos;;
$child3-&amp;gt;save();

// Add child3 as node of child2
$child3-&amp;gt;getNode()-&amp;gt;moveAsLastChildOf($child2);

// Add another root just to be nice
$root2 = new Test();
$root2-&amp;gt;name = &apos;5&apos;;
$root2-&amp;gt;save();

// Create root node
$tree-&amp;gt;createRoot($root2);

/**
 * Now we have the following tree (Each &apos;-&apos; indicates 1 level):
 * 1
 * - 2
 * - - 3
 * - - - 4
 * 5
 */

/**
 * Lets say I want to move node &apos;3&apos; to be a root.
 * With this I assume that all of the current nodes
 * children will be moved with it:
 */
$tree-&amp;gt;createRoot(child2);

/**
 * Now the (implied) tree should look like this:
 * 1
 * - 2
 * 3
 * - 4
 * 5
 * 
 * Instead, the tree actually looks like this:
 * 1
 * - 2
 * - - - 4
 * 3
 * 5
 */

/**
 * I will now demostrate incorrect moving back of child nodes.
 */
$child2-&amp;gt;getNode()-&amp;gt;moveAsLastChildOf($child1);
/**
 * Now the tree should go back to looking like this:
 * 1
 * - 2
 * - - 3
 * - - - 4
 * 5
 * 
 * But the tree now looks like this:
 * 1
 * - 2
 * - - - 4
 * - - 3
 * 5
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>Ubuntu 10.04 x64&lt;br/&gt;
PHP 5.3.2</environment>
            <key id="11933">DC-870</key>
            <summary>NestedSet not moving children of child nodes correctly</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="theashman">Ashley Broadley</reporter>
                        <labels>
                    </labels>
                <created>Mon, 20 Sep 2010 11:25:54 +0000</created>
                <updated>Mon, 20 Sep 2010 11:53:27 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14420" author="theashman" created="Mon, 20 Sep 2010 11:28:02 +0000"  >&lt;p&gt;Fixing code spacing&lt;/p&gt;</comment>
                    <comment id="14421" author="theashman" created="Mon, 20 Sep 2010 11:49:04 +0000"  >&lt;p&gt;I have also noticed that moving a root node back into its original position as a child also corrupts the tree. I have added an example to the original post&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-971] Tree result sets hydrators are checking for column level not field level</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-971</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Tree hierarchy hydrators (Doctrine_Collection::toHierarchy and Doctrine_Array_Hierarchy_Driver::hydrateResultSet) are checking wheter the column `level` exists.&lt;/p&gt;

&lt;p&gt;The level column can be aliased, and for oracle, it is required to do so. Therefor it is better to check, whether the aliased field level exists.&lt;/p&gt;

&lt;p&gt;Patch included in pull request&lt;/p&gt;</description>
                <environment></environment>
            <key id="12392">DC-971</key>
            <summary>Tree result sets hydrators are checking for column level not field level</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="adrive">Miloslav &quot;adrive&quot; Kmet</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Feb 2011 06:37:11 +0000</created>
                <updated>Wed, 16 Feb 2011 06:37:11 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-958] updating Models with Intra-Table Relations cascades strangely</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-958</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Sorry for the lengthy explanation, couldn&apos;t make it more straight forward:&lt;/p&gt;

&lt;p&gt;I have a model which is similiar to a nestet set but the tree structure needs to overlap:&lt;/p&gt;

&lt;p&gt;For Model A, every Object A1 can have multiple descendant objects A2 and in turn can be a descendant of multiple objects A0.&lt;/p&gt;

&lt;p&gt;Since I saw no way to do this with Nested-Set Relations (or Equal-Nested-Sets) I have set up my Model like this:&lt;/p&gt;

&lt;p&gt;modules:&lt;br/&gt;
  columns: ..&amp;lt;do not matter&amp;gt;&lt;br/&gt;
  relations:&lt;br/&gt;
    Children:&lt;br/&gt;
      class: modules&lt;br/&gt;
      refClass: modules_required&lt;br/&gt;
    Parents:&lt;br/&gt;
      class: modules&lt;br/&gt;
      refClass: modules_required&lt;/p&gt;

&lt;p&gt;modules_required:&lt;br/&gt;
  columns: &amp;lt;do not matter here, just 2 foreign key columns&amp;gt;&lt;br/&gt;
  relations:&lt;br/&gt;
    Children:&lt;br/&gt;
    Parents:&lt;/p&gt;

&lt;p&gt;I needed to specify the Relations on both tables, to use onDelete/onUpdate CASCADE rules. Generated Models look fine, just as intended.&lt;br/&gt;
(Every Class has many Children and has many Parents...)&lt;/p&gt;

&lt;p&gt;Now the strange part:&lt;br/&gt;
    When I update an object of modules (say id=18), Doctrine issues the following queries:&lt;br/&gt;
DELETE FROM modules_required WHERE (required_id = ? AND module_id IN (?, ?, ?, ?, ?)) - (18, 25, 26, 32, 34, 35) &lt;br/&gt;
// where 25 to 35 are CHILDREN of 18&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (25, 25, 10)&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (26, 26, 10)&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (32, 32, 10)&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (34, 34, 10)&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (35, 35, 10)&lt;br/&gt;
UPDATE modules_required SET required_id = ? WHERE module_id = ? AND required_id = ? - (25, 25, 12)&lt;br/&gt;
//where 10 and 12 are PARENTS of 18&lt;br/&gt;
and somewhen, Doctrine encounters an MySQL ERROR because of the previous update marathon:&lt;br/&gt;
SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;25-25&apos; for key &apos;PRIMARY&apos; &lt;/p&gt;

&lt;p&gt;The point is: &lt;br/&gt;
1. why is Doctrine trying to create self-referencing relations, and &lt;br/&gt;
2. why is it touching the relation at all, when i only did change some text fields in the object?&lt;/p&gt;

&lt;p&gt;Is there a better way to solve my problem?&lt;/p&gt;</description>
                <environment>PHP 5.3 / symfony 1.4.9</environment>
            <key id="12323">DC-958</key>
            <summary>updating Models with Intra-Table Relations cascades strangely</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="12278">DC-952</parent>
                        <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="bigbadbassman">Daniel Reiche</reporter>
                        <labels>
                    </labels>
                <created>Mon, 24 Jan 2011 11:42:09 +0000</created>
                <updated>Thu, 27 Jan 2011 04:21:44 +0000</updated>
                                    <version>1.2.3</version>
                                                <component>Behaviors</component>
                <component>Documentation</component>
                <component>Nested Set</component>
                <component>Relations</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15182" author="bigbadbassman" created="Tue, 25 Jan 2011 04:37:46 +0000"  >&lt;p&gt;forgot to add something: I have done a debug run, to see why these queries are created, when there was no data modified that related to these tables:&lt;/p&gt;

&lt;p&gt;Doctrine seems to handle my structure internally as a Nested-Set, although I have not specified an actAs: NestedSet or relations: equal: true statement in the model definition.&lt;br/&gt;
Is there a way to prevent symfony from misinterpreting this?&lt;/p&gt;

&lt;p&gt;This is not a nested set, as each object can have virtually any other object either as parent or as a child, and additionaly, parent relations can span multiple tree-levels:&lt;br/&gt;
Object 2 is parent of Object 3 and 6&lt;br/&gt;
Object 3 is parent of Object 4 and 5&lt;br/&gt;
Object 4 is parent of Object 6&lt;/p&gt;

&lt;p&gt;results in: Object 6 has parents 2 and 4 (where 4 has parent 3 and 3 has parent 2 in turn)&lt;/p&gt;

&lt;p&gt;This spanning relations seems to cause the guessed nested set to fail.&lt;/p&gt;

&lt;p&gt;I simply wanted to create an m:n Relation using a Reference table and the fact that both m and n are of the same class should not consider doctrine.&lt;/p&gt;</comment>
                    <comment id="15190" author="bigbadbassman" created="Wed, 26 Jan 2011 05:36:25 +0000"  >&lt;p&gt;related to #&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-329&quot; title=&quot;Problem saving Self Referencing (Nest Relations)&quot;&gt;DC-329&lt;/a&gt;:&lt;br/&gt;
seems to be the same general problem as described there. Only in DC 1.2.3, doctrine tries to delete every child-relation for some unknown reason.&lt;/p&gt;

&lt;p&gt;also the h2aEqualable mentioned there does not work, because it does not prevent symfony from issueing the delete queries. It prevents only the UPDATE-Queries, and thus circumvents the MySQL-Error.&lt;/p&gt;

&lt;p&gt;Nevertheless, data is still corrupted after object save, thus not useable in production.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-403] Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-403</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;h3&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h3&gt;

&lt;ol&gt;
	&lt;li&gt;fetch a tree with nested set
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$root = Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;findRoot($rootId);
$treeObject= Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;fetchTree($root-&amp;gt;getId()); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;issue
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$root-&amp;gt;getNode()-&amp;gt;getChildren();

or there will be a total query mess in a lambda function with a loop getChildren().
...
&amp;lt;?php foreach($root-&amp;gt;getChildren() as $child): ?&amp;gt;
   ....
&amp;lt;?php endforeach; ?&amp;gt;
...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Problem is described more verbosely here &amp;#8211; &lt;a href=&quot;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&quot; class=&quot;external-link&quot;&gt;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whatbehaviorisexpected&quot;&gt;&lt;/a&gt;What behavior is expected&lt;/h3&gt;
&lt;p&gt;An already fetched record instance is returned, without calling database and without causing query flooding.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Likeinpropel.&quot;&gt;&lt;/a&gt;Like in propel.&lt;/h3&gt;
&lt;p&gt;In propel if you are calling ....::retrieveTree($id) it returns the root&lt;br/&gt;
with completed, pooled (cached) and linked  tree.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whathappens&quot;&gt;&lt;/a&gt;What happens&lt;/h3&gt;
&lt;p&gt;An additional query is issued&lt;/p&gt;

&lt;p&gt;This is a big slip in architecture of Doctrine`s nested set implementation.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10693">DC-403</key>
            <summary>Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="zidler">alex</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 20:52:18 +0000</created>
                <updated>Fri, 16 Apr 2010 12:18:05 +0000</updated>
                                    <version>1.2.1</version>
                                <fixVersion>1.2.0</fixVersion>
                                <component>Nested Set</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-467] Can&apos;t create root node if multiple roots and primary key have multiple columns</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-467</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When trying to create new root node, the following exception is thrown.&lt;/p&gt;

&lt;p&gt;PHP Fatal error:  Uncaught exception &apos;Doctrine_Tree_Exception&apos; with message &apos;Node must have a root id set or must  be persistent and have a single-valued numeric primary key in order to be created as a root node. Automatic assignment of a root id on transient/new records is no longer supported.&apos;&lt;/p&gt;

&lt;p&gt;This only happens when hasManyRoots is true, and table have multiple columns in primary key.&lt;/p&gt;

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

&lt;p&gt;$category = new Menu();&lt;br/&gt;
$category-&amp;gt;name = &apos;Menu Root&apos;;&lt;br/&gt;
$category-&amp;gt;language_id = 1;&lt;br/&gt;
$category-&amp;gt;root_id = 23;&lt;br/&gt;
$category-&amp;gt;save();&lt;/p&gt;

&lt;p&gt;$treeObject = Doctrine::getTable(&apos;Menu&apos;)-&amp;gt;getTree();&lt;br/&gt;
$treeObject-&amp;gt;createRoot($category);&lt;/p&gt;


&lt;p&gt;and menu table is defined as follows:&lt;/p&gt;

&lt;p&gt;       $this-&amp;gt;hasColumn(&apos;id&apos;, &apos;integer&apos;, 8, array(&lt;br/&gt;
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,&lt;br/&gt;
             &apos;primary&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;autoincrement&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;length&apos; =&amp;gt; &apos;8&apos;,&lt;br/&gt;
        ));&lt;br/&gt;
        $this-&amp;gt;hasColumn(&apos;language_id&apos;, &apos;integer&apos;, 8, array(&lt;br/&gt;
             &apos;type&apos; =&amp;gt; &apos;integer&apos;,&lt;br/&gt;
             &apos;primary&apos; =&amp;gt; true,&lt;br/&gt;
             &apos;length&apos; =&amp;gt; &apos;8&apos;,&lt;br/&gt;
        ));&lt;/p&gt;

&lt;p&gt;If i remove primary option from language_id column, everything works as it should.&lt;/p&gt;</description>
                <environment>Linux, PostgreSQL</environment>
            <key id="10817">DC-467</key>
            <summary>Can&apos;t create root node if multiple roots and primary key have multiple columns</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="liquidbrain">Milan Cvejic</reporter>
                        <labels>
                    </labels>
                <created>Mon, 1 Feb 2010 05:31:16 +0000</created>
                <updated>Fri, 16 Apr 2010 12:17:22 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-807] Equal nest relation uses incorrect SQL and returns incorrect data</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-807</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The equal nest relation works incorrectly twice. The SQL it produces is wrong. And even if correct the SQL it still returns wrong data.&lt;br/&gt;
In my example below $profile-&amp;gt;getFriends() returns incorrect data and even tries to write these wrong data when I do $profile-&amp;gt;setEmail(&quot;...&quot;); $profile-&amp;gt;save()&lt;br/&gt;
I&apos;m certain that SQL query in Nest.php is wrong, but not only SQL. Even after fixing SQL the data is still incorrect. I digged through the code and suspect that the problem is in Doctrine_Collection which seems to works with only one referenceField, while in an &quot;equal relationship&quot; this field varies row to row.&lt;/p&gt;

&lt;p&gt;Here goes steps to reproduce.&lt;/p&gt;

&lt;p&gt;Schema.yml&lt;br/&gt;
==========&lt;/p&gt;

&lt;p&gt;Profile:&lt;br/&gt;
  columns:&lt;br/&gt;
    id:&lt;br/&gt;
      type: integer&lt;br/&gt;
      primary: true&lt;br/&gt;
      autoincrement: true&lt;br/&gt;
    email:&lt;br/&gt;
      type: varchar(255)&lt;br/&gt;
      notnull: true&lt;br/&gt;
  relations:&lt;br/&gt;
    Friends: &lt;/p&gt;
{ class: Profile, refClass: UserFriend, local: requestor_user_id, foreign: receiver_user_id, equal: true }


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

&lt;p&gt;Profile:&lt;br/&gt;
  -&lt;br/&gt;
    id: 1&lt;br/&gt;
    email: one@example.org&lt;br/&gt;
  -&lt;br/&gt;
    id: 2&lt;br/&gt;
    email: two@example.org&lt;br/&gt;
  -&lt;br/&gt;
    id: 3&lt;br/&gt;
    email: three@example.org&lt;br/&gt;
  -&lt;br/&gt;
    id: 4&lt;br/&gt;
    email: four@example.org&lt;/p&gt;

&lt;p&gt;UserFriend:&lt;br/&gt;
  -&lt;br/&gt;
    requestor_user_id: 1&lt;br/&gt;
    receiver_user_id:  2&lt;br/&gt;
  -&lt;br/&gt;
    requestor_user_id: 4&lt;br/&gt;
    receiver_user_id:  1&lt;br/&gt;
  -&lt;br/&gt;
    requestor_user_id: 2&lt;br/&gt;
    receiver_user_id:  3&lt;/p&gt;


&lt;p&gt;PHP test&lt;br/&gt;
=======&lt;br/&gt;
$user = Doctrine_Core::getTable(&apos;Profile&apos;)-&amp;gt;find(1);&lt;br/&gt;
var_dump($user-&amp;gt;getFriends()-&amp;gt;toArray());&lt;/p&gt;


&lt;p&gt;Output&lt;br/&gt;
======&lt;br/&gt;
array(2) {&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(3) {&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;id&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    string(1) &quot;2&quot;&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;email&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    string(15) &quot;two@example.org&quot;&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;UserFriend&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    array(2) {&lt;br/&gt;
      &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
      array(3) &lt;/p&gt;
{
        [&quot;requestor_user_id&quot;]=&amp;gt;
        string(1) &quot;1&quot;
        [&quot;receiver_user_id&quot;]=&amp;gt;
        string(1) &quot;2&quot;
        [&quot;Receiver&quot;]=&amp;gt;
        bool(false)
      }
&lt;p&gt;      &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
      array(3) &lt;/p&gt;
{
        [&quot;requestor_user_id&quot;]=&amp;gt;
        string(1) &quot;2&quot;
        [&quot;receiver_user_id&quot;]=&amp;gt;
        string(1) &quot;2&quot;
        [&quot;Receiver&quot;]=&amp;gt;
        bool(false)
      }
&lt;p&gt;    }&lt;br/&gt;
  }&lt;br/&gt;
  &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
  array(3) {&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;id&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    string(1) &quot;4&quot;&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;email&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    string(16) &quot;four@example.org&quot;&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;UserFriend&amp;quot;&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
    array(1) {&lt;br/&gt;
      &lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;=&amp;gt;&lt;br/&gt;
      array(3) &lt;/p&gt;
{
        [&quot;requestor_user_id&quot;]=&amp;gt;
        string(1) &quot;4&quot;
        [&quot;receiver_user_id&quot;]=&amp;gt;
        string(1) &quot;4&quot;
        [&quot;Receiver&quot;]=&amp;gt;
        bool(false)
      }
&lt;p&gt;    }&lt;br/&gt;
  }&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;As it can be seen from output, the relation &quot;UserFriend&quot; shows insane data:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;sometime there are two records in &quot;UserFriend&quot; - and that&apos;s wrong&lt;/li&gt;
	&lt;li&gt;user 4 has friendship with 4 - that&apos;s also wrong, not in the fixtures.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>Debian</environment>
            <key id="11710">DC-807</key>
            <summary>Equal nest relation uses incorrect SQL and returns incorrect data</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="denis.chmel">Denis Chmel</reporter>
                        <labels>
                    </labels>
                <created>Tue, 3 Aug 2010 10:40:59 +0000</created>
                <updated>Tue, 3 Aug 2010 10:42:24 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13769" author="denis.chmel" created="Tue, 3 Aug 2010 10:42:24 +0000"  >&lt;p&gt;If this will be useful. here&apos;s the SQL it produces:&lt;/p&gt;

&lt;p&gt;SELECT&lt;br/&gt;
  profile.id      AS profile__id,&lt;br/&gt;
  profile.email   AS profile__email,&lt;br/&gt;
  user_friend.requestor_user_id AS user_friend__requestor_user_id,&lt;br/&gt;
  user_friend.receiver_user_id  AS user_friend__receiver_user_id&lt;br/&gt;
FROM profile&lt;br/&gt;
INNER JOIN user_friend ON profile.id = user_friend.receiver_user_id OR profile.id = user_friend.requestor_user_id&lt;br/&gt;
WHERE&lt;br/&gt;
profile.id IN(SELECT  receiver_user_id FROM user_friend WHERE requestor_user_id = 1)&lt;br/&gt;
OR profile.id IN (SELECT requestor_user_id FROM user_friend WHERE receiver_user_id = 1)&lt;br/&gt;
ORDER BY profile.id ASC&lt;/p&gt;

&lt;p&gt;It&apos;s very clear that an OR in the inner join and another OR in where are not connected, while they must be. Here&apos;s the correct part (in my opinion)&lt;/p&gt;

&lt;p&gt;...&lt;br/&gt;
WHERE&lt;br/&gt;
profile.id IN(SELECT  receiver_user_id FROM user_friend WHERE requestor_user_id = 1) AND user_friend.receiver_user_id=1&lt;br/&gt;
OR profile.id IN (SELECT requestor_user_id FROM user_friend WHERE receiver_user_id = 1) AND user_friend.receiver_user_id=1&lt;br/&gt;
...&lt;/p&gt;

&lt;p&gt;But this only fixes the problem with 2 records in &quot;UserFriends&quot;, but not the second (&quot;user 4 has friendship with 4 - that&apos;s also wrong, not in the fixtures.&quot;).&lt;br/&gt;
That another issue is somewhere inside Collection and how it works with the referenceField.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-707] When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-707</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Hi,&lt;/p&gt;


&lt;p&gt;When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...&lt;/p&gt;



&lt;p&gt;Here is a test case, simply made of the code samples given in documentation : &lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/hierarchical-data/en#nested-set:working-with-trees:creating-a-root-node&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/hierarchical-data/en#nested-set:working-with-trees:creating-a-root-node&lt;/a&gt;&lt;/p&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;/*
 * Creating a Root Node
 */
$category = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$category-&amp;gt;name = &apos;Root Category 1&apos;;
$category-&amp;gt;save();

$treeObject = Doctrine_Core::getTable(&apos;Category&apos;)-&amp;gt;getTree();
$treeObject-&amp;gt;createRoot($category);


/*
 * Inserting a Node
 */
$child1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$child1-&amp;gt;name = &apos;Child Category 1&apos;;

$child2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Category();
$child2-&amp;gt;name = &apos;Child Category 1&apos;;

$child1-&amp;gt;getNode()-&amp;gt;insertAsLastChildOf($category);
$child2-&amp;gt;getNode()-&amp;gt;insertAsLastChildOf($category);




/*
 * BUGGY !
 */
$category-&amp;gt;getNode()-&amp;gt;hasChildren();   &lt;span class=&quot;code-comment&quot;&gt;// will &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, we except &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; as we just instert 2 children to &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; root node...
&lt;/span&gt;

$category-&amp;gt;refresh();
$category-&amp;gt;getNode()-&amp;gt;hasChildren(); &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;... that&apos;s now ok !&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.2 (cli) (built: Apr 12 2010 15:44:21) &lt;br/&gt;
Copyright (c) 1997-2010 The PHP Group&lt;br/&gt;
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled]&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [enabled]&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
MySQL&lt;br/&gt;
&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Server: Localhost via UNIX socket&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Server version: 5.1.41-3ubuntu12.1&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Protocol version: 10</environment>
            <key id="11420">DC-707</key>
            <summary>When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="julien">Julien G</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 May 2010 05:03:06 +0000</created>
                <updated>Sat, 7 Aug 2010 15:39:17 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-890] public function detach break the nested set tree [patch attached]</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-890</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If I detach a node from the tree using &lt;tt&gt;$node-&amp;gt;detach();&lt;/tt&gt; it set the left and right value to zero without shifting, creating a possible tree corruption.&lt;br/&gt;
It still work somehow because inserting a new node will shift the value but keep the hole in the tree.&lt;/p&gt;

&lt;p&gt;I&apos;ve looked to the original commit in Trac (&lt;a href=&quot;http://trac.doctrine-project.org/changeset/4089&quot; class=&quot;external-link&quot;&gt;http://trac.doctrine-project.org/changeset/4089&lt;/a&gt;) and I don&apos;t think the original idea of the commit was to leave a hole.&lt;br/&gt;
I&apos;ve added 3 lines of code (that I copied from the delete function which works properly), the coresponding patch is joigned to the bug ticket&lt;/p&gt;</description>
                <environment>not environment dependant</environment>
            <key id="12008">DC-890</key>
            <summary>public function detach break the nested set tree [patch attached]</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="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="alex-pex">Alexandre PAIXAO</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Oct 2010 12:12:36 +0000</created>
                <updated>Thu, 14 Oct 2010 12:20:06 +0000</updated>
                                                                    <component>Nested Set</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14567" author="alex-pex" created="Thu, 14 Oct 2010 12:18:31 +0000"  >&lt;p&gt;ex:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;root                1       4&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;- node A       2       3&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;after detach :&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;root                1       4&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;- node A         0       0&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;then a new one :&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;root                1       6&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;- node B        4       5&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;- node A         0       0&lt;/tt&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10826" name="NestedSet.patch" size="490" author="alex-pex" created="Thu, 14 Oct 2010 12:12:36 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>