Ejemplo n.º 1
0
 public function render($limit = 25)
 {
     $user = $this->userManager->getUserFromAuthenticator();
     $key = hash('sha256', serialize($user));
     $output = '';
     if ($this->storage->hasItem($key)) {
         //return $this->storage->getItem($key);
     }
     if ($user) {
         $notifications = $this->notificationManager->findNotificationsBySubscriber($user, $limit);
         $output = $this->renderer->render($this->template, ['notifications' => $notifications]);
         $this->storage->setItem($key, $output);
     }
     return $output;
 }
Ejemplo n.º 2
0
 /**
  * @param UuidInterface $object
  * @return $this
  */
 public function __invoke(UuidInterface $object)
 {
     $user = $this->userManager->getUserFromAuthenticator();
     $this->object = $object;
     $this->emailsActive = false;
     $this->isSubscribed = false;
     if (!is_object($user)) {
         return $this;
     }
     $this->isSubscribed = $this->subscriptionManager->isUserSubscribed($user, $object);
     if (!$this->isSubscribed) {
         return $this;
     }
     $subscription = $this->subscriptionManager->findSubscription($user, $object);
     $this->emailsActive = $subscription->getNotifyMailman();
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * @return \User\Entity\UserInterface
  */
 public function getAuthenticatedUserID()
 {
     $user = $this->userManager->getUserFromAuthenticator();
     return $user ? $user->getId() : '';
 }