Skip to content

Commit 882e03c

Browse files
authored
Merge pull request #10 from JulianVennen/fix-in-queries
Fix encoding arrays for (NOT) IN queries
2 parents 9529c60 + bd11b9c commit 882e03c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Query/Generator/SQL.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,19 @@ protected function generateGroup(Query $query): string
261261
/**
262262
* Generate value for where ore field usage
263263
*
264-
* @param float|int|string|null $value
264+
* @param float|int|string|array|null $value
265265
* @return string
266266
*/
267-
private function generateValue(float|int|string|null $value): string
267+
private function generateValue(float|int|string|null|array $value): string
268268
{
269+
if (is_array($value)) {
270+
$values = [];
271+
foreach ($value as $v) {
272+
$values[] = $this->generateValue($v);
273+
}
274+
return "(" . implode(", ", $values) . ")";
275+
}
276+
269277
if (is_int($value) || is_float($value)) {
270278
return $value;
271279
}

0 commit comments

Comments
 (0)