Exemplo n.º 1
0
 public function uuidAction()
 {
     // Todo unhack
     $objects = $this->uuidManager->findAll();
     $objects = $objects->filter(function (UuidInterface $object) {
         $isGood = $object instanceof TaxonomyTermInterface || $object instanceof PageRepositoryInterface;
         $isGood = $isGood || $object instanceof EntityInterface || $object instanceof PostInterface;
         if ($object instanceof EntityInterface) {
             $name = $object->getType()->getName();
             $isGood = $isGood && $object->hasCurrentRevision() && in_array($name, ['article', 'course', 'video']);
         }
         return !$object->isTrashed() && $isGood;
     });
     $view = new ViewModel(['objects' => $objects]);
     $this->getResponse()->getHeaders()->addHeaders(['Content-Type' => 'text/html']);
     $view->setTemplate('normalizer/sitemap-uuid');
     $view->setTerminal(true);
     return $view;
 }
 public function unsubscribeAction()
 {
     if (!$this->authorizationService->getIdentity()) {
         throw new UnauthorizedException();
     }
     $object = $this->params('object');
     $user = $this->authorizationService->getIdentity();
     try {
         $object = $this->uuidManager->getUuid($object);
     } catch (NotFoundException $e) {
         $this->getResponse()->setStatusCode(404);
         return false;
     }
     $this->subscriptionManager->unSubscribe($user, $object);
     $this->subscriptionManager->flush();
     $this->flashMessenger()->addSuccessMessage('You are no longer receiving notifications for this content.');
     return $this->redirect()->toReferer();
 }