/**
  * Displays a form to create a new Zone entity.
  *
  */
 public function newAction($idPlace)
 {
     $em = $this->getDoctrine()->getManager();
     $place = $em->getRepository('JarryUbuBundle:Place')->findOneById($idPlace);
     $entity = new Zone();
     $entity->setPlace($place);
     $form = $this->createCreateForm($entity, $idPlace);
     $form->add('submit', SubmitType::class, array('label' => 'Créer', 'attr' => array('class' => 'mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-color--indigo-100 mdl-color-text--purple-400 table_btn2')));
     return $this->render('JarryUbuBundle:Zone:new.html.twig', array('entity' => $entity, 'form' => $form->createView(), 'btnCss' => $this->container->getparameter('btnCss'), 'navCss' => $this->container->getparameter('navCss'), 'navDarkCss' => $this->container->getparameter('navDarkCss'), 'titreCss' => $this->container->getparameter('titreCss'), 'containerCss' => $this->container->getparameter('containerCss'), 'carreClicCss' => $this->container->getparameter('carreClicCss'), 'carreNewCss' => $this->container->getparameter('carreNewCss'), 'carreTextCss' => $this->container->getParameter('carreTextCss')));
 }
Exemplo n.º 2
0
 public function load(ObjectManager $em)
 {
     $places = ['maison', 'bicoque', 'bidonville', 'lupanard', 'chateau', 'manoir', 'villa', 'residence'];
     $zones = ['chambre', 'cuisine', 'séjour', 'couloir', 'salle_de_bain'];
     foreach ($places as $placeName) {
         foreach ($zones as $zoneName) {
             $entity = new Zone();
             $entity->setPlace($em->merge($this->getReference('place-' . $placeName)));
             $entity->setName($zoneName);
             $entity->setInOutStatus(FALSE);
             $entity->setPostLat(2.25);
             $entity->setPostLong(5.75);
             $entity->setPosAlt(4.05);
             $entity->setOctoX(0.75);
             $entity->setOctoY(0.35);
             $entity->setOctoZ(78.3);
             $em->persist($entity);
             $this->addReference('zone-' . $placeName . '-' . $zoneName, $entity);
         }
     }
     $em->flush();
 }