Important: #102402 - Extended Doctrine DBAL Platform classes

See forge#102402


The core needs to adapt some internal classes to prepare towards doctrine/dbal major version 4.x. The doctrine team deprecated especially the doctrine event manager, the core used to populate custom adaptions.

The proposed way to mitigate the old events is to extend classes and integrate custom handling code directly. TYPO3 thus extends a couple of classes and replaces them using a factory.

Affected code is marked @internal. Extension author must not rely on the TYPO3 class names for instanceof checks and should check using the original doctrine classes instead.

For example, doctrine/dbal has following inheritance chain:


class MySQL80Platform extends MySQL57Platform {}
class MySQL57Platform extends MySQLPlatform {}
class MySQLPlatform extends AbstractMySQLPlatform {}
class AbstractMySQLPlatform extends AbstractPlatform {}

TYPO3 now extends the concrete platform classes:

  • \TYPO3\CMS\Core\Database\Platform\MySQL80Platform extends \Doctrine\DBAL\Platforms\MySQL80Platform

  • \TYPO3\CMS\Core\Database\Platform\MySQL57Platform extends \Doctrine\DBAL\Platforms\MySQL57Platform

  • \TYPO3\CMS\Core\Database\Platform\MySQLPlatform extends \Doctrine\DBAL\Platforms\MySQLPlatform

The TYPO3 core classes are only used as top layer, example:

  1. \TYPO3\CMS\Core\Database\Platform\MySQL80Platform extends \Doctrine\DBAL\Platforms\MySQL80Platform

  2. \Doctrine\DBAL\Platforms\MySQL80Platform extends \Doctrine\DBAL\Platforms\MySQL57Platform

  3. \Doctrine\DBAL\Platforms\MySQL57Platform extends \Doctrine\DBAL\Platforms\MySQLPlatform

  4. \Doctrine\DBAL\Platforms\MySQLPlatform extends \Doctrine\DBAL\Platforms\AbstractMySQLPlatform

  5. \Doctrine\DBAL\Platforms\AbstractMySQLPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform

Custom extension code that needs to implement instanceof checks for specific platforms should use the doctrine classes and not the TYPO3 core classes, example:


use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform;
use TYPO3\CMS\Core\Database\Platform\MySQL80Platform as Typo3MySQL80Platform;

// Usually incoming from elsewhere, eg. DI.
$platform = new Typo3MySQL80Platform();

$check = $platform instanceof DoctrineMySQLPlatform();