本文整理汇总了PHP中Doctrine\DBAL\Schema\ForeignKeyConstraint::getForeignTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKeyConstraint::getForeignTableName方法的具体用法?PHP ForeignKeyConstraint::getForeignTableName怎么用?PHP ForeignKeyConstraint::getForeignTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\ForeignKeyConstraint
的用法示例。
在下文中一共展示了ForeignKeyConstraint::getForeignTableName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: acceptForeignKey
/**
* {@inheritdoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
// The table may already be deleted in a previous
// RemoveNamespacedAssets#acceptTable call. Removing Foreign keys that
// point to nowhere.
if (!$this->schema->hasTable($fkConstraint->getForeignTableName())) {
$localTable->removeForeignKey($fkConstraint->getName());
return;
}
$foreignTable = $this->schema->getTable($fkConstraint->getForeignTableName());
if (!$foreignTable->isInDefaultNamespace($this->schema->getName())) {
$localTable->removeForeignKey($fkConstraint->getName());
}
}
示例2: acceptForeignKey
/**
* {@inheritdoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
$this->output .= $this->createNodeRelation($fkConstraint->getLocalTableName() . ":col" . current($fkConstraint->getLocalColumns()) . ":se", $fkConstraint->getForeignTableName() . ":col" . current($fkConstraint->getForeignColumns()) . ":se", array('dir' => 'back', 'arrowtail' => 'dot', 'arrowhead' => 'normal'));
}
示例3: getForeignKeyBaseDeclarationSQL
/**
* Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a field declaration to be used in statements like CREATE TABLE.
*
* @param ForeignKeyConstraint $foreignKey
* @return string
*/
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.");
}
$sql .= implode(', ', $foreignKey->getLocalColumns()) . ') REFERENCES ' . $foreignKey->getForeignTableName() . ' (' . implode(', ', $foreignKey->getForeignColumns()) . ')';
return $sql;
}
示例4: addForeignKeysMessage
/**
* Add a message for a foreign key change.
*
* @param string $tableName
* @param ForeignKeyConstraint $index
* @param string $format
*/
private function addForeignKeysMessage($tableName, ForeignKeyConstraint $foreignKey, $format)
{
$this->addMessage($tableName, sprintf($format, implode(', ', $foreignKey->getUnquotedLocalColumns()), $foreignKey->getForeignTableName(), implode(', ' . $foreignKey->getForeignTableName() . '.', $foreignKey->getUnquotedForeignColumns())));
}
示例5: getForeignKeyDeclarationSQL
/**
* {@inheritDoc}
*/
public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
{
return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint($foreignKey->getLocalColumns(), str_replace('.', '__', $foreignKey->getForeignTableName()), $foreignKey->getForeignColumns(), $foreignKey->getName(), $foreignKey->getOptions()));
}
示例6: createForeignKeyReplacement
/**
* Creates a foreign index replacement, which has quoted column names.
*
* @param ForeignKeyConstraint $fk
*
* @return ForeignKeyConstraint
*/
private function createForeignKeyReplacement(ForeignKeyConstraint $fk)
{
return new ForeignKeyConstraint($this->quoteIdentifiers($fk->getLocalColumns()), $this->platform->quoteIdentifier($fk->getForeignTableName()), $this->quoteIdentifiers($fk->getForeignColumns()), $this->platform->quoteIdentifier($fk->getName()), $fk->getOptions());
}
示例7: acceptForeignKey
/**
* Accept a foreign key for a table
*
* @param Table $localTable a table object
* @param ForeignKeyConstraint $fkConstraint a constraint object
*
* @return void
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
if (!isset($this->schemaArray['tables'][$localTable->getName()]['constraint'])) {
$this->schemaArray['tables'][$localTable->getName()]['constraint'] = array();
}
$this->schemaArray['tables'][$localTable->getName()]['constraint'][] = array('name' => $fkConstraint->getName(), 'localcolumns' => $fkConstraint->getLocalColumns(), 'foreigntable' => $fkConstraint->getForeignTableName(), 'foreigncolumns' => $fkConstraint->getForeignColumns(), 'options' => $fkConstraint->getOptions());
}