/**
  * 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 $id the ID of the model to be loaded
  * @return AUserDetails the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = AUserDetails::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public static function getEmailAndBasePhoneNumForUser($userDetailsId)
 {
     $response = array();
     if (isset($userDetailsId)) {
         $selectedRec = AUserDetails::model()->findAll(array('with' => array('aUserLogins' => array('on' => 'aUserLogins.is_deleted = "no" AND 
     					 t.is_deleted = "no" AND t.id = ' . $userDetailsId . ' '))));
         foreach ($selectedRec as $row) {
             $response['email'] = $row->aUserLogins[0]->login_name;
             break;
             //get the last updated and exit
         }
         $selectedPhone = APhone::model()->findAll(array('order' => 't.id DESC', 'condition' => 't.is_deleted = "no" AND t.link_table = "user_details"  AND 
     				t.meta_data = "base_phone" AND t.link = ' . $userDetailsId . ' '));
         foreach ($selectedPhone as $row) {
             $response['phone'] = $row->phone_num;
             break;
             //get the last updated and exit
         }
     }
     if (AppCommon::isEmpty($response)) {
         $response = false;
     }
     return $response;
 }