diff --git a/CHANGELOG.md b/CHANGELOG.md index 594bf72d2..a814c1fcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ a release. --- ## [Unreleased] +### Fixed +- Fix regression with `doctrine/dbal` >= 4.0 that caused MariaDB to improperly attempt LONGTEXT casting in `TranslationWalker` (issue #2887) ## [3.17.1] - 2024-10-07 ### Fixed diff --git a/src/Translatable/Query/TreeWalker/TranslationWalker.php b/src/Translatable/Query/TreeWalker/TranslationWalker.php index 2c5be1564..4801ad4d1 100644 --- a/src/Translatable/Query/TreeWalker/TranslationWalker.php +++ b/src/Translatable/Query/TreeWalker/TranslationWalker.php @@ -10,8 +10,8 @@ namespace Gedmo\Translatable\Query\TreeWalker; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform; -use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadata; @@ -308,9 +308,9 @@ private function prepareTranslatedComponents(): void // Treat translation as original field type $fieldMapping = $meta->getFieldMapping($field); - if ((($this->platform instanceof MySQLPlatform) + if ((($this->platform instanceof AbstractMySQLPlatform) && in_array($fieldMapping['type'], ['decimal'], true)) - || (!($this->platform instanceof MySQLPlatform) + || (!($this->platform instanceof AbstractMySQLPlatform) && !in_array($fieldMapping['type'], ['datetime', 'datetimetz', 'date', 'time'], true))) { $type = Type::getType($fieldMapping['type']);