尽管返回数据正确,但在调用find时CakePHP会发现命令警告

时间:2012-07-25 16:20:15

标签: cakephp controller cakephp-2.1

我收到以下错误:

警告(2):array_keys()期望参数1为数组,给定[CORE \ Cake \ Model \ Datasource \ DboSource.php,第2181行]

警告(2):array_filter()期望参数1为数组,给定[CORE \ Cake \ Model \ Datasource \ DboSource.php,第2185行]

警告(2):array_values()期望参数1为数组,给定[CORE \ Cake \ Model \ Datasource \ DboSource.php,第2185行]

警告(2):array_unique()期望参数1为数组,给定[CORE \ Cake \ Model \ Datasource \ DboSource.php,第2264行]

警告(2):array_merge()[function.array-merge]:参数#2不是数组[CORE \ Cake \ Model \ Datasource \ DboSource.php,第1524行]

运行时:

public function pdf($the_id) {
    $searchs = $this->Order->find('all', array('conditions' => array('Order.id' => $the_id, 'Order.user_id' => $this->userDetails['id'])));
    if(empty($searchs)){
        $this->Session->setFlash('The requested order was not found or is not your order', 'error');
        $this->redirect(array('action' => 'yourorders'));
    }

    $this->set('orderpdf', $searchs);
}

有谁知道为什么?

编辑---- 这是模型;这是一个新模型,所以它很小:

class Order extends AppModel {
    public $name = 'Order';
    public $belongsTo = array('User');
    public $hasOne = array('Basket', 'Sage');
}

1 个答案:

答案 0 :(得分:1)

$ this-> Order-> unBindModel(array('hasOne'=> array('Sage')));工作。 Sage模型没有可供参考的表。