/** * @param $authId * @return boolean */ private function isLastUserWithAuthID($authId) { $guser = new Gpf_Db_User(); $guser->setAuthId($authId); try { $guser->loadFromData(array(Gpf_Db_Table_Users::AUTHID)); } catch (Gpf_Exception $e) { return false; } return true; }
private function createNotificationsForSale($saleRow) { $notificationRegistrationRow = new Gpf_Db_NotificationRegistration(); $rowCollection = $notificationRegistrationRow->loadCollection(); foreach ($rowCollection as $notificationRegistrationRow) { $accountUserId = $notificationRegistrationRow->getAccountUserId(); $notificationId = $notificationRegistrationRow->getNotificationId(); $clientType = $notificationRegistrationRow->getClientType(); $user = new Gpf_Db_User(); $user->setId($accountUserId); $user->load(); $isMerchant = $user->getRoleId() == 'pap_merc'; if ($isMerchant || $accountUserId == $saleRow->get('accountuserid')) { $this->addnotification($clientType, $notificationId, $isMerchant, $saleRow); } } }
private function checkConstraints() { try{ $this->check(); } catch (Gpf_DbEngine_Row_CheckException $e) { $exceptions = array(); foreach ($e as $constraintExeption) { if($constraintExeption instanceof Gpf_DbEngine_Row_PasswordConstraintException && $this->accountUser->getRoleId() == Pap_Application::DEFAULT_ROLE_MERCHANT) { continue; } $exceptions[] = $constraintExeption; } if(count($exceptions) > 0) { throw new Gpf_DbEngine_Row_CheckException($exceptions); } } }
private function getAccountUser($authUserId) { $accountUser = new Gpf_Db_User(); $accountUser->setAuthId($authUserId); try { $accountUser->loadFromData(array(Gpf_Db_Table_Users::AUTHID)); } catch (Exception $e) { return null; } return $accountUser; }