function newcommentAction() { if (!$this->user->isLoggedIn()) { throw new \Exception('User not logged in.'); } $this->postsRepo->newComment($this->getParameter('id'), $this->user->getId(), $_POST['text']); header('Location: index.php?controller=Post&action=default&id=' . $this->getParameter('id')); }