diff --git a/draft/EXAMPLE.tree.php b/draft/EXAMPLE.tree.php index 11c18628e..9d09b330a 100644 --- a/draft/EXAMPLE.tree.php +++ b/draft/EXAMPLE.tree.php @@ -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 { diff --git a/manual/codes/Hierarchical data - Introduction - Setting up.php b/manual/codes/Hierarchical data - Introduction - Setting up.php index 1798fb40b..e53653553 100644 --- a/manual/codes/Hierarchical data - Introduction - Setting up.php +++ b/manual/codes/Hierarchical data - Introduction - Setting up.php @@ -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); diff --git a/manual/codes/Hierarchical data - Nested set - Setting up.php b/manual/codes/Hierarchical data - Nested set - Setting up.php index 0dca96527..5d992a909 100644 --- a/manual/codes/Hierarchical data - Nested set - Setting up.php +++ b/manual/codes/Hierarchical data - Nested set - Setting up.php @@ -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); diff --git a/manual/codes/Hierarchical data - Nested set - Tree options.php b/manual/codes/Hierarchical data - Nested set - Tree options.php index 10d7d851e..9ef993901 100644 --- a/manual/codes/Hierarchical data - Nested set - Tree options.php +++ b/manual/codes/Hierarchical data - Nested set - Tree options.php @@ -1,6 +1,7 @@ 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