First things first, your relationships are a bit mixed up ... both
models should HABTM each other, you're confusing things by trying to
create User hasMany Event. Remove users_id from events table, specify
that User HABTM Event and rely on the join table to relate things.
Not sure why mscdex advises removing the id field from the join table,
I include one in all my join tables without issue, but happy for
mscdex to elaborate and inform us of some performance improvement that
may cause :)
Onto your question about the data fetched by your find call. When
everything is linked by HABTM you can do the following find
$this->Event->find('all', array(
'conditions'=>array('EventsUsers.user_id'=>'12')
));
It's the confusion of relating users to events in two different ways
which makes your query difficult .. once you link them by HABTM alone
it becomes easy.
Paul.
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---