From 41b8c2e9a52245915e8a7074bf04814ee577f571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=AF=BAEno?= <895183594@qq.com> Date: Thu, 31 Oct 2024 16:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84Query=E7=9A=84column=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BB=A5=E6=94=AF=E6=8C=81=E6=8C=87=E5=AE=9A=E8=A1=A8?= =?UTF-8?q?=E5=88=AB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Db/Query/Query.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Db/Query/Query.php b/src/Db/Query/Query.php index 7cff2c27e..4d8c1e92c 100644 --- a/src/Db/Query/Query.php +++ b/src/Db/Query/Query.php @@ -1295,7 +1295,13 @@ public function column($fields, ?string $key = null): array $records = $result->getStatementRecords(); if (1 === \count($rawFields)) { - return array_column($records, $rawFields[0], $key); + $column = $rawFields[0]; + if (strpos($column, '.')) + { + [, $column] = explode('.', $column); + } + + return array_column($records, $column, $key); } else {