1
0
mirror of synced 2024-12-16 16:16:04 +03:00
doctrine2/manual/codes/Hierarchical data - Nested set - Setting up.php

21 lines
643 B
PHP

<?php
class Menu extends Doctrine_Record {
public function setTableDefinition() {
$this->setTableName('menu');
// add this your table definition to set the table as NestedSet tree implementation
$options = array();
$this->actsAsTree('NestedSet', $options);
// 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');
}
}
?>