dimanche 2 octobre 2011

Doctrine2 Extensions : Tree

Here are some notes on the Doctrine2 Tree behavioral extensions :

Resources :




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