Exemplo n.º 1
0
 /**
  * @param $cookieData
  *
  * @return mixed
  * @throws \mpcmf\modules\moduleBase\exceptions\modelException
  * @throws mapperException
  */
 public function getCurrentUser($cookieData)
 {
     if (!$cookieData) {
         static $guestCacheKey = 'acl/user/guest';
         if (!($guestData = cache::getCached($guestCacheKey))) {
             $guestModel = userMapper::getInstance()->getGuestUser();
             /** @noinspection ReferenceMismatchInspection */
             $guestData = $guestModel->export();
             cache::setCached($guestCacheKey, $guestData, 3600);
         } else {
             $guestModel = userModel::fromArray($guestData);
         }
         return $guestModel;
     }
     $userId = $cookieData[userMapper::FIELD__USER_ID];
     $userCacheKey = "acl/user/{$userId}";
     if (!($userData = cache::getCached($userCacheKey))) {
         $userModel = userMapper::getInstance()->getById($userId);
         /** @noinspection ReferenceMismatchInspection */
         $userData = $userModel->export();
         cache::setCached($userCacheKey, $userData, 300);
     } else {
         $userModel = userModel::fromArray($userData);
     }
     return $userModel;
 }
Exemplo n.º 2
0
 public function getInvitesByUserModel(userModel $userModel)
 {
     return $this->getInvitesByUserId($userModel->getIdValue());
 }