create-prisma-php-app 1.17.14 → 1.17.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -331,9 +331,21 @@ abstract class Utility
|
|
|
331
331
|
{
|
|
332
332
|
if (isset($criteria['orderBy'])) {
|
|
333
333
|
$orderByParts = [];
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
|
|
335
|
+
// Check if orderBy is an associative array with directions or a list of columns
|
|
336
|
+
if (array_values($criteria['orderBy']) === $criteria['orderBy']) {
|
|
337
|
+
// If it's a list of columns, default to 'asc'
|
|
338
|
+
foreach ($criteria['orderBy'] as $column) {
|
|
339
|
+
$orderByParts[] = "$column asc";
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
// If it's an associative array with directions
|
|
343
|
+
foreach ($criteria['orderBy'] as $column => $direction) {
|
|
344
|
+
$direction = strtolower($direction) === 'desc' ? 'desc' : 'asc';
|
|
345
|
+
$orderByParts[] = "$column $direction";
|
|
346
|
+
}
|
|
336
347
|
}
|
|
348
|
+
|
|
337
349
|
$sql .= " ORDER BY " . implode(', ', $orderByParts);
|
|
338
350
|
}
|
|
339
351
|
if (isset($criteria['take'])) {
|