/** * the constructor * * @throws Doctrine_Connection_Exception if there are no opened connections * @param string $name the name of the component * @param Doctrine_Connection $conn the connection associated with this table * @param boolean $initDefinition whether to init the in-memory schema */ public function __construct($name, Doctrine_Connection $conn, $initDefinition = false) { $this->_conn = $conn; $this->_options['name'] = $name; $this->setParent($this->_conn); $this->_conn->addTable($this); $this->_parser = new Doctrine_Relation_Parser($this); if ($charset = $this->getAttribute(Doctrine_Core::ATTR_DEFAULT_TABLE_CHARSET)) { $this->_options['charset'] = $charset; } if ($collate = $this->getAttribute(Doctrine_Core::ATTR_DEFAULT_TABLE_COLLATE)) { $this->_options['collate'] = $collate; } if ($initDefinition) { $this->record = $this->initDefinition(); $this->initIdentifier(); $this->record->setUp(); // if tree, set up tree if ($this->isTree()) { $this->getTree()->setUp(); } } else { if (!isset($this->_options['tableName'])) { $this->setTableName(Doctrine_Inflector::tableize($this->_options['name'])); } } $this->_filters[] = new Doctrine_Record_Filter_Standard(); $this->_repository = new Doctrine_Table_Repository($this); $this->construct(); }