本文整理匯總了PHP中Doctrine\DBAL\Schema\Table::getNamespaceName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Table::getNamespaceName方法的具體用法?PHP Table::getNamespaceName怎麽用?PHP Table::getNamespaceName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\DBAL\Schema\Table
的用法示例。
在下文中一共展示了Table::getNamespaceName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: _addTable
/**
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return void
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
protected function _addTable(Table $table)
{
$namespaceName = $table->getNamespaceName();
$tableName = $table->getFullQualifiedName($this->getName());
if (isset($this->_tables[$tableName])) {
throw SchemaException::tableAlreadyExists($tableName);
}
if (!$table->isInDefaultNamespace($this->getName()) && !$this->hasNamespace($namespaceName)) {
$this->createNamespace($namespaceName);
}
$this->_tables[$tableName] = $table;
$table->setSchemaConfig($this->_schemaConfig);
}