Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cakephp saveall错误参数#2不是数组_Cakephp - Fatal编程技术网

cakephp saveall错误参数#2不是数组

cakephp saveall错误参数#2不是数组,cakephp,Cakephp,因此,我有一段代码,它已经在我的本地主机和开发服务器上运行了几个月。两者都是windows环境。当移动到新的linux主机位置时,会抛出以下错误: 警告(2):array_merge()[function.array merge]:参数#2不是数组[CORE/Cake/Model/Model.php,第2036行] 警告(2):array_merge()[function.array merge]:参数#2不是数组[CORE/Cake/Model/Model.php,第2186行] 这段代码是一

因此,我有一段代码,它已经在我的本地主机和开发服务器上运行了几个月。两者都是windows环境。当移动到新的linux主机位置时,会抛出以下错误:

警告(2):array_merge()[function.array merge]:参数#2不是数组[CORE/Cake/Model/Model.php,第2036行]

警告(2):array_merge()[function.array merge]:参数#2不是数组[CORE/Cake/Model/Model.php,第2186行]

这段代码是一个saveAll调用,用于保存从表单检索到的数据。有趣的是,尽管有错误,数据仍然保存

我保存的代码在这里

            if (!($quote['Quote']['total'] == 0 || $quote['Quote']['total'] < 0)) {
            if ($this->Quote->saveAll($quote, true)) {
                $this->Session->setFlash('Quote Saved', 'success');
                $this->redirect('/clientcases/view/' . $case . '#tab6');
            }
if(!($quote['quote']['total']==0 | |$quote['quote']['total']<0)){
如果($this->Quote->saveAll($Quote,true)){
$this->Session->setFlash('Quote Saved','success');
$this->redirect('/clientcases/view/'.$case.#tab6');
}
整个功能:

    public function makeQuote() {
    $this->loadModel('Applicant');
    $this->LoadModel('ApplicantQuote');
    $this->LoadModel('Setfee');
    $this->LoadModel('Clientcase');
    $this->LoadModel('Internalprice');
    $this->LoadModel('Clientprice');

    /* ------ retrieving client and internal prices for display ------ */
    $internal = $this->Internalprice->find('all');
    $client = $this->Clientprice->find('all');

    //retrieves the applicants chosen from the view_quotes page
    $args = $this->params['url'];
    //get the case id from the previous page

    $case = $args['data']['caseid'];
    //remove move some unnecessary things from the args array
    unset($args['data']['caseid']);
    unset($args['id']);
    //retrieve the applicant information from the database using the applicant array
    $applicants = $this->Applicant->find('all', array('conditions' => array('id' => $args['data']),
        'order' => 'first_name ASC', 'recursive' => -1));

    $app_id = Set::classicExtract($applicants, '{n}.Applicant.id');

    if ($applicants == null) {//redirect back to view quotes page if no applicants were chosen
        $this->Session->setflash('Choose at least one applicant');
        $this->redirect('/clientcases/view/' . $case . '#tab5');
    }

    $this->set(compact('applicants', 'case', 'args', 'internal', 'client'));

    if ($this->request->is('post')) {
        $cancelCheck = $_POST;
        if ($cancelCheck['QuoteButton'] == 'Cancel') {
            $this->redirect('/clientcases/view/' . $case);
        }

        $quote = $this->request->data;
        unset($quote['QuoteButton']);

        $quote["Applicant"] = array();
        $quote['Applicant']['Applicant'] = array();

        $count = 0;
        foreach ($app_id as $key => $id) {
            $quote['Applicant']['Applicant'][] = $app_id[$count];
            $count++;
        }

        $gst = 0;
        if ($quote['Quote']['includeGST'] == 1) {
            $total = $quote['Quote']['total'];

            if ($total > 0) {
                $gst = $total / 10;
            }
        }
        $quote['Quote']['GST'] = $gst;
            //debug($quote);
        unset($quote['Quote']['includeGST']);
        if (!($quote['Quote']['total'] == 0 || $quote['Quote']['total'] < 0)) {
            if ($this->Quote->saveAll($quote, true)) {
                $this->Session->setFlash('Quote Saved', 'success');
                $this->redirect('/clientcases/view/' . $case . '#tab6');
            }
        } else {
            $this->Session->setflash('Quote Failed to Save, All fields must be filled in and total greater than 0');
        }
    }
}
公共函数makeQuote(){
$this->loadModel(“申请人”);
$this->LoadModel('applicationquote');
$this->LoadModel('Setfee');
$this->LoadModel('Clientcase');
$this->LoadModel('Internalprice');
$this->LoadModel('Clientprice');
/*-----检索要显示的客户和内部价格------*/
$internal=$this->Internalprice->find('all');
$client=$this->Clientprice->find('all');
//检索从“查看报价”页面中选择的申请者
$args=$this->params['url'];
//从上一页获取案例id
$case=$args['data']['caseid'];
//从args数组中删除并移动一些不必要的内容
未设置($args['data']['caseid']);
未设置($args['id']);
//使用申请者数组从数据库检索申请者信息
$applicators=$this->applicator->find('all',array('conditions'=>array('id'=>$args['data']),
“顺序”=>“名字ASC”,“递归”=>-1);
$app_id=Set::classicExtract($applicators,{n}.applicator.id');
如果($APPLIENTS==null){//如果未选择任何申请人,则重定向回“查看报价”页面
$this->Session->setflash('选择至少一个申请者');
$this->redirect('/clientcases/view/'.$case.#tab5');
}
$this->set(压缩('applicators'、'case'、'args'、'internal'、'client');
如果($this->request->is('post')){
$cancelCheck=$\u POST;
如果($cancelCheck['QuoteButton']=='Cancel'){
$this->redirect('/clientcases/view/'.$case);
}
$quote=$this->request->data;
未设置($quote['QuoteButton']);
$quote[“申请人”]=array();
$quote['APPLIENT']['APPLIENT']=array();
$count=0;
foreach($app_id作为$key=>$id){
$quote['APPLIENT']['APPLIENT'][=$app_id[$count];
$count++;
}
$gst=0;
如果($quote['quote']['includeGST']==1){
$total=$quote['quote']['total'];
如果($total>0){
$gst=$total/10;
}
}
$quote['quote']['GST']=$GST;
//调试(报价);
未结算($quote['quote']['includeGST']);
如果(!($quote['quote']['total']==0 | |$quote['quote']['total']<0)){
如果($this->Quote->saveAll($Quote,true)){
$this->Session->setFlash('Quote Saved','success');
$this->redirect('/clientcases/view/'.$case.#tab6');
}
}否则{
$this->Session->setflash('Quote保存失败,必须填写所有字段,合计大于0');
}
}
}
数据仍然保存得很好,但如何更改它以使其不会抛出这些错误?

的第二个参数是数组。您正在发送布尔值

在您的情况下,
save($quote)
似乎也可以工作。
save
的第二个参数是布尔值,因此不会返回错误


可能其他服务器上的警告已被抑制。

我认为仅保存一次是行不通的。表单正试图同时保存到5个不同的表中。