/** * @Route("/new") * @Template() */ public function newAction() { $blog = new \Club\WelcomeBundle\Entity\Blog(); $blog->setUser($this->getUser()); $res = $this->process($blog); if ($res instanceof RedirectResponse) { return $res; } return array('form' => $res->createView()); }
/** * @Route("/new") * @Template() */ public function newAction() { if (false === $this->get('security.context')->isGranted('ROLE_USER')) { throw new AccessDeniedException(); } $blog = new \Club\WelcomeBundle\Entity\Blog(); $blog->setUser($this->getUser()); $res = $this->process($blog); if ($res instanceof RedirectResponse) { return $res; } return array('form' => $res->createView()); }