name the model and controller for that join table. It looks like I'm
doing something wrong somewhere...
On 4 nov, 11:41, hydra12 <hydr...@gmail.com> wrote:
> Take a look here:http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM.
> Look especially at the 'with' key when you define your HABTM
> relationship. It says in the docs:
>
> with: Defines the name of the model for the join table. By
> default CakePHP will auto-create a model for you. Using the example
> above it would be called RecipesTag. By using this key you can
> override this default name. The join table model can be used just like
> any "regular" model to access the join table directly.
>
> If you define your with field, you should be able to use your join
> table just like you would any other table.
>
> On Nov 4, 8:10 am, Anupom <anupom....@gmail.com> wrote:
>
> > I think having a separate model for your join table is okay in this case.
> > And perhaps it's a must as you have a third foreign key involved in that
> > join table.
>
> > On Tue, Nov 4, 2008 at 6:00 PM, Adriano Varoli Piazza <mora...@gmail.com>wrote:
>
> > > I'm developing an app where I have two tables, let's call them items
> > > and people, where the relationship between them is HABTM. Plus, the
> > > individual relationships have extra info: this person is related to
> > > this item with a 'description' field.
> > > E.g.:
>
> > > ------------
> > > people:
> > > id
> > > other fields
> > > ------------
> > > items:
> > > id
> > > other fields
> > > ------------
> > > items_people:
> > > id
> > > person_id
> > > item_id
> > > description (varchar)
> > > ------------
>
> > > In the 'worst' case, the join table holds another foreign key to a
> > > table which holds extra info:
> > > ------------
> > > items_people_bis:
> > > id
> > > person_id
> > > item_id
> > > concept_id
> > > -----------
> > > concepts:
> > > id
> > > other fields
> > > -----------
>
> > > Now, I know this is convoluted, but I wanted to know which is the best
> > > way / standard practice to represent such a thing in cake? I've tried
> > > with a simple habtm association in the model, seen that I could use
> > > 'with', also tried using hasmany on both models involved, and making
> > > an extra model for the join table, but I'm still not sure about how to
> > > go. I'd appreciate any help.
>
> > > Thanks in advance
> > > Adriano
>
> > --
> > Anupom Syamhttp://syamantics.com/
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment