/** * Displays a form to create a new Article entity. * * @Secure(roles="ROLE_USER") * @return \Symfony\Component\HttpFoundation\Response * * @access public * @author Etienne de Longeaux <*****@*****.**> */ public function newAction() { $em = $this->getDoctrine()->getManager(); $category = $this->container->get('request')->query->get('category', ''); $NoLayout = $this->container->get('request')->query->get('NoLayout'); if (!$NoLayout) { $template = "new.html.twig"; } else { $template = "new.html.twig"; } $entity = new Article(); $user = $this->container->get('security.context')->getToken()->getUser(); $blocgeneral = new Blocgeneral(); $blocgeneral->setCreatedAt(new \DateTime()); $blocgeneral->setUpdatedAt(new \Datetime()); $entity->setBlocgeneral($blocgeneral); $form = $this->createForm(new ArticleType($em, $this->container), $entity, array('show_legend' => false)); return $this->render("PluginsContentBundle:Article:{$template}", array('entity' => $entity, 'form' => $form->createView(), 'NoLayout' => $NoLayout, 'category' => $category)); }