public function comparePrimaryKeys($caseInsensitive = false)
    {
        $pkDifferences = 0;
        $fromTablePk = $this->getFromTable()->getPrimaryKey();
        $toTablePk = $this->getToTable()->getPrimaryKey();

        // check for new pk columns in $toTable
        foreach ($toTablePk as $column) {
            if (!$this->getFromTable()->hasColumn($column->getName(), $caseInsensitive) || !$this->getFromTable()->getColumn($column->getName(), $caseInsensitive)->isPrimaryKey()) {
                $this->tableDiff->addAddedPkColumn($column->getName(), $column);
                $pkDifferences++;
            }
        }

        // check for removed pk columns in $toTable
        foreach ($fromTablePk as $column) {
            if (!$this->getToTable()->hasColumn($column->getName(), $caseInsensitive) || !$this->getToTable()->getColumn($column->getName(), $caseInsensitive)->isPrimaryKey()) {
                $this->tableDiff->addRemovedPkColumn($column->getName(), $column);
                $pkDifferences++;
            }
        }

        // check for column renamings
        foreach ($this->tableDiff->getAddedPkColumns() as $addedColumnName => $addedColumn) {
            foreach ($this->tableDiff->getRemovedPkColumns() as $removedColumnName => $removedColumn) {
                if (!PropelColumnComparator::computeDiff($addedColumn, $removedColumn)) {
                    // no difference except the name, that's probably a renaming
                    $this->tableDiff->addRenamedPkColumn($removedColumn, $addedColumn);
                    $this->tableDiff->removeAddedPkColumn($addedColumnName);
                    $this->tableDiff->removeRemovedPkColumn($removedColumnName);
                    $pkDifferences--;
                    // skip to the next added column
                    break;
                }
            }
        }

        return $pkDifferences;
    }
public function comparePrimaryKeys($caseInsensitive = false)
    {
        $pkDifferences = 0;
        $fromTablePk = $this->getFromTable()->getPrimaryKey();
        $toTablePk = $this->getToTable()->getPrimaryKey();

        // check for new pk columns in $toTable
        foreach ($toTablePk as $column) {
            if (!$this->getFromTable()->hasColumn($column->getName(), $caseInsensitive) || !$this->getFromTable()->getColumn($column->getName(), $caseInsensitive)->isPrimaryKey()) {
                $this->tableDiff->addAddedPkColumn($column->getName(), $column);
                $pkDifferences++;
            }
        }

        // check for removed pk columns in $toTable
        foreach ($fromTablePk as $column) {
            if (!$this->getToTable()->hasColumn($column->getName(), $caseInsensitive) || !$this->getToTable()->getColumn($column->getName(), $caseInsensitive)->isPrimaryKey()) {
                $this->tableDiff->addRemovedPkColumn($column->getName(), $column);
                $pkDifferences++;
            }
        }

        // check for column renamings
        foreach ($this->tableDiff->getAddedPkColumns() as $addedColumnName => $addedColumn) {
            foreach ($this->tableDiff->getRemovedPkColumns() as $removedColumnName => $removedColumn) {
                if (!PropelColumnComparator::computeDiff($addedColumn, $removedColumn)) {
                    // no difference except the name, that's probably a renaming
                    $this->tableDiff->addRenamedPkColumn($removedColumn, $addedColumn);
                    $this->tableDiff->removeAddedPkColumn($addedColumnName);
                    $this->tableDiff->removeRemovedPkColumn($removedColumnName);
                    $pkDifferences--;
                    // skip to the next added column
                    break;
                }
            }
        }

        return $pkDifferences;
    }
public function comparePrimaryKeys ( $ caseInsensitive = false ) { $ pkDifferences = 0 ; $ fromTablePk = $ this -> getFromTable ( ) -> getPrimaryKey ( ) ; $ toTablePk = $ this -> getToTable ( ) -> getPrimaryKey ( ) ; // check for new pk columns in $toTable foreach ( $ toTablePk as $ column ) { if ( ! $ this -> getFromTable ( ) -> hasColumn ( $ column -> getName ( ) , $ caseInsensitive ) || ! $ this -> getFromTable ( ) -> getColumn ( $ column -> getName ( ) , $ caseInsensitive ) -> isPrimaryKey ( ) ) { $ this -> tableDiff -> addAddedPkColumn ( $ column -> getName ( ) , $ column ) ; $ pkDifferences ++ ; } } // check for removed pk columns in $toTable foreach ( $ fromTablePk as $ column ) { if ( ! $ this -> getToTable ( ) -> hasColumn ( $ column -> getName ( ) , $ caseInsensitive ) || ! $ this -> getToTable ( ) -> getColumn ( $ column -> getName ( ) , $ caseInsensitive ) -> isPrimaryKey ( ) ) { $ this -> tableDiff -> addRemovedPkColumn ( $ column -> getName ( ) , $ column ) ; $ pkDifferences ++ ; } } // check for column renamings foreach ( $ this -> tableDiff -> getAddedPkColumns ( ) as $ addedColumnName => $ addedColumn ) { foreach ( $ this -> tableDiff -> getRemovedPkColumns ( ) as $ removedColumnName => $ removedColumn ) { if ( ! PropelColumnComparator :: computeDiff ( $ addedColumn , $ removedColumn ) ) { // no difference except the name, that's probably a renaming $ this -> tableDiff -> addRenamedPkColumn ( $ removedColumn , $ addedColumn ) ; $ this -> tableDiff -> removeAddedPkColumn ( $ addedColumnName ) ; $ this -> tableDiff -> removeRemovedPkColumn ( $ removedColumnName ) ; $ pkDifferences -- ; // skip to the next added column break ; } } } return $ pkDifferences ; }
Compare the primary keys 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 primary key differences
Compare the primary keys of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences .