public function addColumn($col)
    {
        if ($col instanceof Column) {

            if (isset($this->columnsByName[$col->getName()])) {
                throw new EngineException(sprintf('Column "%s" declared twice in table "%s"', $col->getName(), $this->getName()));
            }

            $col->setTable($this);

            if ($col->isInheritance()) {
                $this->inheritanceColumn = $col;
            }

            $this->columns[] = $col;
            $this->columnsByName[$col->getName()] = $col;
            $this->columnsByLowercaseName[strtolower($col->getName())] = $col;
            $this->columnsByPhpName[$col->getPhpName()] = $col;
            $col->setPosition(count($this->columns));

            if ($col->requiresTransactionInPostgres()) {
                $this->needsTransactionInPostgres = true;
            }

            return $col;
        }

        $column = new Column();
        $column->setTable($this);
        $column->loadMapping($col);

        return $this->addColumn($column); // call self w/ different param
    }
public function addColumn($col)
    {
        if ($col instanceof Column) {

            if (isset($this->columnsByName[$col->getName()])) {
                throw new EngineException(sprintf('Column "%s" declared twice in table "%s"', $col->getName(), $this->getName()));
            }

            $col->setTable($this);

            if ($col->isInheritance()) {
                $this->inheritanceColumn = $col;
            }

            $this->columns[] = $col;
            $this->columnsByName[$col->getName()] = $col;
            $this->columnsByLowercaseName[strtolower($col->getName())] = $col;
            $this->columnsByPhpName[$col->getPhpName()] = $col;
            $col->setPosition(count($this->columns));

            if ($col->requiresTransactionInPostgres()) {
                $this->needsTransactionInPostgres = true;
            }

            return $col;
        }

        $column = new Column();
        $column->setTable($this);
        $column->loadMapping($col);

        return $this->addColumn($column); // call self w/ different param
    }
public function addColumn ( $ col ) { if ( $ col instanceof Column ) { if ( isset ( $ this -> columnsByName [ $ col -> getName ( ) ] ) ) { throw new EngineException ( sprintf ( 'Column "%s" declared twice in table "%s"' , $ col -> getName ( ) , $ this -> getName ( ) ) ) ; } $ col -> setTable ( $ this ) ; if ( $ col -> isInheritance ( ) ) { $ this -> inheritanceColumn = $ col ; } $ this -> columns [ ] = $ col ; $ this -> columnsByName [ $ col -> getName ( ) ] = $ col ; $ this -> columnsByLowercaseName [ strtolower ( $ col -> getName ( ) ) ] = $ col ; $ this -> columnsByPhpName [ $ col -> getPhpName ( ) ] = $ col ; $ col -> setPosition ( count ( $ this -> columns ) ) ; if ( $ col -> requiresTransactionInPostgres ( ) ) { $ this -> needsTransactionInPostgres = true ; } return $ col ; } $ column = new Column ( ) ; $ column -> setTable ( $ this ) ; $ column -> loadMapping ( $ col ) ; return $ this -> addColumn ( $ column ) ; // call self w/ different param }
Adds a new column to the table.

@param  Column|array    $col
@throws EngineException
@return Column
Adds a new column to the table .