Hello , so i have a problem with the Query() method , seems like the groupBy()
is not working , any one knows why is that ? If i remove the groupBy()
the sql functions normaly. I'm using Phalcon 2.0.0. and php gives the following error :
Fatal error: Call to undefined method Phalcon\Mvc\Model\Criteria::groupBy()
SELECT
departments.department,
count(department_members.department) as count
FROM departments
LEFT JOIN department_members on department_members.department = departments._
GROUP BY departments._
ORDER BY departments.department
$departments = Departments::query()
->columns([
'Manager\Models\Departments._',
'Manager\Models\Departments.department',
'COUNT(Manager\Models\DepartmentMembers.department) as count',
])
->leftJoin('Manager\Models\DepartmentMembers', 'Manager\Models\DepartmentMembers.department = Manager\Models\Departments._')
->groupBy("Manager\Models\Departments._")
->orderBy("Manager\Models\Departments.department ASC")
->execute();