示例#1
0
 /**
  * @param \Doctrine\DBAL\Schema\Column $column The name of the table.
  * @param array $primaries
  *
  * @return array The column data as associative array.
  */
 public function prepareColumnData($column, $primaries = array())
 {
     $columnData = array();
     $columnData['name'] = $column->getQuotedName($this);
     $columnData['type'] = $column->getType();
     $columnData['length'] = $column->getLength();
     $columnData['notnull'] = $column->getNotNull();
     $columnData['fixed'] = $column->getFixed();
     $columnData['unique'] = false;
     // TODO: what do we do about this?
     $columnData['version'] = $column->hasPlatformOption("version") ? $column->getPlatformOption('version') : false;
     if (strtolower($columnData['type']) == "string" && $columnData['length'] === null) {
         $columnData['length'] = 255;
     }
     $columnData['unsigned'] = $column->getUnsigned();
     $columnData['precision'] = $column->getPrecision();
     $columnData['scale'] = $column->getScale();
     $columnData['default'] = $column->getDefault();
     $columnData['columnDefinition'] = $column->getColumnDefinition();
     $columnData['autoincrement'] = $column->getAutoincrement();
     $columnData['comment'] = $this->getColumnComment($column);
     $columnData['platformOptions'] = $column->getPlatformOptions();
     if (in_array($column->getName(), $primaries)) {
         $columnData['primary'] = true;
     }
     return $columnData;
 }