public static function getLists($stateIds) { $cityLists = ''; foreach ($stateIds as $stateid) { $cityLists = ArrayUtils::mergeArray($cityLists, self::getList($stateid)); } return $cityLists; }
public static function getUser($userId) { $userModel = UserCredentials::model()->findByPk($userId); $result = false; if ($userModel) { $userProfile = UserProfiles::model()->find("user_id=:userId", array(":userId" => $userId)); if ($userProfile) { $result = ArrayUtils::mergeArray($userModel->getAttributes(), $userProfile->getAttributes()); } else { $result = $userModel->getAttributes(); } } return $result; }
/** * 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; } }