Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
ad0d24ff
Commit
ad0d24ff
authored
May 08, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #1023. Thanks for ticket & patch.
parent
0dd85678
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
NestedSet.php
lib/Doctrine/Node/NestedSet.php
+20
-7
No files found.
lib/Doctrine/Node/NestedSet.php
View file @
ad0d24ff
...
@@ -350,14 +350,27 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
...
@@ -350,14 +350,27 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
if
(
$dest
->
getNode
()
->
isRoot
())
{
if
(
$dest
->
getNode
()
->
isRoot
())
{
return
false
;
return
false
;
}
}
$newRoot
=
$dest
->
getNode
()
->
getRootValue
();
$this
->
shiftRLValues
(
$dest
->
getNode
()
->
getLeftValue
(),
1
,
$newRoot
);
$this
->
shiftRLValues
(
$dest
->
getNode
()
->
getRightValue
()
+
2
,
1
,
$newRoot
);
$newLeft
=
$dest
->
getNode
()
->
getLeftValue
();
$newLeft
=
$dest
->
getNode
()
->
getLeftValue
();
$newRight
=
$dest
->
getNode
()
->
getRightValue
()
+
2
;
$newRight
=
$dest
->
getNode
()
->
getRightValue
()
+
2
;
$newRoot
=
$dest
->
getNode
()
->
getRootValue
();
$newLevel
=
$dest
->
getNode
()
->
getLevel
();
// Make space for new node
$this
->
shiftRLValues
(
$dest
->
getNode
()
->
getRightValue
()
+
1
,
2
,
$newRoot
);
// Slide child nodes over one and down one to allow new parent to wrap them
$componentName
=
$this
->
_tree
->
getBaseComponent
();
$q
=
new
Doctrine_Query
();
$q
->
update
(
$componentName
);
$q
->
set
(
"
$componentName
.lft"
,
"
$componentName
.lft + 1"
);
$q
->
set
(
"
$componentName
.rgt"
,
"
$componentName
.rgt + 1"
);
$q
->
set
(
"
$componentName
.level"
,
"
$componentName
.level + 1"
);
$q
->
where
(
"
$componentName
.lft >= ? AND
$componentName
.rgt <= ?"
,
array
(
$newLeft
,
$newRight
));
$q
=
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$newRoot
);
$q
->
execute
();
$this
->
record
[
'level'
]
=
$
dest
[
'level'
]
-
1
;
$this
->
record
[
'level'
]
=
$
newLevel
;
$this
->
insertNode
(
$newLeft
,
$newRight
,
$newRoot
);
$this
->
insertNode
(
$newLeft
,
$newRight
,
$newRoot
);
return
true
;
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment