If you need access to more data with in the joining table you will not be able to use a habtm model. You will need to change it into a has many model.
- "The cold winds are rising"
On Sep 29, 2012 9:06 PM, "gosukiwi" <fedekiller@gmail.com> wrote:
-- This is what I've got, I have a table named Users, and a table named Lessons, users can give lessons, and the can also suscribe to other user's lessons.So my schema is something like thisusers tableid | username1 | mikelessons tableid | name | teacher_id1 | ... | 1So my users_lessons table looks something like thisuser_id | lesson_id | confirmed1 | 1 | false2 | 1 | true1 | 2 | falseSo far I can map all the users from a lesson, and all the lessons from a user, but given a lesson, i cannot get the status of each user signed up to that lesson, how can I do that?My Lesson model looks something like this--public $hasAndBelongsToMany = array('Students' =>array('className' => 'User','joinTable' => 'users_lessons','foreignKey' => 'lesson_id','associationForeignKey' => 'user_id','unique' => true,'conditions' => '','fields' => '','order' => '','limit' => '','offset' => '','finderQuery' => '','deleteQuery' => '','insertQuery' => ''));
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment