public function isForeignPrimaryKey()
    {
        $foreignTable = $this->getForeignTable();

        $foreignPKCols = [];
        foreach ($foreignTable->getPrimaryKey() as $fPKCol) {
            $foreignPKCols[] = $fPKCol->getName();
        }

        $foreignCols = [];
        foreach ($this->localColumns as $idx => $colName) {
            if ($this->foreignColumns[$idx]) {
                $foreignCols[] = $foreignTable->getColumn($this->foreignColumns[$idx])->getName();
            }
        }

        return ((count($foreignPKCols) === count($foreignCols))
            && !array_diff($foreignPKCols, $foreignCols));
    }
public function isForeignPrimaryKey()
    {
        $foreignTable = $this->getForeignTable();

        $foreignPKCols = [];
        foreach ($foreignTable->getPrimaryKey() as $fPKCol) {
            $foreignPKCols[] = $fPKCol->getName();
        }

        $foreignCols = [];
        foreach ($this->localColumns as $idx => $colName) {
            if ($this->foreignColumns[$idx]) {
                $foreignCols[] = $foreignTable->getColumn($this->foreignColumns[$idx])->getName();
            }
        }

        return ((count($foreignPKCols) === count($foreignCols))
            && !array_diff($foreignPKCols, $foreignCols));
    }
public function isForeignPrimaryKey ( ) { $ foreignTable = $ this -> getForeignTable ( ) ; $ foreignPKCols = [ ] ; foreach ( $ foreignTable -> getPrimaryKey ( ) as $ fPKCol ) { $ foreignPKCols [ ] = $ fPKCol -> getName ( ) ; } $ foreignCols = [ ] ; foreach ( $ this -> localColumns as $ idx => $ colName ) { if ( $ this -> foreignColumns [ $ idx ] ) { $ foreignCols [ ] = $ foreignTable -> getColumn ( $ this -> foreignColumns [ $ idx ] ) -> getName ( ) ; } } return ( ( count ( $ foreignPKCols ) === count ( $ foreignCols ) ) && ! array_diff ( $ foreignPKCols , $ foreignCols ) ) ; }
Returns whether this foreign key is also the primary key of the foreign
table.

@return boolean Returns true if all columns inside this foreign key are primary keys of the foreign table
Returns whether this foreign key is also the primary key of the foreign table .