Пример #1
0
 /**
  * @Route("/h")
  * @Template()
  */
 public function locationFormAction(Request $request)
 {
     $task = new Location();
     $task->setX(5);
     $task->setY(7);
     $form = $this->createForm(new LocationType(), $task);
     if ($form->isValid()) {
         $this->addFlash('notice', 'Your changes were saved!');
         $em = $this->getDoctrine()->getManager();
         $em->persist($form->getData());
         $em->flush();
     }
     return $this->render('@Tuber/Default/new.html.twig', array('form' => $form->createView()));
 }
Пример #2
0
 public function addLocation(Location $loc)
 {
     $loc->addUser($this);
     // synchronously updating inverse side
     $this->location[] = $loc;
 }