Reputation: 31
I used the following code on cakephp 2 to change a foreign key field in the table changes (references change_states).
$this->loadModel('Change');
$this->Change->id = $id;
$this->Change->saveField('change_state_id',2);
The $id is right and the corresponding change does exist. The id 2 does exist in the referenced table change_states. The code is running without error but the field in 'change_state_id' in the table 'changes' is not set to 2. If I use the same code and user saveField on a non foreign key field, it's working.
Thank you very much in advance.
Upvotes: 0
Views: 605
Reputation: 21743
already answered and found invalid at http://cakephp.lighthouseapp.com/projects/42648/tickets/2507-savefield-does-not-work-on-foreign-key-fields
foreign key probably in the wrong table
Upvotes: 1