cakephp - Update only a table, but the table is associated with another -


i have main table, cliente. table associated 20 tables. i´m trying update table clientee using code below:

$this->cliente->updateall(array("ec_cnpj" => $this->request->data['cliente']['ec_cnpj'],                                   "ec_cpf" => $this->request->data['cliente']['ec_cpf'],                                   "ec_rg" => $this->request->data['cliente']['ec_rg'],                                   "ec_rg_org_emissor" => $this->request->data['cliente']['ec_rg'],                                   "ec_rg_est_emissor" => $this->request->data['cliente']['ec_rg_est_emissor'],                                   "ec_nire" => $this->request->data['cliente']['ec_nire']),                             array("ec_codigo"=>$this->request->data['ec_codigo'])) 

but, cake generating query update tables. how can update cliente table?

from the docs

by default, updateall() automatically join belongsto association databases support joins. prevent this, temporarily unbind associations.

so, unbind correspondent models like

$this->cliente->unbindmodel(array('hasmany' => array('table1', 'table2'))); 

read "creating , destroying associations on fly" have better understanding of it.

maybe you'll find this useful, escapes comes directly cakephp, you'll have create new function.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -