/** * A utility function to create a new column from attrib and add it to this * table. * * @param $coldata xml attributes or Column class for the column to add * @return the added column */ public function addColumn($data) { if ($data instanceof Column) { $col = $data; $col->setTable($this); if ($col->isInheritance()) { $this->inheritanceColumn = $col; } if (isset($this->columnsByName[$col->getName()])) { throw new EngineException('Duplicate column declared: ' . $col->getName()); } $this->columnList[] = $col; $this->columnsByName[$col->getName()] = $col; $this->columnsByLowercaseName[strtolower($col->getName())] = $col; $this->columnsByPhpName[$col->getPhpName()] = $col; $col->setPosition(count($this->columnList)); $this->needsTransactionInPostgres |= $col->requiresTransactionInPostgres(); return $col; } else { $col = new Column(); $col->setTable($this); $col->loadFromXML($data); return $this->addColumn($col); // call self w/ different param } }
/** * A utility function to create a new column from attrib and add it to this * table. * * @param $coldata xml attributes or Column class for the column to add * @return the added column */ public function addColumn($data) { if ($data instanceof Column) { $col = $data; $col->setTable($this); if ($col->isInheritance()) { $this->inheritanceColumn = $col; } $this->columnList[] = $col; $this->columnsByName[$col->getName()] = $col; $this->columnsByPhpName[$col->getPhpName()] = $col; $col->setPosition(count($this->columnList)); $this->needsTransactionInPostgres |= $col->requiresTransactionInPostgres(); return $col; } else { $col = new Column(); $col->setTable($this); $col->loadFromXML($data); return $this->addColumn($col); // call self w/ different param } }