コード例 #1
0
 /**
  * @param FullPlaceResult $place
  * @return Address
  *
  * @throws UnresolvedGeonameException
  */
 public function createFromFullPlaceResult(FullPlaceResult $place)
 {
     $address = new Address();
     $address->setCity($place->getCity());
     $address->setLat($place->getLatitude());
     $address->setLng($place->getLongitude());
     $address->setCountry($place->getCountry());
     $address->setCountryCode($place->getCountryCode());
     $address->setFormattedAddress($place->getFormattedAddress());
     $address->setRegion($place->getRegion());
     $address->setRegionCode($place->getRegionCode());
     $address->setCounty($place->getCounty());
     $address->setCountyCode($place->getCountyCode());
     $address->setCity($place->getCity());
     $address->setPostalCode($place->getPostalCode());
     $address->setStreetName($place->getStreetName());
     $address->setStreetNumber($place->getStreetNumber());
     $geoname = $this->geonameRepository->getOneByAddress($address);
     $address->setGeoname($geoname);
     return $address;
 }
コード例 #2
0
 /**
  * @param ResultInterface $result
  *
  * @return Address
  */
 public function geocoderResultToAddress(ResultInterface $result)
 {
     $address = new Address();
     $address->setCity($result->getCity());
     $address->setCountry($result->getCountry());
     $address->setCountryCode($result->getCountryCode());
     $address->setRegion($result->getRegion());
     $address->setRegionCode($result->getRegionCode());
     $address->setCounty($result->getCounty());
     $address->setCountyCode($result->getCountyCode());
     $address->setLat($result->getLatitude());
     $address->setLng($result->getLongitude());
     $address->setPostalCode($result->getZipcode());
     $address->setStreetName($result->getStreetName());
     $address->setStreetNumber($result->getStreetNumber());
     $this->addressManager->updateFormattedAddress($address);
     return $address;
 }