MediaWiki  master
DoctrineSchemaBuilderFactory.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Wikimedia\Rdbms;
4 
5 use Doctrine\DBAL\Platforms\MySqlPlatform;
6 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
7 use Doctrine\DBAL\Platforms\SqlitePlatform;
8 use InvalidArgumentException;
9 
15 
20  public function getSchemaBuilder( $platform ) {
21  if ( $platform === 'mysql' ) {
22  $platformObject = new MySqlPlatform();
23  } elseif ( $platform === 'postgres' ) {
24  $platformObject = new PostgreSqlPlatform();
25  } elseif ( $platform === 'sqlite' ) {
26  $platformObject = new SqlitePlatform();
27  } else {
28  throw new InvalidArgumentException( 'Unknown platform: ' . $platform );
29  }
30 
31  return new DoctrineSchemaBuilder( $platformObject );
32  }
33 }
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\DoctrineSchemaBuilder
@experimental @unstable
Definition: DoctrineSchemaBuilder.php:12
Wikimedia\Rdbms\DoctrineSchemaBuilderFactory
@experimental @unstable
Definition: DoctrineSchemaBuilderFactory.php:14
Wikimedia\Rdbms\DoctrineSchemaBuilderFactory\getSchemaBuilder
getSchemaBuilder( $platform)
Definition: DoctrineSchemaBuilderFactory.php:20