public function loadAldeaCoord(ObjectManager $manager) { $aldeaCoord = array(array('1', 9, '23150102')); $em = $this->container->get('doctrine')->getEntityManager('default'); foreach ($aldeaCoord as $data) { $entityAldeaCoord = new AldeaCoord(); /*$entityAldeaCoord->setId($data[0]);*/ $entityPersona = $em->getRepository('AppBundle:Persona')->find($data[1]); $entityAldeaCoord->setPersona($entityPersona); $entityAldea = $em->getRepository('AppBundle:Aldea')->find($data[2]); $entityAldeaCoord->setAldea($entityAldea); $manager->persist($entityAldeaCoord); } $manager->flush(); }
/** * Set coord * * @param \AppBundle\Entity\AldeaCoord $coord * @return Aldea */ public function setCoord(\AppBundle\Entity\AldeaCoord $coord = null) { $this->coord = $coord; $this->coord->setAldea($this); return $this; }