Skip to content

Commit

Permalink
Update documentation for SelectQuery::select()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joggee-fr committed Apr 19, 2024
1 parent 8f56e52 commit 3ffe80b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Database/Query/SelectQuery.php
Expand Up @@ -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('*')];
* })
* ```
*
Expand Down

0 comments on commit 3ffe80b

Please sign in to comment.