I have a "User" model in cakePHP associated with multiple other models.
public $belongsTo = array(
'Reference' => array(
'className' => 'Reference',
'foreignKey' => 'reference_id',
),
'SecurityQuestion' => array(
'className' => 'SecurityQuestion',
'foreignKey' => 'question_id',
)
);
public $hasMany = array(
'UserReview' => array(
'className' => 'UserReview',
'foreignKey' => 'user_id',
'dependent' => true,
),
'UserLicense' => array(
'className' => 'UserLicense',
'foreignKey' => 'user_id',
'dependent' => true,
),
'UserCertification' => array(
'className' => 'UserCertification',
'foreignKey' => 'user_id',
'dependent' => true,
),
'UserFavorite' => array(
'className' => 'UserFavorite',
'foreignKey' => 'user_id',
'dependent' => true,
),
}
the code below return all the Models.
$this->User->find('first', array('conditions' => array('User.id' => 15)));
But
$this->User->find('first', array('contain' => 'UserProfile','conditions' => array('User.id' => 15)));
I guess to return User and UserProfile, but it again return All associations.
Please Help.