本文整理汇总了PHP中Doctrine\DBAL\Schema\Table::getShortestName方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::getShortestName方法的具体用法?PHP Table::getShortestName怎么用?PHP Table::getShortestName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Table
的用法示例。
在下文中一共展示了Table::getShortestName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAutoIncrementsFor
/**
* Checks if this sequence is an autoincrement sequence for a given table.
*
* This is used inside the comparator to not report sequences as missing,
* when the "from" schema implicitly creates the sequences.
*
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return boolean
*/
public function isAutoIncrementsFor(Table $table)
{
if (!$table->hasPrimaryKey()) {
return false;
}
$pkColumns = $table->getPrimaryKey()->getColumns();
if (count($pkColumns) != 1) {
return false;
}
$column = $table->getColumn($pkColumns[0]);
if (!$column->getAutoincrement()) {
return false;
}
$sequenceName = $this->getShortestName($table->getNamespaceName());
$tableName = $table->getShortestName($table->getNamespaceName());
$tableSequenceName = sprintf('%s_%s_seq', $tableName, $pkColumns[0]);
return $tableSequenceName === $sequenceName;
}