So I have a piece of code that has worked for months now on my localhost and development server. Both of which are windows environments. When moved to a new linux hosting location it throws these errors:
Warning (2): array_merge() [function.array-merge]: Argument #2 is not an array [CORE/Cake/Model/Model.php, line 2036]
Warning (2): array_merge() [function.array-merge]: Argument #2 is not an array [CORE/Cake/Model/Model.php, line 2186]
The piece of code in question is a saveAll call that saves data retrieved from a form. Interestingly the data still saves despite the error.
The code for my save is here
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');
}
The entire function:
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');
}
}
}
The data still saves just fine but how do I change it so that it doesn't throw those errors?