Tag Archives: beforefind

menggunakan cakephp’s beforeFind

I found out that on cakephp 1.2 RC3 you must use the new $Model->find() style or the query will break.

1
2
3
4
5
6
7
8
9
10
11
//in the controller use this…
$this->Post->find(’first’, $params);
 
//instead of the ‘old’ style…
$this->Post->find($conditions);
 
//so that in the model, you can do something like this…
function beforeFind($queryData) {
$queryData[’conditions’]["`Post`.`post_type`"] = "personal";
[...]

RSS for Posts RSS for Comments