/** * {@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; }