/**
  * Copies locality data from a locality interface to a locality entity
  * 
  * @param LocalityInterface $source      Source locality
  * @param Locality          $destination Destination locality
  */
 public function copyLocality(LocalityInterface $source, Locality $destination)
 {
     $countryRepository = $this->getCountryRepository();
     $timezoneRepository = $this->getTimezoneRepository();
     // Copy the geoname identifier
     if ($geonameIdentifier = $source->getGeonameIdentifier()) {
         $destination->setGeonameIdentifier($geonameIdentifier);
     }
     // Copy the country
     if ($country = $countryRepository->getCountry($source->getCountry())) {
         $destination->setCountry($country);
     }
     // Copy the UTF-8 encoded name
     if ($nameUtf8 = $source->getNameUtf8()) {
         $destination->setNameUtf8($nameUtf8);
     }
     // Copy the ASCII encoded name
     if ($nameAscii = $source->getNameAscii()) {
         $destination->setNameAscii($nameAscii);
     }
     // Copy the latitude
     $destination->setLatitude($source->getLatitude());
     // Copy the longitude
     $destination->setLongitude($source->getLongitude());
     // Copy the population
     $destination->setPopulation($source->getPopulation());
     // Copy the timezone
     if ($timezone = $timezoneRepository->getTimezone($source->getTimezone())) {
         $destination->setTimezone($timezone);
     }
     if ($admin1Code = $source->getAdmin1Code()) {
         $destination->setAdmin1Code($admin1Code);
     }
     if ($admin2Code = $source->getAdmin2Code()) {
         $destination->setAdmin2Code($admin2Code);
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->relation = new ArrayCollection();
 }