/**
  * 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 = ProjectWishlist::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #2
0
 /**
  * This method returns wishlist of a user in an array.
  * Returns array if wishlist is available.
  * Returns false if it is not available.
  *
  * @param string $userId
  * @return array|boolean
  */
 public static function getWishlistAsArray($userId)
 {
     $projectWishlist = ProjectWishlist::model()->findAll('user_id=:user_id', array(':user_id' => $userId));
     $result = array();
     if ($projectWishlist) {
         foreach ($projectWishlist as $project) {
             $result[$project->project_id] = $project->project_id;
         }
         return $result;
     }
     return false;
 }