Resources :
- The generic github repository
- The Symfony2 bundle that interfaces the previous repository with Symfony 2
- Documentation by the creator
- A good tutorial to deploy the bundle in Symfony2
- A jQuery plugin that nicely represents nested trees
Tips & tricks :
The bundle handles everything when it comes to create a new entity in the tree : it sets up the level, changes the left born and the right born, etc...
Be careful when flushing entities that have a relation with nested sets : cascade setup must be adjusted properly.
I think there is no way (yet) to move an entire subtree somewhere else in the tree.
There is a nice way to represent the nested set in html :
$options = array(
'representationField' => 'name',
'child' => array(
'open'=> '<li>',
'close' => '</li>' ),
'root' => array(
'open'=<ul>',
'close' => '</ul>' )
);
$html = $rep->childrenHierarchy(null,false,true,$options);
The purpose of the 'representationField' parameter is to tell the printer which field to output in the tree.
Aucun commentaire:
Enregistrer un commentaire