Hello!
I'm new to cakephp and i think i need your help. Sorry I know my
english is bad :-)
I have an application in which users can be members of many events and
events have many downloads.
Everything is working fine, related downloads are showing up on the
eventspage, related events are showing up on the users page... but how
do i accomplish that on the userspage downloads are showing from
events the user is member of?
Event model:
<?php
class Event extends Appmodel{
var $name ='Event';
var $hasMany = array ('Download' => array(
'className' => 'Download',
'foreignKey'=>'event_id')
);
var $hasAndBelongsToMany = array ('User' => array(
'className' => 'User',
'joinTable' => 'events_users',
'foreignKey'=>'event_id')
);
}
?>
User model:
<?php
class User extends Appmodel{
var $name ='User';
var $hasAndBelongsToMany = array ('Event' => array(
'className' => 'Event',
'joinTable' => 'events_users',
'foreignKey'=>'user_id')
);
var $hasMany = array ('Download' => array(
'className' => 'Download',
'foreignKey'=>'event_id')
);
}
?>
<?php
class Download extends Appmodel{
var $name ='Download';
var $belongsTo = array ('Event' => array(
'className' => 'Event',
'foreignKey'=>'event_id')
);
}
?>
Thank you!
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---