AIRAVATA-2156 Using isNull to check if UserResourceProfile exists
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/127653fe Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/127653fe Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/127653fe Branch: refs/heads/develop Commit: 127653fe1eaf4efcff06b0f65d41f7b90513d499 Parents: cd045ec Author: Marcus Christie <[email protected]> Authored: Wed Oct 26 11:19:12 2016 -0400 Committer: Marcus Christie <[email protected]> Committed: Wed Oct 26 11:22:27 2016 -0400 ---------------------------------------------------------------------- app/libraries/URPUtilities.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/127653fe/app/libraries/URPUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php index 395d88f..62c2318 100644 --- a/app/libraries/URPUtilities.php +++ b/app/libraries/URPUtilities.php @@ -8,14 +8,13 @@ class URPUtilities public static function get_or_create_user_resource_profile() { - try { - return URPUtilities::get_user_resource_profile(); - } catch (AiravataSystemException $ase) { - // TODO: replace try/catch with null check once backend is updated, see AIRAVATA-2117 - // Assume that exception was thrown because there is no UserResourceProfile - - return URPUtilities::create_user_resource_profile(); + $userResourceProfile = URPUtilities::get_user_resource_profile(); + // Check if user has UserResourceProfile by checking isNull flag + if ($userResourceProfile->isNull) + { + $userResourceProfile = URPUtilities::create_user_resource_profile(); } + return $userResourceProfile; } public static function get_user_resource_profile()
