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'); }
/** * 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(); }