lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
    {
        $sql = '';
        if (strlen($foreignKey->getName())) {
            $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
        }
        $sql .= 'FOREIGN KEY (';

        if (count($foreignKey->getLocalColumns()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'local' required.");
        }
        if (count($foreignKey->getForeignColumns()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'foreign' required.");
        }
        if (strlen($foreignKey->getForeignTableName()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
        }

        return $sql . implode(', ', $foreignKey->getQuotedLocalColumns($this))
            . ') REFERENCES '
            . $foreignKey->getQuotedForeignTableName($this) . ' ('
            . implode(', ', $foreignKey->getQuotedForeignColumns($this)) . ')';
    }
public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
    {
        $sql = '';
        if (strlen($foreignKey->getName())) {
            $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
        }
        $sql .= 'FOREIGN KEY (';

        if (count($foreignKey->getLocalColumns()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'local' required.");
        }
        if (count($foreignKey->getForeignColumns()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'foreign' required.");
        }
        if (strlen($foreignKey->getForeignTableName()) === 0) {
            throw new InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
        }

        return $sql . implode(', ', $foreignKey->getQuotedLocalColumns($this))
            . ') REFERENCES '
            . $foreignKey->getQuotedForeignTableName($this) . ' ('
            . implode(', ', $foreignKey->getQuotedForeignColumns($this)) . ')';
    }
public function getForeignKeyBaseDeclarationSQL ( ForeignKeyConstraint $ foreignKey ) { $ sql = '' ; if ( strlen ( $ foreignKey -> getName ( ) ) ) { $ sql .= 'CONSTRAINT ' . $ foreignKey -> getQuotedName ( $ this ) . ' ' ; } $ sql .= 'FOREIGN KEY (' ; if ( count ( $ foreignKey -> getLocalColumns ( ) ) === 0 ) { throw new InvalidArgumentException ( "Incomplete definition. 'local' required." ) ; } if ( count ( $ foreignKey -> getForeignColumns ( ) ) === 0 ) { throw new InvalidArgumentException ( "Incomplete definition. 'foreign' required." ) ; } if ( strlen ( $ foreignKey -> getForeignTableName ( ) ) === 0 ) { throw new InvalidArgumentException ( "Incomplete definition. 'foreignTable' required." ) ; } return $ sql . implode ( ', ' , $ foreignKey -> getQuotedLocalColumns ( $ this ) ) . ') REFERENCES ' . $ foreignKey -> getQuotedForeignTableName ( $ this ) . ' (' . implode ( ', ' , $ foreignKey -> getQuotedForeignColumns ( $ this ) ) . ')' ; }
Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
of a field declaration to be used in statements like CREATE TABLE.

@return string

@throws InvalidArgumentException
Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE .