2007-04-13 00:52:30 +04:00
|
|
|
|
|
|
|
<code type="php">
|
2007-01-15 16:43:03 +03:00
|
|
|
class Menu extends Doctrine_Record {
|
|
|
|
public function setTableDefinition() {
|
|
|
|
|
|
|
|
$this->setTableName('menu');
|
|
|
|
|
|
|
|
// add this your table definition to set the table as NestedSet tree implementation
|
2007-02-08 15:59:52 +03:00
|
|
|
$this->option('treeImpl', 'NestedSet');
|
|
|
|
$this->option('treeOptions', array());
|
2007-01-15 16:43:03 +03:00
|
|
|
|
|
|
|
// you do not need to add any columns specific to the nested set implementation, these are added for you
|
|
|
|
$this->hasColumn("name","string",30);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// this __toString() function is used to get the name for the path, see node::getPath()
|
|
|
|
public function __toString() {
|
|
|
|
return $this->get('name');
|
|
|
|
}
|
|
|
|
}
|
2007-04-13 00:52:30 +04:00
|
|
|
</code>
|