Skip to content

Commit

Permalink
fix: Casting issue due to MariaDB not included in inheritance schema …
Browse files Browse the repository at this point in the history
…anymore
  • Loading branch information
Pixelshaped authored Oct 16, 2024
1 parent c5798aa commit ee63c20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Translatable/Query/TreeWalker/TranslationWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);

Expand Down

0 comments on commit ee63c20

Please sign in to comment.