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 this
users table
id | username
1 | mike
lessons table
id | name | teacher_id
1 | ... | 1
So my users_lessons table looks something like this
user_id | lesson_id | confirmed
1 | 1 | false
2 | 1 | true
1 | 2 | false
So 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.