5 use Doctrine\DBAL\Platforms\AbstractPlatform;
6 use Doctrine\DBAL\Platforms\SqlitePlatform;
7 use Doctrine\DBAL\Types\Type;
8 use InvalidArgumentException;
37 if ( $platform ===
'mysql' ) {
44 if ( class_exists( \Doctrine\DBAL\Platforms\MySqlPlatform::class ) ) {
45 $platformObject = new \Doctrine\DBAL\Platforms\MySqlPlatform();
47 $platformObject = new \Doctrine\DBAL\Platforms\MySQLPlatform();
49 } elseif ( $platform ===
'postgres' ) {
51 } elseif ( $platform ===
'sqlite' ) {
52 $platformObject =
new SqlitePlatform();
54 throw new InvalidArgumentException(
'Unknown platform: ' . $platform );
63 foreach ( $customTypes as
$type => [ $class, $name ] ) {
64 if ( !Type::hasType( $name ) ) {
65 Type::addType( $name, $class );
67 $platformObject->registerDoctrineTypeMapping(
$type, $name );
70 return $platformObject;