public function run() { $friends_of_friends = UserRelated::model()->getFriendsOfFriends($this->user_id); $friends_of_friends_count = UserRelated::model()->getFriendsOfFriendsCount($this->user_id); $my_u_id = Yii::app()->user->id; $u_id = $this->user_id; if ($friends_of_friends != null && $friends_of_friends > count($friends_of_friends) && $u_id == $my_u_id) { $this->render('userrelated', array('related' => $friends_of_friends, 'related_count' => $friends_of_friends_count)); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = UserRelated::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }