本文整理汇总了PHP中Doctrine\DBAL\Schema\Column::setPlatformOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::setPlatformOptions方法的具体用法?PHP Column::setPlatformOptions怎么用?PHP Column::setPlatformOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Column
的用法示例。
在下文中一共展示了Column::setPlatformOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getPortableTableColumnDefinition
/**
* {@inheritdoc}
*/
protected function _getPortableTableColumnDefinition($tableColumn)
{
$dbType = strtok($tableColumn['type'], '(), ');
$fixed = null;
$length = (int) $tableColumn['length'];
$default = $tableColumn['default'];
if (!isset($tableColumn['name'])) {
$tableColumn['name'] = '';
}
while ($default != ($default2 = preg_replace("/^\\((.*)\\)\$/", '$1', $default))) {
$default = trim($default2, "'");
if ($default == 'getdate()') {
$default = $this->_platform->getCurrentTimestampSQL();
}
}
switch ($dbType) {
case 'nchar':
case 'nvarchar':
case 'ntext':
// Unicode data requires 2 bytes per character
$length = $length / 2;
break;
case 'varchar':
// TEXT type is returned as VARCHAR(MAX) with a length of -1
if ($length == -1) {
$dbType = 'text';
}
break;
}
$type = $this->_platform->getDoctrineTypeMapping($dbType);
switch ($type) {
case 'char':
$fixed = true;
break;
case 'text':
$fixed = false;
break;
}
$options = array('length' => $length == 0 || !in_array($type, array('text', 'string')) ? null : $length, 'unsigned' => false, 'fixed' => (bool) $fixed, 'default' => $default !== 'NULL' ? $default : null, 'notnull' => (bool) $tableColumn['notnull'], 'scale' => $tableColumn['scale'], 'precision' => $tableColumn['precision'], 'autoincrement' => (bool) $tableColumn['autoincrement']);
$platformOptions = array('collate' => $tableColumn['collation'] == 'NULL' ? null : $tableColumn['collation']);
$column = new Column($tableColumn['name'], Type::getType($type), $options);
$column->setPlatformOptions($platformOptions);
return $column;
}