Пример #1
0
 /**
  * Creates a new Site entity.
  *
  */
 public function createAction(Request $request)
 {
     $entity = new Site();
     $form = $this->createCreateForm($entity);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $node = new Node();
         $node->setTitle($entity->getLibelle());
         $entity->setNode($node);
         $node->setBloquer(true);
         $nodeCategorie = new Node();
         $nodeCategorie->setTitle("Categories");
         $nodeCategorie->setParent($node);
         $nodeCategorie->setBloquer(true);
         $nodePlacements = new Node();
         $nodePlacements->setTitle("Placements");
         $nodePlacements->setParent($node);
         $nodePlacements->setBloquer(true);
         $nodeAdmin = new Node();
         $nodeAdmin->setTitle("Administration");
         $nodeAdmin->setParent($node);
         $nodeAdmin->setBloquer(true);
         $nodeMenuAdmin = new Node();
         $nodeMenuAdmin->setTitle("Menu administration");
         $nodeMenuAdmin->setParent($nodeAdmin);
         $nodeMenuAdmin->setBloquer(true);
         $nodeConfig = new Node();
         $nodeConfig->setTitle("Configuration");
         $nodeConfig->setParent($node);
         $nodeConfig->setBloquer(true);
         $em->persist($entity);
         $em->persist($node);
         $em->persist($nodeCategorie);
         $em->persist($nodePlacements);
         $em->persist($nodeAdmin);
         $em->persist($nodeMenuAdmin);
         $em->persist($nodeConfig);
         $em->flush();
         return $this->redirect($this->generateUrl('superadmin_multi_site'));
     }
     return $this->render('MultiSiteBundle:Site:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
 }
Пример #2
0
 public function newChildAction($id)
 {
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('NodeBundle:Node')->find($id);
     $new = new Node();
     $new->setTitle("Nouvel élément");
     $new->setParent($entity);
     $em->persist($new);
     $em->flush();
     return $this->redirect($this->generateUrl('superadmin_node'));
 }