zen of coding

Dealing with calculated fields in CakePHP's find()

Let’s say we’ve got some calculated field in our find() method, something like SUM() or COUNT() or maybe AVG(). For the sake of example let’s do something simplistic, like: pr($this->Company->find(’all’, array(’fields’=>array(’Company.id’,’Company.name’, ‘COUNT(id) AS total_count’),                                […]

Read More »
%d bloggers like this: