Contao\CoreBundle\Doctrine\Schema\DcaSchemaProvider::parseColumnSql PHP Метод

parseColumnSql() приватный Метод

Parses the column definition and adds it to the schema table.
private parseColumnSql ( Doctrine\DBAL\Schema\Table $table, string $columnName, string $sql )
$table Doctrine\DBAL\Schema\Table
$columnName string
$sql string
    private function parseColumnSql(Table $table, $columnName, $sql)
    {
        list($dbType, $def) = explode(' ', $sql, 2);
        $type = strtok(strtolower($dbType), '(), ');
        $length = strtok('(), ');
        $fixed = false;
        $scale = null;
        $precision = null;
        $default = null;
        $this->setLengthAndPrecisionByType($type, $dbType, $length, $scale, $precision, $fixed);
        $type = $this->container->get('database_connection')->getDatabasePlatform()->getDoctrineTypeMapping($type);
        $length = 0 === (int) $length ? null : (int) $length;
        if (preg_match('/default (\'[^\']*\'|\\d+)/', $def, $match)) {
            $default = trim($match[1], "'");
        }
        $options = ['length' => $length, 'unsigned' => false !== strpos($def, 'unsigned'), 'fixed' => $fixed, 'default' => $default, 'notnull' => false !== strpos($def, 'not null'), 'scale' => null, 'precision' => null, 'autoincrement' => false !== strpos($def, 'auto_increment'), 'comment' => null];
        if (null !== $scale && null !== $precision) {
            $options['scale'] = $scale;
            $options['precision'] = $precision;
        }
        $table->addColumn($columnName, $type, $options);
    }