That is not a normalised database as there is no unique way of knowing
which table to link the foreignKeys with.  Consider that you enter two
rows to your table

Row #1 (adding links to Tool id 1 and 2)
INSERT INTO Project (resource1_id, resource2_id) VALUES (1, 2)
Row #2 (adding links to Person id 1 and 2)
INSERT INTO Project (resource1_id, resource2_id) VALUES (1, 2)

When you try to then pull out that data there is no way of identifying
which table the resource ids relate to.

What you would need to add to be able to do this is have the following
fields:

resource1_model
resource1_id
resource2_model
resource2_id

This way for each resource you can store the model name which will
allow you to uniquely identify what the resource relates to.

However this seems a fairly static solution, if one record needs to be
related to more than one Tool or Person then you should really look at
sing join tables which would be much more flexible allowing you to add
1 to x resources to Project records.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to