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
bc24aafd
Commit
bc24aafd
authored
Apr 23, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closed #313
Ticket: 313
parent
e990c9e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
NestedSet.php
lib/Doctrine/Node/NestedSet.php
+16
-13
No files found.
lib/Doctrine/Node/NestedSet.php
View file @
bc24aafd
...
...
@@ -590,18 +590,19 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
// TODO: Wrap in transaction
// shift left columns
$qLeft
=
$qLeft
->
update
(
$this
->
record
->
getTable
()
->
getComponentName
())
->
set
(
'lft'
,
'lft + '
.
$delta
)
->
where
(
'lft >= ?'
,
$first
);
$componentName
=
$this
->
record
->
getTable
()
->
getComponentName
();
$qLeft
=
$qLeft
->
update
(
$componentName
)
->
set
(
$componentName
.
'.lft'
,
'lft + '
.
$delta
)
->
where
(
$componentName
.
'.lft >= ?'
,
$first
);
$qLeft
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$qLeft
,
$rootId
);
$resultLeft
=
$qLeft
->
execute
();
// shift right columns
$resultRight
=
$qRight
->
update
(
$
this
->
record
->
getTable
()
->
getComponentName
()
)
->
set
(
'
rgt'
,
'rgt + '
.
$delta
)
->
where
(
'
rgt >= ?'
,
$first
);
$resultRight
=
$qRight
->
update
(
$
componentName
)
->
set
(
$componentName
.
'.
rgt'
,
'rgt + '
.
$delta
)
->
where
(
$componentName
.
'.
rgt >= ?'
,
$first
);
$qRight
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$qRight
,
$rootId
);
...
...
@@ -624,18 +625,19 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
// TODO : Wrap in transaction
// shift left column values
$qLeft
=
$qLeft
->
update
(
$this
->
record
->
getTable
()
->
getComponentName
())
->
set
(
'lft'
,
'lft + '
.
$delta
)
->
where
(
'lft >= ? AND lft <= ?'
,
array
(
$first
,
$last
));
$componentName
=
$this
->
record
->
getTable
()
->
getComponentName
();
$qLeft
=
$qLeft
->
update
(
$componentName
)
->
set
(
$componentName
.
'.lft'
,
'lft + '
.
$delta
)
->
where
(
$componentName
.
'.lft >= ? AND '
.
$componentName
.
'.lft <= ?'
,
array
(
$first
,
$last
));
$qLeft
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$qLeft
,
$rootId
);
$resultLeft
=
$qLeft
->
execute
();
// shift right column values
$qRight
=
$qRight
->
update
(
$
this
->
record
->
getTable
()
->
getComponentName
()
)
->
set
(
'
rgt'
,
'rgt + '
.
$delta
)
->
where
(
'rgt >= ? AND
rgt <= ?'
,
array
(
$first
,
$last
));
$qRight
=
$qRight
->
update
(
$
componentName
)
->
set
(
$componentName
.
'.
rgt'
,
'rgt + '
.
$delta
)
->
where
(
$componentName
.
'.rgt >= ? AND '
.
$componentName
.
'.
rgt <= ?'
,
array
(
$first
,
$last
));
$qRight
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$qRight
,
$rootId
);
...
...
@@ -691,8 +693,9 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
{
if
(
!
isset
(
$this
->
level
))
{
$componentName
=
$this
->
record
->
getTable
()
->
getComponentName
();
$q
=
$this
->
record
->
getTable
()
->
createQuery
();
$q
=
$q
->
where
(
'lft < ? AND
rgt > ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$q
->
where
(
$componentName
.
'.lft < ? AND '
.
$componentName
.
'.
rgt > ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
...
...
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