コード例 #1
0
ファイル: DefaultController.php プロジェクト: Hutte/TruckUber
 /**
  * @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
ファイル: Users.php プロジェクト: Hutte/TruckUber
 public function addLocation(Location $loc)
 {
     $loc->addUser($this);
     // synchronously updating inverse side
     $this->location[] = $loc;
 }