Hi, I just notice this: the count() function does not seem to execute the extending get() function in the child class.
For example: I have a model User that extends DataMapper. Inside this model, it has an override get() method which makes sure that we always deal with active users
function get($limit = NULL, $offset = NULL)
{
$this->where('active', 1);
return parent::get($limit, $offset);
}When I do this, it gives me only active users which is great.
$user = new User();
echo $user->get();But when I do this, it counts all users instead of only the active ones.
$user = new User();
echo $user->count();I looked inside the count() method, it does not call the extending get() method. So where can I put the $this->where(‘active’, 1); so that it can be used by both get() and count() methods, and probably many others? Or I have to extend the count function again and duplicate this where clause?
Thanks,
Khoa