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
c9dafc24
Commit
c9dafc24
authored
Jul 12, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed where() and orderBy() to addWhere() and addOrderBy()
parent
22cdbd74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
NestedSet.php
lib/Doctrine/Node/NestedSet.php
+12
-12
NestedSet.php
lib/Doctrine/Tree/NestedSet.php
+5
-5
No files found.
lib/Doctrine/Node/NestedSet.php
View file @
c9dafc24
...
...
@@ -80,7 +80,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getPrevSibling
()
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
=
$q
->
w
here
(
'base.rgt = ?'
,
$this
->
getLeftValue
()
-
1
);
$q
=
$q
->
addW
here
(
'base.rgt = ?'
,
$this
->
getLeftValue
()
-
1
);
$q
=
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
$result
=
$q
->
execute
();
...
...
@@ -105,7 +105,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getNextSibling
()
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
=
$q
->
w
here
(
'base.lft = ?'
,
$this
->
getRightValue
()
+
1
);
$q
=
$q
->
addW
here
(
'base.lft = ?'
,
$this
->
getRightValue
()
+
1
);
$q
=
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
$result
=
$q
->
execute
();
...
...
@@ -150,7 +150,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getFirstChild
()
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
->
w
here
(
'base.lft = ?'
,
$this
->
getLeftValue
()
+
1
);
$q
->
addW
here
(
'base.lft = ?'
,
$this
->
getLeftValue
()
+
1
);
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
$result
=
$q
->
execute
();
...
...
@@ -175,7 +175,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getLastChild
()
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
->
w
here
(
'base.rgt = ?'
,
$this
->
getRightValue
()
-
1
);
$q
->
addW
here
(
'base.rgt = ?'
,
$this
->
getRightValue
()
-
1
);
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
$result
=
$q
->
execute
();
...
...
@@ -215,9 +215,9 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
$params
=
array
(
$this
->
record
->
get
(
'lft'
),
$this
->
record
->
get
(
'rgt'
));
if
(
$includeNode
)
{
$q
->
where
(
"base.lft >= ? AND base.rgt <= ?"
,
$params
)
->
o
rderBy
(
"base.lft asc"
);
$q
->
addWhere
(
"base.lft >= ? AND base.rgt <= ?"
,
$params
)
->
addO
rderBy
(
"base.lft asc"
);
}
else
{
$q
->
where
(
"base.lft > ? AND base.rgt < ?"
,
$params
)
->
o
rderBy
(
"base.lft asc"
);
$q
->
addWhere
(
"base.lft > ? AND base.rgt < ?"
,
$params
)
->
addO
rderBy
(
"base.lft asc"
);
}
if
(
$depth
!==
null
)
{
...
...
@@ -242,8 +242,8 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getParent
()
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
->
w
here
(
"base.lft < ? AND base.rgt > ?"
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()))
->
o
rderBy
(
"base.rgt asc"
);
$q
->
addW
here
(
"base.lft < ? AND base.rgt > ?"
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()))
->
addO
rderBy
(
"base.rgt asc"
);
$q
=
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
$result
=
$q
->
execute
();
...
...
@@ -270,8 +270,8 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
public
function
getAncestors
(
$depth
=
null
)
{
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
->
w
here
(
"base.lft < ? AND base.rgt > ?"
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()))
->
o
rderBy
(
"base.lft asc"
);
$q
->
addW
here
(
"base.lft < ? AND base.rgt > ?"
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()))
->
addO
rderBy
(
"base.lft asc"
);
if
(
$depth
!==
null
)
{
$q
->
addWhere
(
"base.level >= ?"
,
$this
->
record
[
'level'
]
-
$depth
);
}
...
...
@@ -765,7 +765,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
$componentName
=
$this
->
record
->
getTable
()
->
getComponentName
();
$q
=
$q
->
w
here
(
'base.lft >= ? AND base.rgt <= ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$q
->
addW
here
(
'base.lft >= ? AND base.rgt <= ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$this
->
record
->
getTable
()
->
getTree
()
->
returnQueryWithRootId
(
$q
,
$oldRoot
);
...
...
@@ -950,7 +950,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
if
(
!
isset
(
$this
->
record
[
'level'
]))
{
$componentName
=
$this
->
record
->
getTable
()
->
getComponentName
();
$q
=
$this
->
_tree
->
getBaseQuery
();
$q
=
$q
->
w
here
(
'base.lft < ? AND base.rgt > ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$q
->
addW
here
(
'base.lft < ? AND base.rgt > ?'
,
array
(
$this
->
getLeftValue
(),
$this
->
getRightValue
()));
$q
=
$this
->
_tree
->
returnQueryWithRootId
(
$q
,
$this
->
getRootValue
());
...
...
lib/Doctrine/Tree/NestedSet.php
View file @
c9dafc24
...
...
@@ -109,7 +109,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
public
function
fetchRoot
(
$rootId
=
1
)
{
$q
=
$this
->
getBaseQuery
();
$q
=
$q
->
w
here
(
'base.lft = ?'
,
1
);
$q
=
$q
->
addW
here
(
'base.lft = ?'
,
1
);
// if tree has many roots, then specify root id
$q
=
$this
->
returnQueryWithRootId
(
$q
,
$rootId
);
...
...
@@ -149,9 +149,9 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
// if tree has many roots, then specify root id
$rootId
=
isset
(
$options
[
'root_id'
])
?
$options
[
'root_id'
]
:
'1'
;
if
(
is_array
(
$rootId
))
{
$q
->
o
rderBy
(
"base."
.
$this
->
getAttribute
(
'rootColumnName'
)
.
", base.lft ASC"
);
$q
->
addO
rderBy
(
"base."
.
$this
->
getAttribute
(
'rootColumnName'
)
.
", base.lft ASC"
);
}
else
{
$q
->
o
rderBy
(
"base.lft ASC"
);
$q
->
addO
rderBy
(
"base.lft ASC"
);
}
$q
=
$this
->
returnQueryWithRootId
(
$q
,
$rootId
);
...
...
@@ -183,7 +183,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
$q
=
$this
->
getBaseQuery
();
$params
=
array
(
$record
->
get
(
'lft'
),
$record
->
get
(
'rgt'
));
$q
->
where
(
"base.lft >= ? AND base.rgt <= ?"
,
$params
)
->
o
rderBy
(
"base.lft asc"
);
$q
->
addWhere
(
"base.lft >= ? AND base.rgt <= ?"
,
$params
)
->
addO
rderBy
(
"base.lft asc"
);
$q
=
$this
->
returnQueryWithRootId
(
$q
,
$record
->
getNode
()
->
getRootValue
());
return
$q
->
execute
();
}
...
...
@@ -197,7 +197,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
public
function
fetchRoots
()
{
$q
=
$this
->
getBaseQuery
();
$q
=
$q
->
w
here
(
'base.lft = ?'
,
1
);
$q
=
$q
->
addW
here
(
'base.lft = ?'
,
1
);
return
$q
->
execute
();
}
...
...
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