From 1f14faf08c03e0bb914d3bf81360a548cefc7653 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 7 Jul 2025 21:42:25 +0400 Subject: [PATCH] dbAll() support distinct --- php/src/db/Capacitor.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/php/src/db/Capacitor.php b/php/src/db/Capacitor.php index d09f2e0..7162b44 100644 --- a/php/src/db/Capacitor.php +++ b/php/src/db/Capacitor.php @@ -1,6 +1,7 @@ channel->getPrimaryKeys(); + $select = "select"; + if (A::pop($params, "distinct")) $select .= " distinct"; return $this->storage->db()->all(cl::merge([ - "select", + $select, "from" => $this->getTableName(), ], $query), $params, $primaryKeys); } function dbOne(array $query, ?array $params=null): ?array { + $select = "select"; + if (A::pop($params, "distinct")) $select .= " distinct"; return $this->storage->db()->one(cl::merge([ - "select", + $select, "from" => $this->getTableName(), ], $query), $params); }