/** * Displays a form to create a new Page entity. * * @Route("/{sectionid}/{pageid}/new", name="pages_new") * @Method("GET") * @Template() */ public function newAction($sectionid, $pageid) { if (false === $this->get('security.context')->isGranted('ROLE_PAGEADMIN')) { throw new AccessDeniedException(); } $em = $this->getDoctrine()->getManager(); $section = $em->getRepository('EnglishPagesBundle:Section')->find($sectionid); $parent = $em->getRepository('EnglishPagesBundle:Page')->find($pageid); $sort = 1; $page = new Page(); $page->setSection($section); $page->setParent($parent); $page->setSortorder($sort); $form = $this->createCreateForm($page); $label = $em->getRepository('EnglishFilesBundle:Label')->findNewsletterLabel(); $labelid = $label->getId(); return array('page' => $page, 'form' => $form->createView(), 'labelid' => $labelid); }