On 7/25/07, rtanz <[EMAIL PROTECTED]> wrote:
>
> im still trying to fully understand the concept of models,
> associations and how this relates to my db tables. For example as far
> as I can understand the relationship between modules and roles is
> HABTM but then I cannot do this with the associations or i cannot
> understand how it can be done. Where i have that table
> modules_roles_users i would like to use that to connect a module to
> its users and their respective roles, but how can i express that using
> the cake associations. sorry if im missing something im trying really
> hard to understand these concepts which are new for me
>

I think maybe you are trying *too* hard. ;)

What I found worked for me when I first started learning about
building relationships between tables is to do the actual database
design LAST and first think about the relationships between the Models
themselves.  Once you get those relationships down, then actually
build the tables making sure you have the foreign keys all set up
correctly.  Then you can get down to writing custom code like
"Complete" vs. "Pending" as you've stated above.  The old "walk before
you run" argument.

I know that it seems like a lot to learn, but it's not really that
much.  The manual's section on associations is good and should point
you in the right direction.

Has And Belongs To Many relationships are hard for some to understand
(it tripped me up at first) but it sounds like you are trying to cram
three relationships into where only two should go.  I think I saw a
posting in the last few days that pointed to an example of how to do
what you are talking about.  In the meantime, here's a link to check
out:

http://edivad.wordpress.com/2007/04/19/cakephp-hasandbelongstomany-habtm/


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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