Model cakephp 2.x find()还是不带find()?

Model cakephp 2.x find()还是不带find()?,model,cakephp-2.0,Model,Cakephp 2.0,在我的控制器中,我有以下代码: $this->paginate = array( 'Restaurant' => $this->Restaurant->geoRest($lat, $lng, $radius1, $limit) ); $this->set('restaurants',$this->paginate()); 该模型有一个名为geoRest()的函数,内部有一些选项,最后有以下代码: 返回$options

在我的控制器中,我有以下代码:

$this->paginate = array(
            'Restaurant' => $this->Restaurant->geoRest($lat, $lng, $radius1, $limit)
        );
$this->set('restaurants',$this->paginate());
该模型有一个名为geoRest()的函数,内部有一些选项,最后有以下代码: 返回$options

一切正常

但是:

如果我想在模型中这样使用find('all',$options),该怎么办

$rests = array();
$rests = $this->find('all', $options);
return $rests;
我得到一个错误,上面写着:

Warning (2): Illegal offset type [CORE/Cake/Model/Model.php, line 2709]

我想我应该使用find()来获得正确的cakephp代码,对吗?但是正确的解决方案是什么?

您能提供
geoRest()
返回值的示例吗?现在我知道了问题所在。据我所知,如果我想得到可分页的结果,我必须使用分页方法。否则,它可以与find('all'…)配合使用,但不使用paginate。无论如何,谢谢。如果您发现了问题,请关闭您的问题