‪TYPO3CMS  ‪main
CustomPlatformDriverDecorator.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
21 use Doctrine\DBAL\Platforms\AbstractPlatform;
22 use Doctrine\DBAL\Platforms\MariaDB1052Platform as DoctrineMariaDB1052Platform;
23 use Doctrine\DBAL\Platforms\MariaDB1060Platform as DoctrineMariaDB1060Platform;
24 use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform;
25 use Doctrine\DBAL\Platforms\MySQL80Platform as DoctrineMySQL80Platform;
26 use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform;
27 use Doctrine\DBAL\Platforms\PostgreSQLPlatform as DoctrinePostgreSQLPlatform;
28 use Doctrine\DBAL\Platforms\SQLitePlatform as DoctrineSQLitePlatform;
29 use Doctrine\DBAL\ServerVersionProvider;
30 use ‪TYPO3\CMS\Core\Database\Platform\MariaDB1052Platform as Typo3MariaDB1052Platform;
31 use ‪TYPO3\CMS\Core\Database\Platform\MariaDB1060Platform as Typo3MariaDB1060Platform;
32 use ‪TYPO3\CMS\Core\Database\Platform\MariaDBPlatform as Typo3MariaDBPlatform;
33 use ‪TYPO3\CMS\Core\Database\Platform\MySQL80Platform as Typo3MySQL80Platform;
35 use ‪TYPO3\CMS\Core\Database\Platform\PostgreSQLPlatform as Typo3PostgreSQLPlatform;
37 
41 final class ‪CustomPlatformDriverDecorator extends AbstractDriverMiddleware
42 {
43  public function ‪getDatabasePlatform(ServerVersionProvider $versionProvider): AbstractPlatform
44  {
45  return $this->‪elevatePlatform(parent::getDatabasePlatform($versionProvider));
46  }
47 
56  private function ‪elevatePlatform(AbstractPlatform $platform): AbstractPlatform
57  {
58  return match ($platform::class) {
59  DoctrineMySQLPlatform::class => new Typo3MySQLPlatform(),
60  DoctrineMySQL80Platform::class => new Typo3MySQL80Platform(),
61  DoctrineMariaDBPlatform::class => new Typo3MariaDBPlatform(),
62  DoctrineMariaDB1052Platform::class => new Typo3MariaDB1052Platform(),
63  DoctrineMariaDB1060Platform::class => new Typo3MariaDB1060Platform(),
64  DoctrineSQLitePlatform::class => new Typo3SQLitePlatform(),
65  DoctrinePostgreSQLPlatform::class => new Typo3PostgreSQLPlatform(),
66  default => $platform,
67  };
68  }
69 }
‪TYPO3\CMS\Core\Database\Driver\CustomPlatformDriverDecorator\getDatabasePlatform
‪getDatabasePlatform(ServerVersionProvider $versionProvider)
Definition: CustomPlatformDriverDecorator.php:43
‪TYPO3\CMS\Core\Database\Platform\MySQLPlatform
Definition: MySQLPlatform.php:36
‪TYPO3\CMS\Core\Database\Platform\SQLitePlatform
Definition: SQLitePlatform.php:31
‪TYPO3\CMS\Core\Database\Platform\PostgreSQLPlatform
Definition: PostgreSQLPlatform.php:31
‪TYPO3\CMS\Core\Database\Platform\MySQL80Platform
Definition: MySQL80Platform.php:33
‪TYPO3\CMS\Core\Database\Platform\MariaDBPlatform
Definition: MariaDBPlatform.php:34
‪TYPO3\CMS\Core\Database\Driver
Definition: CustomPdoResultDriverDecorator.php:18
‪TYPO3\CMS\Core\Database\Driver\CustomPlatformDriverDecorator
Definition: CustomPlatformDriverDecorator.php:42
‪TYPO3\CMS\Core\Database\Driver\CustomPlatformDriverDecorator\elevatePlatform
‪AbstractPlatform elevatePlatform(AbstractPlatform $platform)
Definition: CustomPlatformDriverDecorator.php:56
‪TYPO3\CMS\Core\Database\Platform\MariaDB1060Platform
Definition: MariaDB1060Platform.php:32
‪TYPO3\CMS\Core\Database\Platform\MariaDB1052Platform
Definition: MariaDB1052Platform.php:32