From 3ffe80b115119504ee7a8fe97a0a3300917e0b0e Mon Sep 17 00:00:00 2001 From: Jonathan GUILLOT Date: Thu, 18 Apr 2024 00:39:57 +0200 Subject: [PATCH] Update documentation for SelectQuery::select() When using a Closure as first parameter of SelectQuery::select(), it will receive the SelectQuery instance as parameter. However, SelectQuery::count() is not an existing method and FunctionsBuilder returned by SelectQuery::func() must be used instead. --- src/Database/Query/SelectQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Query/SelectQuery.php b/src/Database/Query/SelectQuery.php index 6a9bf6a670f..07f3226b7f0 100644 --- a/src/Database/Query/SelectQuery.php +++ b/src/Database/Query/SelectQuery.php @@ -146,7 +146,7 @@ public function all(): iterable * $query->select('id', true); // Resets the list: SELECT id * $query->select(['total' => $countQuery]); // SELECT id, (SELECT ...) AS total * $query->select(function ($query) { - * return ['article_id', 'total' => $query->count('*')]; + * return ['article_id', 'total' => $query->func()->count('*')]; * }) * ``` *