Hi all, probably a not so difficult question, but I am a newbie to CakePHP and would really appreciate some advice.
I have coded something exactly following the situation described in http://book.cakephp.org/view/851/Multiple-relations-to-the-same-model that is: a User model, a Message model, Sender and Recipient aliases. Everything works smoothly. Then I have a Profile model one-to-one associated with User, here as well following the Cookbook http://book.cakephp.org/view/80/hasOne <?php class User extends AppModel { var $name = 'User'; var $hasOne = 'Profile'; } ?> and http://book.cakephp.org/view/81/belongsTo <?php class Profile extends AppModel { var $name = 'Profile'; var $belongsTo = 'User'; } ?> Relationship working fine except for the following... The problem I have is that $this->Message->find('all') in MessagesController doesn't return the Profile data for the Sender and the Recipient. They are aliases of User, so I can expect that maybe some extra code is needed somewhere. I tried to modify the Profile model into something like: var $belongsTo = array( 'User', 'Sender' => array( 'className' => 'User', 'foreignKey' => 'user_id' ), 'Recipient'... ); Doesn't work, half expected it, because it seems more important in this case to declare that the Sender (Recipient) 'hasOne' Profile. But where and how, not having a Sender (Recipient) model? Thank you in advance, Mario --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
