lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
    {
        $columnListSql = $this->getColumnDeclarationListSQL($columns);

        if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
            foreach ($options['uniqueConstraints'] as $name => $definition) {
                $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
            }
        }

        if (isset($options['primary']) && ! empty($options['primary'])) {
            $columnListSql .= ', PRIMARY KEY(' . implode(', ', array_unique(array_values($options['primary']))) . ')';
        }

        if (isset($options['indexes']) && ! empty($options['indexes'])) {
            foreach ($options['indexes'] as $index => $definition) {
                $columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
            }
        }

        $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;

        $check = $this->getCheckDeclarationSQL($columns);
        if (! empty($check)) {
            $query .= ', ' . $check;
        }
        $query .= ')';

        $sql[] = $query;

        if (isset($options['foreignKeys'])) {
            foreach ((array) $options['foreignKeys'] as $definition) {
                $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
            }
        }

        return $sql;
    }
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
    {
        $columnListSql = $this->getColumnDeclarationListSQL($columns);

        if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
            foreach ($options['uniqueConstraints'] as $name => $definition) {
                $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
            }
        }

        if (isset($options['primary']) && ! empty($options['primary'])) {
            $columnListSql .= ', PRIMARY KEY(' . implode(', ', array_unique(array_values($options['primary']))) . ')';
        }

        if (isset($options['indexes']) && ! empty($options['indexes'])) {
            foreach ($options['indexes'] as $index => $definition) {
                $columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
            }
        }

        $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;

        $check = $this->getCheckDeclarationSQL($columns);
        if (! empty($check)) {
            $query .= ', ' . $check;
        }
        $query .= ')';

        $sql[] = $query;

        if (isset($options['foreignKeys'])) {
            foreach ((array) $options['foreignKeys'] as $definition) {
                $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
            }
        }

        return $sql;
    }
protected function _getCreateTableSQL ( $ tableName , array $ columns , array $ options = [ ] ) { $ columnListSql = $ this -> getColumnDeclarationListSQL ( $ columns ) ; if ( isset ( $ options [ 'uniqueConstraints' ] ) && ! empty ( $ options [ 'uniqueConstraints' ] ) ) { foreach ( $ options [ 'uniqueConstraints' ] as $ name => $ definition ) { $ columnListSql .= ', ' . $ this -> getUniqueConstraintDeclarationSQL ( $ name , $ definition ) ; } } if ( isset ( $ options [ 'primary' ] ) && ! empty ( $ options [ 'primary' ] ) ) { $ columnListSql .= ', PRIMARY KEY(' . implode ( ', ' , array_unique ( array_values ( $ options [ 'primary' ] ) ) ) . ')' ; } if ( isset ( $ options [ 'indexes' ] ) && ! empty ( $ options [ 'indexes' ] ) ) { foreach ( $ options [ 'indexes' ] as $ index => $ definition ) { $ columnListSql .= ', ' . $ this -> getIndexDeclarationSQL ( $ index , $ definition ) ; } } $ query = 'CREATE TABLE ' . $ tableName . ' (' . $ columnListSql ; $ check = $ this -> getCheckDeclarationSQL ( $ columns ) ; if ( ! empty ( $ check ) ) { $ query .= ', ' . $ check ; } $ query .= ')' ; $ sql [ ] = $ query ; if ( isset ( $ options [ 'foreignKeys' ] ) ) { foreach ( ( array ) $ options [ 'foreignKeys' ] as $ definition ) { $ sql [ ] = $ this -> getCreateForeignKeySQL ( $ definition , $ tableName ) ; } } return $ sql ; }
Returns the SQL used to create a table.

@param string    $tableName
@param mixed[][] $columns
@param mixed[]   $options

@return string[]
Returns the SQL used to create a table .