views:

1586

answers:

5

I searched in google for this without a good result. The only topic I found in the cakephp trac, was closed without a "real" explanation. Since CakePhp is like one of the rails ports for php and rails does support this. I would like to know why wont be sopport to this feature.

+3  A: 

Only the CakePHP team would know for sure. One of the team, Nate Abdele, said this about multi-column primary keys back in February 2007:

I could come up with a million other reasons why multi-column primary keys are a dumb idea, but I think the most important one for 2007 is that it breaks REST architecture on the web, as there is no single point of reference to a piece of data, and that data may now change up on you without you knowing it, so objects can no longer be consistently referenced from a single URI.

I assume this would be his argument against multi-column foreign keys too.

scronide
Ouch. Weak argument IMHO. And they're called composite keys.
Joe Philllips
Whether a key is composite or not depends on the properties of the columns used.
scronide
A: 

Can you achieve the same result by adding a condition with the 2nd column to the association?

neilcrookes
+2  A: 

Someone learning cake said it best:

I'm learning that, if something is ridiculously difficult in cakephp, you've probably got design problems.
-- asciimo

Alexander Morland
A: 

ok. but I would like to decide how my db schema will be, in RoR you have the tool, if you wanna use it, you do it under your risk. btw: I don't know if symphony allow to do it also.

Gabriel Sosa
This is the answer?
lark
A: 

No, the real reason to support multi-column primary keys is for retro-fitting CakePHP into an existing application. Don't promote this type of practice because it is poor design, of course, but if you had the choice of using multiple primary keys versus redesigning a large chunk of an existing administration system, the simple choice would be a very nice feature.

bmilesp