Open dbannik opened 3 weeks ago
final class FixSqlWalker extends SqlWalker
{
public function walkPathExpression($pathExpr): string
{
$sql = parent::walkPathExpression($pathExpr);
if ($pathExpr->type === PathExpression::TYPE_STATE_FIELD) {
$fieldName = $pathExpr->field;
$dqlAlias = $pathExpr->identificationVariable;
$class = $this->getMetadataForDqlAlias($dqlAlias);
$fieldMapping = $class->fieldMappings[$fieldName] ?? [];
if (isset($fieldMapping['requireSQLConversion'])) {
$type = Type::getType($fieldMapping['type']);
$sql = $type->convertToPHPValueSQL($sql, $this->getConnection()->getDatabasePlatform());
}
}
return $sql;
}
}
class Kernel extends BaseKernel
{
use MicroKernelTrait;
#[Override]
public function boot(): void
{
parent::boot();
$this->container
->get('doctrine.orm.entity_manager')
->getConfiguration()
->setDefaultQueryHint(Query::HINT_CUSTOM_OUTPUT_WALKER, FixSqlWalker::class)
;
}
}
related bug https://github.com/doctrine/orm/issues/9989