From bd11b9ccafc59ce10545c54b8cd348c61040dae8 Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Mon, 15 Jul 2024 14:47:34 +0200 Subject: [PATCH] Fix encoding arrays for (NOT) IN queries --- src/Query/Generator/SQL.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Query/Generator/SQL.php b/src/Query/Generator/SQL.php index b9463b6..4f8e443 100644 --- a/src/Query/Generator/SQL.php +++ b/src/Query/Generator/SQL.php @@ -261,11 +261,19 @@ protected function generateGroup(Query $query): string /** * Generate value for where ore field usage * - * @param float|int|string|null $value + * @param float|int|string|array|null $value * @return string */ - private function generateValue(float|int|string|null $value): string + private function generateValue(float|int|string|null|array $value): string { + if (is_array($value)) { + $values = []; + foreach ($value as $v) { + $values[] = $this->generateValue($v); + } + return "(" . implode(", ", $values) . ")"; + } + if (is_int($value) || is_float($value)) { return $value; }