public function updateAction() { if (!$this->authorizationService->getIdentity()) { throw new UnauthorizedException(); } $object = $this->params('object'); $email = $this->params('email', false); $user = $this->authorizationService->getIdentity(); try { $object = $this->uuidManager->getUuid($object); $this->subscriptionManager->update($user, $object, $email); $this->subscriptionManager->flush(); $this->flashMessenger()->addSuccessMessage('Your subscription has been updated successfully.'); } catch (NotFoundException $e) { $this->flashMessenger()->addErrorMessage('The object you are trying to subscribe to does not exist.'); } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage('You can\'t update your subscription because you did not subscribe to this object.'); } return $this->redirect()->toReferer(); }