Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change $primary_key #563

Open
Keberdle opened this issue Feb 20, 2017 · 0 comments
Open

Cannot change $primary_key #563

Keberdle opened this issue Feb 20, 2017 · 0 comments

Comments

@Keberdle
Copy link

It cannot change $primary_key of entity.
After save is still in database original value.

$ended_uniq_customer_actions = \Db\ActionsToCustomersUniq::find('all', array(
'conditions' => array(
'customers_uniq_id = ?',
16728
)
));

$ended_uniq_customer_actions[0]->customers_uniq_id = 15892;
$ended_uniq_customer_actions[0]->save();

class ActionsToCustomersUniq extends ActiveRecord\Model {
static $table_name = 'crm_actions_to_customers_uniq';
static $primary_key = array('actions_id','customers_uniq_id');
}

CREATE TABLE IF NOT EXISTS crm_actions_to_customers_uniq (
actions_id int(11) NOT NULL DEFAULT '0',
updated_at datetime DEFAULT NULL,
created_at datetime DEFAULT NULL,
customers_uniq_id int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (customers_uniq_id,actions_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-----------------------------+ | actions_id | customers_uniq_id |
-----------------------------+ | 3 | 16728 |
-----------------------------+

mysql Ver 14.14 Distrib 5.5.53, for debian-linux-gnu (x86_64) using readline 6.3

Thank You in advance for help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant