private function importCity($name, Country $country) { $cityInfo = $this->geoInfo($name, array('featureClass' => 'P', 'country' => $country->getCountryCode())); if (!is_object($cityInfo)) { $this->logError(array('geocode', 'city', $name, $country->getName())); return; } $city = new City(); $city->setCountry($country); $city->setName($cityInfo->name); $city->setLat($cityInfo->lat); $city->setLng($cityInfo->lng); $this->getEntityManager()->persist($city); $this->getEntityManager()->flush($city); return $city; }
function __toString() { return $this->getName() . ' (' . $this->country->getName() . ')'; }