php - $this->Agreements->save() - create only one record, why? -


i need read records table agreements, make changes in filed payments, , update records, save table. so, problem is, save() create empty record. not update exists record. show how:

reading table:

$agreements = $this->agreement->find('all'); $payments = $this->payment->find('all'); 

manipulation on fields (part of)(example):

$id=0; foreach ($agreements $agreement):     ($i=$first_agreement; $i<=$last_agreement; $i++){          if ( $agreement['agreement']['agreement_number']==$i){            $agreements[$id]['agreement']['payment']=$payd[$i];         }       } $id++; endforeach; 

writting table:

$this->agreement->save(); 

a echo debug($agreements) shows correct array, have tryed :

$this->agreement->save($agreements); 

or

$this->agreement->save($this->request->data); 

can help/explain me how write record?

cake 2.5.2 php : 5.4.4-14

model::save() saves single record. if want save multiple records need use model::saveall() or model::savemany().


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -