This might come in handy when it comes to manipulating the extra data on 
the join table:
http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1

Adriano Varoli Piazza wrote:
> Thanks for both the answers. I'm now dealing with the right way to
> name the model and controller for that join table. It looks like I'm
> doing something wrong somewhere...
>
>
> On 4 nov, 11:41, hydra12 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL 
>>> PROTECTED]>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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to