You need to look at hasAndBelongsToMany

http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM

Bryan Paddock wrote:
> Argh.. I hate gmail shortcut keys.
>
> Anyways continuing mail:
>
> Heya all,
>
> Theres something I'm not doing right here...
>
> I have a User model which has one Seller model linked to it which in
> turn can have an Agency model linked to it.
>
> User Model:
> hasOne seller.
>
> Seller Model:
>  belongsTo user
>
> Agency Model:
> belongsTo seller
>
> Now when I call $this->User->find('all') it complains that there is no
> foreign key in the agency table. That would be impossible because then
> that would mean only one agency can belong to one seller.
>
> How do I set it up so that any number of agencies can belong to any
> number of sellers? I'm missing something really stupid here....
>
> Thanks!
>
> Bryan
>
>
>
>
>
>
> On Mon, Jun 29, 2009 at 7:06 PM, Bryan Paddock<[email protected]> wrote:
>   
>> Heya all,
>>
>> Theres something I'm not doing right here...
>>
>> I have a User model which has one Seller model linked to it which in
>> turn can have an Agency model linked to it.
>>
>> User Model:
>> hasOne seller.
>> Seller Model: belongsTo user
>> Agency Model: belongsTo seller
>>
>>     
>
> >
>   


--~--~---------~--~----~------------~-------~--~----~
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