Hello,

for instance you could have Post, Tag, PostTag, Post HABTM Tag / Post
HasMany PostTag, Tag HasMany PostTag.
why this example? because it shows the most common place where you
would - outside of Active Record - use a combined primary key -
PostTag would have PrimaryKey(post_id, tag_id) - but as Jeremy Burns
pointed out: besides the very tiny data overhead, what is the issue
with one additional field as a primary and setting Unique(post_id,
tag_id)?

On Apr 17, 12:50 am, Jeremy Burns <[email protected]> wrote:
> I absolutely endorse a single, incremental, non-intelligent primary key, 
> enriched with multi-field unique indexes and the adoption of convention. Why 
> make life any more difficult than it is already?
>
> Jeremy Burns
> [email protected]
>
> On 16 Apr 2010, at 21:29, Renan Augusto wrote:
>
>
>
> > Dear,
>
> > Someone must have encountered a situation where a table had
> > with composite key.
> > what did you do? Since CakePHP recognizes only one field to
> > primaryKey!
>
> > In my opinion I see two possibilities:
>
> > 1 - not create tables with composite keys. When you need to use
> > composite keys to identify a record, create one more field with the
> > name ID and put it as primary key.
>
> > 2 - forget standardization. Choose one of the fields to put in
> > $ primaryKey attribute of the model and when you need to make a
> > relationship (or hasMany belongsTo), use to specify the conditions
> > other fields that make up the key of the table.
>
> > That's my opinion, please tell her!
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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