Important: #102402 - Extended Doctrine DBAL Platform classes

See forge#102402

Description

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 the following inheritance chain:

<?php

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

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, for 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, for example:

<?php

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();
Copied!