grb
2014-12-08 11:24:46 UTC
Trying to set up an example on how to use join table with extra data I have
the following set:
- table students: id, name, [...]
- table courses: id, title, [...]
- join table courses_students: id, course_id, student_id, grade,
hours_attended
I want to save a student record together with his courses associations on a courses_students table.
Saving entity using the below array works fine for the basic association. It saves both the base class student record as well as the records on the association table.
Array ( [name] => Mark
[courses] => Array (
[_ids] => Array (
[0] => 1
[1] => 2
) ) )
However if I want to save the extra fields on the association table how am I supposed to add these data on the array?
I don't want to save or update the courses associated data, only the association table's data.
--
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+***@googlegroups.com.
To post to this group, send email to cake-***@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
the following set:
- table students: id, name, [...]
- table courses: id, title, [...]
- join table courses_students: id, course_id, student_id, grade,
hours_attended
I want to save a student record together with his courses associations on a courses_students table.
Saving entity using the below array works fine for the basic association. It saves both the base class student record as well as the records on the association table.
Array ( [name] => Mark
[courses] => Array (
[_ids] => Array (
[0] => 1
[1] => 2
) ) )
However if I want to save the extra fields on the association table how am I supposed to add these data on the array?
I don't want to save or update the courses associated data, only the association table's data.
--
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+***@googlegroups.com.
To post to this group, send email to cake-***@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.