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

问题描述 投票:0回答:1

我收到以下错误:

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

警告 (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');
}
php cakephp controller cakephp-2.1
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.