Phalcon model update index key column issue

I occured an issue, This is my talbe create info :

CREATE TABLE hr ( uid int(10) unsigned NOT NULL , cid int(10) unsigned DEFAULT '0' , company_status tinyint(1) DEFAULT '0' , PRIMARY KEY (uid), KEY idx_cid (cid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8

I want to update the 'cid' column in this table Here is my update:

$hr = Hr::findFisrt(10); $hr->save(array('cid' => 13, 'companystatus' => 1), array('cid', 'companystatus'));

Only company_status column will be update . cid column not changed.

Should I do any other setting for INDEX KEY column in model?



4.0k

Try this

$hr = Hr::findFirst(10);
$hr->cid = 13;
$hr->company_status = 1;
$hr->save();

Manual