예제 #1
0
 public function indexAction()
 {
     $em = $this->getDoctrine()->getEntityManager();
     $entity = $em->getRepository('WeatherBundle:DataSource')->findById(2);
     $ds = new DataSource();
     $ds->setLocation(array(12, 45));
     $ds->setName('Fastov_source');
     $ds->setTemperature(24);
     $city = new City();
     $city->setName('Fastov');
     $city->setCityLocation(array(12, 74));
     $city->setPopulation(50000);
     /*$ds->addCity($city);
     
             $em->persist($ds);
     
             $em->persist($city);
             $em->flush();*/
     foreach ($entity as $a) {
         echo dump($a->getCities()->getValues());
     }
     exit;
     return $this->render('WeatherBundle:Default:index.html.twig');
 }
예제 #2
0
 /**
  * Creates a form to delete a City entity.
  *
  * @param City $city The City entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(City $city)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('city_delete', array('id' => $city->getId())))->setMethod('DELETE')->getForm();
 }