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
0d1d0ed4
Commit
0d1d0ed4
authored
Feb 08, 2007
by
joesimms
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc changes for tree configuration
parent
02efd7f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
25 deletions
+8
-25
EXAMPLE.tree.php
draft/EXAMPLE.tree.php
+1
-20
Hierarchical data - Introduction - Setting up.php
...l/codes/Hierarchical data - Introduction - Setting up.php
+2
-1
Hierarchical data - Nested set - Setting up.php
manual/codes/Hierarchical data - Nested set - Setting up.php
+2
-2
Hierarchical data - Nested set - Tree options.php
...l/codes/Hierarchical data - Nested set - Tree options.php
+3
-2
No files found.
draft/EXAMPLE.tree.php
View file @
0d1d0ed4
...
...
@@ -4,26 +4,7 @@
require_once
(
"../lib/Doctrine.php"
);
// autoloading objects, modified function to search drafts folder first, should run this test script from the drafts folder
function
__autoload
(
$classname
)
{
if
(
class_exists
(
$classname
))
{
return
false
;
}
if
(
!
$path
)
{
$path
=
dirname
(
__FILE__
);
}
$classpath
=
str_replace
(
'Doctrine_'
,
''
,
$classname
);
$class
=
$path
.
DIRECTORY_SEPARATOR
.
str_replace
(
'_'
,
DIRECTORY_SEPARATOR
,
$classpath
)
.
'.php'
;
if
(
!
file_exists
(
$class
))
{
return
Doctrine
::
autoload
(
$classname
);
}
require_once
(
$class
);
return
true
;
}
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
// define our tree
class
Menu
extends
Doctrine_Record
{
...
...
manual/codes/Hierarchical data - Introduction - Setting up.php
View file @
0d1d0ed4
...
...
@@ -7,7 +7,8 @@ class Menu extends Doctrine_Record {
// add this your table definition to set the table as NestedSet tree implementation
// $implName is 'NestedSet' or 'AdjacencyList' or 'MaterializedPath'
// $options is an assoc array of options, see implementation docs for options
$this
->
actsAsTree
(
$implName
,
$options
);
$this
->
option
(
'treeImpl'
,
$implName
);
$this
->
option
(
'treeOptions'
,
$options
);
// you do not need to add any columns specific to the nested set implementation, these are added for you
$this
->
hasColumn
(
"name"
,
"string"
,
30
);
...
...
manual/codes/Hierarchical data - Nested set - Setting up.php
View file @
0d1d0ed4
...
...
@@ -5,8 +5,8 @@ class Menu extends Doctrine_Record {
$this
->
setTableName
(
'menu'
);
// add this your table definition to set the table as NestedSet tree implementation
$options
=
array
(
);
$this
->
actsAsTree
(
'NestedSet'
,
$options
);
$this
->
option
(
'treeImpl'
,
'NestedSet'
);
$this
->
option
(
'treeOptions'
,
array
());
// you do not need to add any columns specific to the nested set implementation, these are added for you
$this
->
hasColumn
(
"name"
,
"string"
,
30
);
...
...
manual/codes/Hierarchical data - Nested set - Tree options.php
View file @
0d1d0ed4
<?php
$options
=
array
(
'has_many_roots'
=>
true
,
// enable many roots
'root_column_name'
=>
'root_id'
);
// set root column name, defaults to 'root_id'
//use these options in the setTableDefinition
$options
=
array
(
'hasManyRoots'
=>
true
,
// enable many roots
'rootColumnName'
=>
'root_id'
);
// set root column name, defaults to 'root_id'
// To create new root nodes, if you have manually set the root_id, then it will be used
// otherwise it will automatically use the next available root id
...
...
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