On 7月27日, 上午9时06分, rtanz <[EMAIL PROTECTED]> wrote:
> ok finally got most of it to work, the only problem i still have is
> the task management bit.
>
> currently i have
>
> Roles
>         var $hasMany = array('Task');
>         var $belongsTo = array('Module','User');
>
> Tasks
>         var $belongsTo = array('Role');
>
> Users
>         var $hasMany = array('Role');
>
> What i need is that when i view the user i will also get displayed
> what tasks he needs to do for each role in each module. Also i need to
> add some information about this such as whether the task is complete
> or not. Such a variable does not currently fit in either roles or
> tasks, so im unsure how to make this association.

Use task as a mediate table. It must include 3 columns: roles_id,
users_id, id.

The table role:

Roles:
    var $hasManyAndBelongsTo = array('Task');
    var $hasMany = array('User');

Tasks:
    var $belongsTo= array('User');

Users:
    var $belongsTo= array('Role');

I think the relationship between the 3 Modules is :

Role 1:N User
Role N:N Task

User 1:N Task
User N:1 Role

Task N:1 User
Task N:N Role

Hope it will help you.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to