Having a category model and an article model, i will count the total numbers of article within a category like this:
$categoryModel->getArticles()->count();
But if i want to count only the active articles i can not do it ?
$categoryModel->getArticles()->count("active = 1"); // not working
$categoryModel->getArticles()->count(array("active = 1")); // not working
I have tried to create a custom count() method in Articles model:
public function countActive()
{
return parent::count(array("active = 1"));
}
But, countActive is never called because $categoryModel->getArticles() is an instance of Phalcon\Mvc\Model\Resultset\Simple
Any thoughts ?