【发布时间】:2012-09-24 06:28:13
【问题描述】:
我正在尝试捕获某个 findBy 调用(使用 afterFind),其中:
如果$results为空(或者你要查找的值不存在),但是在另一个表上找到了参数值,那么它会修改$results为有效
一些控制器操作得到了这个:
$this->User->findByUsername("Bingo"); // yes, username Bingo doesnt exist on users table
用户模型:
function afterFind($results, $primary){
if(empty($results)) {
if(in_array($findbyparameter, array("Bingo", "Bingo1", "Bingo2"))) {
// modify $results
}
}
}
问题是,我如何获得$findbyparameter?
谢谢!我们将不胜感激所有帮助!
【问题讨论】:
-
coder1984 你能更具体一点吗?我已经阅读了,并没有真正帮助
标签: php cakephp cakephp-model