public function initialize(Doctrine_Table $table) { if ($this->_initialized) { return false; } $this->_initialized = true; $this->initOptions(); $table->addPlugin($this, get_class($this)); $this->_options['table'] = $table; $this->_options['className'] = str_replace('%CLASS%', $this->_options['table']->getComponentName(), $this->_options['className']); // check that class doesn't exist (otherwise we cannot create it) if (class_exists($this->_options['className'])) { return false; } $conn = $this->_options['table']->getConnection(); $this->_table = new Doctrine_Table($this->_options['className'], $conn); $conn->addTable($this->_table); $fk = $this->buildForeignKeys($this->_options['table']); $this->_table->setColumns($fk); $this->buildRelation(); $this->setTableDefinition(); $this->setUp(); $this->generateClass($this->_table->getColumns()); $this->buildChildDefinitions(); }