public function getRegion() { $this->__load(); return parent::getRegion(); }
public function save(NeighborhoodEntity $neighborhood) { if ($neighborhood->getName() == null) { throw new \InvalidArgumentException("neighborhood.name may" . " not be null"); } /* * does the region already exist, if it does reset it in the neighborhood */ try { $region = $this->regionMapper()->getRegionByName($neighborhood->getRegion()->getName()); $neighborhood->setRegion($region); } catch (\Doctrine\ORM\NoResultException $e) { } if ($neighborhood->getDateTimeAdded() == null) { $neighborhood->setDateTimeAdded(date("Y-m-d H:i:s")); } $this->em->persist($neighborhood); $this->em->flush($neighborhood); }