public function createTable(
        $name,
        array $columns = array(),
        array $primaryKey = array(),
        array $foreignKeys = array(),
        array $indexes = array(),
        array $checks = array()
    ) {
        $table = new Table($name);

        foreach ($columns as $column) {
            if (!isset($column['options'])) {
                $column['options'] = array();
            }

            $table->createColumn($column['name'], $column['type'], $column['options']);
        }

        if (!empty($primaryKey)) {
            if (!isset($primaryKey['name'])) {
                $primaryKey['name'] = null;
            }

            $table->createPrimaryKey($primaryKey['columns'], $primaryKey['name']);
        }

        foreach ($foreignKeys as $foreignKey) {
            if (!isset($foreignKey['name'])) {
                $foreignKey['name'] = null;
            }

            if (!isset($foreignKey['on_delete'])) {
                $foreignKey['on_delete'] = ForeignKey::RESTRICT;
            }

            if (!isset($foreignKey['on_update'])) {
                $foreignKey['on_update'] = ForeignKey::RESTRICT;
            }

            $table->createForeignKey(
                $foreignKey['local_columns'],
                $foreignKey['foreign_table'],
                $foreignKey['foreign_columns'],
                $foreignKey['on_delete'],
                $foreignKey['on_update'],
                $foreignKey['name']
            );
        }

        foreach ($indexes as $index) {
            if (!isset($index['name'])) {
                $index['name'] = null;
            }

            if (!isset($index['unique'])) {
                $index['unique'] = false;
            }

            $table->createIndex($index['columns'], $index['unique'], $index['name']);
        }

        foreach ($checks as $check) {
            if (!isset($check['name'])) {
                $check['name'] = null;
            }

            $table->createCheck($check['definition'], $check['name']);
        }

        $this->addTable($table);

        return $table;
    }
public function createTable(
        $name,
        array $columns = array(),
        array $primaryKey = array(),
        array $foreignKeys = array(),
        array $indexes = array(),
        array $checks = array()
    ) {
        $table = new Table($name);

        foreach ($columns as $column) {
            if (!isset($column['options'])) {
                $column['options'] = array();
            }

            $table->createColumn($column['name'], $column['type'], $column['options']);
        }

        if (!empty($primaryKey)) {
            if (!isset($primaryKey['name'])) {
                $primaryKey['name'] = null;
            }

            $table->createPrimaryKey($primaryKey['columns'], $primaryKey['name']);
        }

        foreach ($foreignKeys as $foreignKey) {
            if (!isset($foreignKey['name'])) {
                $foreignKey['name'] = null;
            }

            if (!isset($foreignKey['on_delete'])) {
                $foreignKey['on_delete'] = ForeignKey::RESTRICT;
            }

            if (!isset($foreignKey['on_update'])) {
                $foreignKey['on_update'] = ForeignKey::RESTRICT;
            }

            $table->createForeignKey(
                $foreignKey['local_columns'],
                $foreignKey['foreign_table'],
                $foreignKey['foreign_columns'],
                $foreignKey['on_delete'],
                $foreignKey['on_update'],
                $foreignKey['name']
            );
        }

        foreach ($indexes as $index) {
            if (!isset($index['name'])) {
                $index['name'] = null;
            }

            if (!isset($index['unique'])) {
                $index['unique'] = false;
            }

            $table->createIndex($index['columns'], $index['unique'], $index['name']);
        }

        foreach ($checks as $check) {
            if (!isset($check['name'])) {
                $check['name'] = null;
            }

            $table->createCheck($check['definition'], $check['name']);
        }

        $this->addTable($table);

        return $table;
    }
public function createTable ( $ name , array $ columns = array ( ) , array $ primaryKey = array ( ) , array $ foreignKeys = array ( ) , array $ indexes = array ( ) , array $ checks = array ( ) ) { $ table = new Table ( $ name ) ; foreach ( $ columns as $ column ) { if ( ! isset ( $ column [ 'options' ] ) ) { $ column [ 'options' ] = array ( ) ; } $ table -> createColumn ( $ column [ 'name' ] , $ column [ 'type' ] , $ column [ 'options' ] ) ; } if ( ! empty ( $ primaryKey ) ) { if ( ! isset ( $ primaryKey [ 'name' ] ) ) { $ primaryKey [ 'name' ] = null ; } $ table -> createPrimaryKey ( $ primaryKey [ 'columns' ] , $ primaryKey [ 'name' ] ) ; } foreach ( $ foreignKeys as $ foreignKey ) { if ( ! isset ( $ foreignKey [ 'name' ] ) ) { $ foreignKey [ 'name' ] = null ; } if ( ! isset ( $ foreignKey [ 'on_delete' ] ) ) { $ foreignKey [ 'on_delete' ] = ForeignKey :: RESTRICT ; } if ( ! isset ( $ foreignKey [ 'on_update' ] ) ) { $ foreignKey [ 'on_update' ] = ForeignKey :: RESTRICT ; } $ table -> createForeignKey ( $ foreignKey [ 'local_columns' ] , $ foreignKey [ 'foreign_table' ] , $ foreignKey [ 'foreign_columns' ] , $ foreignKey [ 'on_delete' ] , $ foreignKey [ 'on_update' ] , $ foreignKey [ 'name' ] ) ; } foreach ( $ indexes as $ index ) { if ( ! isset ( $ index [ 'name' ] ) ) { $ index [ 'name' ] = null ; } if ( ! isset ( $ index [ 'unique' ] ) ) { $ index [ 'unique' ] = false ; } $ table -> createIndex ( $ index [ 'columns' ] , $ index [ 'unique' ] , $ index [ 'name' ] ) ; } foreach ( $ checks as $ check ) { if ( ! isset ( $ check [ 'name' ] ) ) { $ check [ 'name' ] = null ; } $ table -> createCheck ( $ check [ 'definition' ] , $ check [ 'name' ] ) ; } $ this -> addTable ( $ table ) ; return $ table ; }
Creates and adds a new table.

@param string $name        The table name.
@param array  $columns     The table columns.
@param array  $primaryKey  The table primary key.
@param array  $foreignKeys The table foreign keys.
@param array  $indexes     The table indexes.
@param array  $checks      The table checks.

@return \Fridge\DBAL\Schema\Table The new table.
Creates and adds a new table .