Używam Symfony 1.2 i Propel'a 1.3
bardzo bym prosił o jakiś prosty przykładzik...

<table name="menu" idMethod="native" treeMode="NestedSet"> <column name="id" type="INTEGER" required="true" autoIncrement="true" primaryKey="true"/> <column name="lft" type="INTEGER" required="true" default="0" nestedSetLeftKey="true"/> <column name="rgt" type="INTEGER" required="true" default="0" nestedSetRightKey="true"/> <column name="scope" type="INTEGER" required="true" default="0" treeScopeKey="true"/> <column name="text" type="VARCHAR" size="128" required="true" default=""/> <column name="link" type="VARCHAR" size="255" required="true" default=""/> <index name="lft"> <index-column name="lft"/> </index> <index name="rgt"> <index-column name="rgt"/> </index> <index name="scope"> <index-column name="scope"/> </index> </table>
<?php class categoriesComponents extends sfComponents { public function executeList() { $root = JmdataCategoriesPeer::retrieveTree(1); $this->it=new myMenuOutput($root); if ($this->getModuleName() == 'categories' && $this->request->getParameter('id')) { $this->node=JmdataCategoriesPeer::getNode($this->request->getParameter('id')); $this->node_path=JmdataCategoriesPeer::getPath($this->node); $root=JmdataCategoriesPeer::retrieveRoot(1); $this->getPath($root); $this->tree=$this->cat_tree; } } private function getPath($root_node) { foreach ($root_node->getChildren() as $node) { if (!$this->checkPath($node) && $node->getLevel() == 1) { } else { $this->getPath($node); } } } private function checkPath($node) { foreach ($this->node_path as $child) if ($child->getId() == $node->getId()) return true; return false; } } ?>
<div id="adminMenu"> <h4><a href="">.::Kategorie::.</a></h4> <ul> <?php if (!$sf_request->hasParameter('id')): ?> <?php foreach($it as $m): ?> <?php if ($m->getLevel() == 1): ?> </li> <?php endif; ?> <?php endforeach; ?> <?php else: ?> <?php foreach ($tree as $nodes): ?> </li> <?php endforeach ?> <?php endif; ?> </ul> </div>
<?php class myMenuOutput extends RecursiveIteratorIterator { function __construct(JmdataCategories $m) { parent::__construct($m, self::SELF_FIRST); } function beginChildren() { } function endChildren() { } } ?>