All pastes #343005 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-06 18:44 UTC
rendered paste body
class TreeNode extends Doctrine_Record {
	public  function setUp(){
		$this->hasOne("ModuleType","ModuleType.moduleType");
	}
	public function setTableDefinition(){

		// add this your table definition to set the table as NestedSet tree implementation
		$options = array('has_many_roots' => true,            // enable many roots
                   'root_column_name' => 'id');    // set root column name, defaults to 'root_id'
		$this->actsAsTree('NestedSet',$options);
		
		$this->hasColumn("pid","integer");
		$this->hasColumn("type","integer");
		$this->hasColumn("name","string",'255',array("notnull","nospace"));
		$this->hasColumn("moduleType","integer");
		$this->hasIndex("name");		
	}		


---


class ModuleType extends Doctrine_Record   {
	public function setUp(){
		
	}
	public function setTableDefinition(){
		$this->hasColumn("id","integer",20,array("autoincrement","primary"));
		$this->hasColumn("name","string",255,array("notnull",'nospace'));
	}
}