public function compareColumns($caseInsensitive = false)
    {
        $fromTableColumns = $this->getFromTable()->getColumns();
        $toTableColumns = $this->getToTable()->getColumns();
        $columnDifferences = 0;

        // check for new columns in $toTable
        foreach ($toTableColumns as $column) {
            if (!$this->getFromTable()->hasColumn($column->getName(), $caseInsensitive)) {
                $this->tableDiff->addAddedColumn($column->getName(), $column);
                $columnDifferences++;
            }
        }

        // check for removed columns in $toTable
        foreach ($fromTableColumns as $column) {
            if (!$this->getToTable()->hasColumn($column->getName(), $caseInsensitive)) {
                $this->tableDiff->addRemovedColumn($column->getName(), $column);
                $columnDifferences++;
            }
        }

        // check for column differences
        foreach ($fromTableColumns as $fromColumn) {
            if ($this->getToTable()->hasColumn($fromColumn->getName(), $caseInsensitive)) {
                $toColumn = $this->getToTable()->getColumn($fromColumn->getName(), $caseInsensitive);
                $columnDiff = PropelColumnComparator::computeDiff($fromColumn, $toColumn);
                if ($columnDiff) {
                    $this->tableDiff->addModifiedColumn($fromColumn->getName(), $columnDiff);
                    $columnDifferences++;
                }
            }
        }

        // check for column renamings
        foreach ($this->tableDiff->getAddedColumns() as $addedColumnName => $addedColumn) {
            foreach ($this->tableDiff->getRemovedColumns() as $removedColumnName => $removedColumn) {
                if (!PropelColumnComparator::computeDiff($addedColumn, $removedColumn)) {
                    // no difference except the name, that's probably a renaming
                    $this->tableDiff->addRenamedColumn($removedColumn, $addedColumn);
                    $this->tableDiff->removeAddedColumn($addedColumnName);
                    $this->tableDiff->removeRemovedColumn($removedColumnName);
                    $columnDifferences--;
                    // skip to the next added column
                    break;
                }
            }
        }

        return $columnDifferences;
    }
public function compareColumns($caseInsensitive = false)
    {
        $fromTableColumns = $this->getFromTable()->getColumns();
        $toTableColumns = $this->getToTable()->getColumns();
        $columnDifferences = 0;

        // check for new columns in $toTable
        foreach ($toTableColumns as $column) {
            if (!$this->getFromTable()->hasColumn($column->getName(), $caseInsensitive)) {
                $this->tableDiff->addAddedColumn($column->getName(), $column);
                $columnDifferences++;
            }
        }

        // check for removed columns in $toTable
        foreach ($fromTableColumns as $column) {
            if (!$this->getToTable()->hasColumn($column->getName(), $caseInsensitive)) {
                $this->tableDiff->addRemovedColumn($column->getName(), $column);
                $columnDifferences++;
            }
        }

        // check for column differences
        foreach ($fromTableColumns as $fromColumn) {
            if ($this->getToTable()->hasColumn($fromColumn->getName(), $caseInsensitive)) {
                $toColumn = $this->getToTable()->getColumn($fromColumn->getName(), $caseInsensitive);
                $columnDiff = PropelColumnComparator::computeDiff($fromColumn, $toColumn);
                if ($columnDiff) {
                    $this->tableDiff->addModifiedColumn($fromColumn->getName(), $columnDiff);
                    $columnDifferences++;
                }
            }
        }

        // check for column renamings
        foreach ($this->tableDiff->getAddedColumns() as $addedColumnName => $addedColumn) {
            foreach ($this->tableDiff->getRemovedColumns() as $removedColumnName => $removedColumn) {
                if (!PropelColumnComparator::computeDiff($addedColumn, $removedColumn)) {
                    // no difference except the name, that's probably a renaming
                    $this->tableDiff->addRenamedColumn($removedColumn, $addedColumn);
                    $this->tableDiff->removeAddedColumn($addedColumnName);
                    $this->tableDiff->removeRemovedColumn($removedColumnName);
                    $columnDifferences--;
                    // skip to the next added column
                    break;
                }
            }
        }

        return $columnDifferences;
    }
public function compareColumns ( $ caseInsensitive = false ) { $ fromTableColumns = $ this -> getFromTable ( ) -> getColumns ( ) ; $ toTableColumns = $ this -> getToTable ( ) -> getColumns ( ) ; $ columnDifferences = 0 ; // check for new columns in $toTable foreach ( $ toTableColumns as $ column ) { if ( ! $ this -> getFromTable ( ) -> hasColumn ( $ column -> getName ( ) , $ caseInsensitive ) ) { $ this -> tableDiff -> addAddedColumn ( $ column -> getName ( ) , $ column ) ; $ columnDifferences ++ ; } } // check for removed columns in $toTable foreach ( $ fromTableColumns as $ column ) { if ( ! $ this -> getToTable ( ) -> hasColumn ( $ column -> getName ( ) , $ caseInsensitive ) ) { $ this -> tableDiff -> addRemovedColumn ( $ column -> getName ( ) , $ column ) ; $ columnDifferences ++ ; } } // check for column differences foreach ( $ fromTableColumns as $ fromColumn ) { if ( $ this -> getToTable ( ) -> hasColumn ( $ fromColumn -> getName ( ) , $ caseInsensitive ) ) { $ toColumn = $ this -> getToTable ( ) -> getColumn ( $ fromColumn -> getName ( ) , $ caseInsensitive ) ; $ columnDiff = PropelColumnComparator :: computeDiff ( $ fromColumn , $ toColumn ) ; if ( $ columnDiff ) { $ this -> tableDiff -> addModifiedColumn ( $ fromColumn -> getName ( ) , $ columnDiff ) ; $ columnDifferences ++ ; } } } // check for column renamings foreach ( $ this -> tableDiff -> getAddedColumns ( ) as $ addedColumnName => $ addedColumn ) { foreach ( $ this -> tableDiff -> getRemovedColumns ( ) as $ removedColumnName => $ removedColumn ) { if ( ! PropelColumnComparator :: computeDiff ( $ addedColumn , $ removedColumn ) ) { // no difference except the name, that's probably a renaming $ this -> tableDiff -> addRenamedColumn ( $ removedColumn , $ addedColumn ) ; $ this -> tableDiff -> removeAddedColumn ( $ addedColumnName ) ; $ this -> tableDiff -> removeRemovedColumn ( $ removedColumnName ) ; $ columnDifferences -- ; // skip to the next added column break ; } } } return $ columnDifferences ; }
Compare the columns of the fromTable and the toTable,
and modifies the inner tableDiff if necessary.
Returns the number of differences.

@param boolean $caseInsensitive Whether the comparison is case insensitive.
False by default.

@return integer The number of column differences
Compare the columns of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences .