Any hierarchical Data Support in Doctrine 2?

2019-08-11 09:41发布

问题:

in Doctrine 1, i see that it supports hierarchical data support? is there any in Doctrine 2?

UPDATE 1

ok so i used Nested Set Extension for Doctrine 2. i have some questions

1. inserting a node

// in the docs
$child1 = new Category();
$child1->name = 'Child Category 1';

$child2 = new Category();
$child2->name = 'Child Category 2';

$category->addChild($child1);
$category->addChild($child2);

it seems like i must do something like

$root = $nsm->createRoot($category);
$root->addChild($child1);
$root->addChild($child2);

likewise to add sub children

$child2wrapper = $root->addChild($child2);
$child2wrapper->addChild($newChild);

2. abt the root field and having multiple trees.

say i want multiple trees, i see that the extension does not populate my root field? how shld i populate it?

回答1:

you can see this links :

http://github.com/guilhermeblanco/Doctrine2-Hierarchical-Structural-Behavior

http://www.devcomments.com/Any-hierarchical-data-support-in-Doctrine-2-at251409.htm



标签: doctrine