You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To the best of my knowledge that's not how the count_all_results() method in previous versions of CI3 ever worked, and it's not how the method is intended to work in CI4 either.
if you do $users = $model->find(1) it returns a Result instance. All you have to do is grab the results from that and count() the results. This method is intended to perform a COUNT query on the database itself.
Describe the bug
calling
countAllResults
afterfind($id)
produce wrong result. for example, I made below tests:and both produce an error, because all
countAllResults
is 4This issue only happen when we passing
$id
tofind
method. If we omit it, it will work fine, because without passing$id
it will callfindAll
instead.CodeIgniter 4 version
4.0.2
Affected module(s)
CodeIgniter\Model
Expected behavior, and steps to reproduce if appropriate
Make test as description above to reproduce the issue
Context
The text was updated successfully, but these errors were encountered: