src/Phinx/Db/Adapter/SQLiteAdapter.php
protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
    {
        $def = '';
        if ($foreignKey->getConstraint()) {
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
        } else {
            $columnNames = [];
            foreach ($foreignKey->getColumns() as $column) {
                $columnNames[] = $this->quoteColumnName($column);
            }
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
            $refColumnNames = [];
            foreach ($foreignKey->getReferencedColumns() as $column) {
                $refColumnNames[] = $this->quoteColumnName($column);
            }
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
            if ($foreignKey->getOnDelete()) {
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
            }
            if ($foreignKey->getOnUpdate()) {
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
            }
        }

        return $def;
    }
protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
    {
        $def = '';
        if ($foreignKey->getConstraint()) {
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
        } else {
            $columnNames = [];
            foreach ($foreignKey->getColumns() as $column) {
                $columnNames[] = $this->quoteColumnName($column);
            }
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
            $refColumnNames = [];
            foreach ($foreignKey->getReferencedColumns() as $column) {
                $refColumnNames[] = $this->quoteColumnName($column);
            }
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
            if ($foreignKey->getOnDelete()) {
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
            }
            if ($foreignKey->getOnUpdate()) {
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
            }
        }

        return $def;
    }
protected function getForeignKeySqlDefinition ( ForeignKey $ foreignKey ) { $ def = '' ; if ( $ foreignKey -> getConstraint ( ) ) { $ def .= ' CONSTRAINT ' . $ this -> quoteColumnName ( $ foreignKey -> getConstraint ( ) ) ; } else { $ columnNames = [ ] ; foreach ( $ foreignKey -> getColumns ( ) as $ column ) { $ columnNames [ ] = $ this -> quoteColumnName ( $ column ) ; } $ def .= ' FOREIGN KEY (' . implode ( ',' , $ columnNames ) . ')' ; $ refColumnNames = [ ] ; foreach ( $ foreignKey -> getReferencedColumns ( ) as $ column ) { $ refColumnNames [ ] = $ this -> quoteColumnName ( $ column ) ; } $ def .= ' REFERENCES ' . $ this -> quoteTableName ( $ foreignKey -> getReferencedTable ( ) -> getName ( ) ) . ' (' . implode ( ',' , $ refColumnNames ) . ')' ; if ( $ foreignKey -> getOnDelete ( ) ) { $ def .= ' ON DELETE ' . $ foreignKey -> getOnDelete ( ) ; } if ( $ foreignKey -> getOnUpdate ( ) ) { $ def .= ' ON UPDATE ' . $ foreignKey -> getOnUpdate ( ) ; } } return $ def ; }
Gets the SQLite Foreign Key Definition for an ForeignKey object.

@param \Phinx\Db\Table\ForeignKey $foreignKey
@return string
Gets the SQLite Foreign Key Definition for an ForeignKey object .