Exemple #1
0
 /**
  * This method returns the owner of a particular project.
  * Returns model if successfully found.
  * Returns the false if not found.
  *
  * @param string $projectId
  * @return model || false
  */
 public static function getOwner($projectId)
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'user_id';
     $criteria->condition = 'id=:projectId';
     $criteria->params = array(':projectId' => $projectId);
     $project = Projects::model()->find($criteria);
     if ($userId) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'user_id=:userId';
         $criteria->params = array(':userId' => $project->user_id);
         $userprofile = UserProfiles::model()->find($criteria);
         $usercredentials = UserApi::getUserDetails($project->user_id);
         $userdetails = ArrayUtils::mergeArray($usercredentials->getAttributes(), $userprofile->getAttributes());
         return $userdetails;
     } else {
         return false;
     }
 }