public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'userFriends' => array(self::HAS_ONE, 'UserFriends', 'uid'),
);
}
and the UserFriends class has
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'User' => array(self::BELONGS_TO, 'User', 'uid'),
);
}
The User is being saved to database but not the UserFriends.
$userFriends = new UserFriends();
$userFriends->uid = $id;
$userFriends->friends = $results;
$userFriends->save();//save the friends
//$model->userFriends=$userFriends; --- no need for this line
$model->save();//save the user mode
//$model->userFriends->save(); -- no need for this line either, you saved the friends above
because , if you didnt use it before, it will load on the fly, at the time you first use the relation variable
So if you didnt use it before there’s no need to update it, when you use the new content is saved already and updated
about the problem is stil ocurring, I’ve no idea why and can only help you more if you add content, because its seens right or you will have to wait for other ppl give it a try