Oh Ok.
Now I see what are you doing.
If you check the documentation for Cakephp, the association tables gets populated by Cakephp, itself. Howvever if you are saving the data straight into the association tble then do it this way
$data['tutor_id'] = 2;
$data['subject_id'] = $this->request->data['Subject']['id];
$this->TutorsSubject->save($data);
As note of caution make sure that both foreign key ID's have there respective rows in parent tables before saving saving as your original error is MySQL error for data integrity...
On Monday, 22 September 2014 16:40:14 UTC+5:30, ajt wrote:
-- Now I see what are you doing.
If you check the documentation for Cakephp, the association tables gets populated by Cakephp, itself. Howvever if you are saving the data straight into the association tble then do it this way
$data['tutor_id'] = 2;
$data['subject_id'] = $this->request->data['Subject']['id];
$this->TutorsSubject->save($data);
As note of caution make sure that both foreign key ID's have there respective rows in parent tables before saving saving as your original error is MySQL error for data integrity...
On Monday, 22 September 2014 16:40:14 UTC+5:30, ajt wrote:
But I dont need a saveall as I save to 1 table only ? Saveall is not appropriate for this. I am not sure what to do here.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment