Debian Codegraph @

includes/libs/rdbms/dbal/DoctrineSchemaBuilder.php

raw symbols SCIP
1 <?php
2
3 namespace Wikimedia\Rdbms;
4
5 use Doctrine\DBAL\Platforms\AbstractPlatform;
6 use Doctrine\DBAL\Schema\Schema;
7
8 /**
9 * @experimental
10 * @unstable
11 */
12 class DoctrineSchemaBuilder implements SchemaBuilder {
13 use DoctrineAbstractSchemaTrait;
14
15 private Schema $schema;
16 private AbstractPlatform $platform;
17
18 /**
19 * A builder object that take abstract schema definition and produces sql to create the tables.
20 *
21 * @param AbstractPlatform $platform A Doctrine Platform object, Can be Mysql, Sqlite, etc.
22 */
23 public function __construct( AbstractPlatform $platform ) {
24 $this->schema = new Schema();
25 $this->platform = $platform;
26 }
27
28 /**
29 * @inheritDoc
30 */
31 public function addTable( array $schema ) {
32 $this->addTableToSchema( $this->schema, $schema );
33 }
34
35 /**
36 * @inheritDoc
37 */
38 public function getSql() {
39 return $this->schema->toSql( $this->platform );
40 }
41
42 }