Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Casting issue due to MariaDB not included in inheritance schema anymore #2888

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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