Setting up link tables with 3 references to other tables?
Hi, I'm trying to achive something a little tricky(?) here. Instead of
using the actual table names, I have replaced my "secret word" with
cake.
I have four tables cakes, cakecompanies, roles and
cakes_cakecompanies_roles
However this doesn't seem to work like I want it. When setting up the
relations for the table cakecompanies in the baking I got the
following suggestion for a relationsship: Cakecompany
hasandbelongstomany AniesRole. This should be just Role.
The last lookup-table I have these fields:
1. id
2. cake_id
3. cakecompany_id
4. role_id
The idea is that a cake can be baked by one company, but sold by
another. Or baked and sold by the same. Or even do more than one thing
together. The table cakes_cakecompanies_roles could be looking
something like this when a couple of inserts had been done.
id|cake|cakecompany|role
1 | 4 | 3 | 1
2 | 4 | 3 | 2
3 | 4 | 2 | 2
4 | 3 | 2 | 1
5 | 5 | 8 | 3
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home