From 3d63dfdf299f65e7a1eb3147ff74631d23276ca8 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 3 Jul 2024 15:14:49 +0200 Subject: [PATCH] Fix the support for custom parameter types in native queries The Query class (used for DQL queries) takes care of using the value and type as is when a type was specified for a parameter instead of going through the default processing of values. The NativeQuery class was missing the equivalent check, making the custom type work only if the default processing of values does not convert the value to a different one. --- src/NativeQuery.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/NativeQuery.php b/src/NativeQuery.php index aa44539d544..782983d50ec 100644 --- a/src/NativeQuery.php +++ b/src/NativeQuery.php @@ -50,7 +50,15 @@ protected function _doExecute() $types = []; foreach ($this->getParameters() as $parameter) { - $name = $parameter->getName(); + $name = $parameter->getName(); + + if ($parameter->typeWasSpecified()) { + $parameters[$name] = $parameter->getValue(); + $types[$name] = $parameter->getType(); + + continue; + } + $value = $this->processParameterValue($parameter->getValue()); $type = $parameter->getValue() === $value ? $parameter->getType()