On Jan 9, 2007, at 12:48 PM, Alessandro Nuzzo wrote:

>
> I have some problems to understand the association.
> For example, I have a model 'User' and model 'Address'.
>
> User:
>  - id
>  - bla bla bla
>  - office_address : int -> address.id
>  - home_address : int -> address.id

Stick this in your model.

var $belongsTo = array('HomeAddress' =>
                            array('className'  => 'Address',
                                  'conditions' => '',
                                  'order'      => '',
                                  'foreignKey' => 'home_address'
                            ),
                           'OfficeAddress' =>
                            array('className'  => 'Address',
                                  'conditions' => '',
                                  'order'      => '',
                                  'foreignKey' => 'office_address'
                            )

                      );

(This info can be found in http://manual.cakephp.org/chapter/models )

-- John

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" 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