Try making PostTag a full model for posts_tags, and set
hasMany/belongsTo instead of HABTM.

On Thu, Feb 21, 2008 at 2:41 AM, mason <[EMAIL PROTECTED]> wrote:
>
>  Hello all, got a question that I haven't yet seen an answer to...
>
>  I have a fairly standard many:many relationship, much like the classic
>  Posts-Tags example. I have the standard join table, with an extra
>  column, for example:
>
>  posts (id, text)
>  tags (id, name)
>  posts_tags (post_id, tag_id, tag_link_id)
>
>  So this is where it gets unorthodox. Using the standard
>  hasAndBelongsToMany, when I'm iterating a list of posts I can easily
>  enough get the tags. But does anyone have a suggestion for *also*
>  getting the tag_link_id for the association?
>
>  As an example, I'd like to take a Post, and iterate its array of Tags.
>  For each Tag, I want to get Tag.name but also get the tag_link_id from
>  the corresponding row in posts_tags. I suppose I could do a find in
>  posts_tags using the post_id and tag_id, but that's an extra database
>  query for data that I should already have.
>
>  Any suggestions of a clever way to carry this associated data along?
>
>  Thanks in advance.
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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