MediaWiki  master
DoctrineSchemaBuilder.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Wikimedia\Rdbms;
4 
5 use Doctrine\DBAL\Platforms\AbstractPlatform;
6 use Doctrine\DBAL\Schema\Schema;
7 
14 
15  private $schema;
16  private $platform;
17 
23  public function __construct( AbstractPlatform $platform ) {
24  $this->schema = new Schema();
25  $this->platform = $platform;
26  }
27 
31  public function addTable( array $schema ) {
32  $this->addTableToSchema( $this->schema, $schema );
33  }
34 
38  public function getSql() {
39  return $this->schema->toSql( $this->platform );
40  }
41 
42 }
Wikimedia\Rdbms\DoctrineSchemaBuilder\$schema
$schema
Definition: DoctrineSchemaBuilder.php:15
Wikimedia\Rdbms\DoctrineSchemaBuilder\getSql
getSql()
string[] SQLs to run
Definition: DoctrineSchemaBuilder.php:38
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\SchemaBuilder
Interface SchemaBuilder that gets a definition and produces SQL based on RDBMS.
Definition: SchemaBuilder.php:11
Wikimedia\Rdbms\DoctrineSchemaBuilder\$platform
$platform
Definition: DoctrineSchemaBuilder.php:16
Wikimedia\Rdbms\addTableToSchema
addTableToSchema(Schema $schema, array $schemaSpec)
Definition: DoctrineAbstractSchemaTrait.php:33
Wikimedia\Rdbms\DoctrineAbstractSchemaTrait
trait DoctrineAbstractSchemaTrait
Trait for schema spec of doctrine-based abstract schema.
Definition: DoctrineAbstractSchemaTrait.php:29
Wikimedia\Rdbms\DoctrineSchemaBuilder
@experimental
Definition: DoctrineSchemaBuilder.php:12
Wikimedia\Rdbms\DoctrineSchemaBuilder\__construct
__construct(AbstractPlatform $platform)
A builder object that take abstract schema definition and produces sql to create the tables.
Definition: DoctrineSchemaBuilder.php:23
Wikimedia\Rdbms\DoctrineSchemaBuilder\addTable
addTable(array $schema)
An example of $schema value: [ 'name' => 'actor', 'columns' => [ [ 'actor_id', 'bigint',...
Definition: DoctrineSchemaBuilder.php:31