本文整理汇总了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableTableColumnList方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractSchemaManager::_getPortableTableColumnList方法的具体用法?PHP AbstractSchemaManager::_getPortableTableColumnList怎么用?PHP AbstractSchemaManager::_getPortableTableColumnList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\AbstractSchemaManager
的用法示例。
在下文中一共展示了AbstractSchemaManager::_getPortableTableColumnList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getPortableTableColumnList
/**
* {@inheritdoc}
*/
protected function _getPortableTableColumnList($table, $database, $tableColumns)
{
$list = parent::_getPortableTableColumnList($table, $database, $tableColumns);
// find column with autoincrement
$autoincrementColumn = null;
$autoincrementCount = 0;
foreach ($tableColumns as $tableColumn) {
if ('0' != $tableColumn['pk']) {
$autoincrementCount++;
if (null === $autoincrementColumn && 'integer' == strtolower($tableColumn['type'])) {
$autoincrementColumn = $tableColumn['name'];
}
}
}
if (1 == $autoincrementCount && null !== $autoincrementColumn) {
foreach ($list as $column) {
if ($autoincrementColumn == $column->getName()) {
$column->setAutoincrement(true);
}
}
}
// inspect column collation
$createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '{$table}'");
$createSql = isset($createSql[0]['sql']) ? $createSql[0]['sql'] : '';
foreach ($list as $columnName => $column) {
$type = $column->getType();
if ($type instanceof StringType || $type instanceof TextType) {
$column->setPlatformOption('collation', $this->parseColumnCollationFromSQL($columnName, $createSql) ?: 'BINARY');
}
}
return $list;
}
示例2: _getPortableTableColumnList
/**
* {@inheritdoc}
*/
protected function _getPortableTableColumnList($table, $database, $tableColumns)
{
$list = parent::_getPortableTableColumnList($table, $database, $tableColumns);
$autoincrementColumn = null;
$autoincrementCount = 0;
foreach ($tableColumns as $tableColumn) {
if ('0' != $tableColumn['pk']) {
$autoincrementCount++;
if (null === $autoincrementColumn && 'integer' == strtolower($tableColumn['type'])) {
$autoincrementColumn = $tableColumn['name'];
}
}
}
if (1 == $autoincrementCount && null !== $autoincrementColumn) {
foreach ($list as $column) {
if ($autoincrementColumn == $column->getName()) {
$column->setAutoincrement(true);
}
}
}
return $list;
}