/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; $this->printer->setOutput($output); $city = $input->getOption('city'); $euroTop = $input->getOption('euroTop'); $usTop = $input->getOption('usTop'); $geonamesCount = $input->getOption('geonamesCount'); $geonames = array(); if ($city) { $geonames[] = $this->entityManager->find(Geoname::CLASS_NAME, $city); } if ($euroTop) { $geonames = $this->geonameRepository->findEuroTop($geonamesCount); } if ($usTop) { $geonames = $this->geonameRepository->findUsTop($geonamesCount); } $geonames = $this->applyOffset($geonames); foreach ($geonames as $geoname) { $this->printer->writelnEntityShort($geoname); $this->importCity($geoname); } }
/** * @param int $id * * @ApiDoc( * description="GooglePlace search", * statusCodes={200="Address GooglePlace"}, * section="Google Place") * @Route("/api/google-places/place-results/{id}") * @throws BadRequestException * @Method({"GET"}) * @Cache(maxage="+1 week", public=true) * @return View */ public function getAction($id) { $place = $this->googlePlaceClient->detail($id); $address = new Address(); $address->setCity($place->getCity()); $address->setLat($place->getLatitude()); $address->setLng($place->getLongitude()); $geoname = $this->geonameRepository->getOneByAddress($address); $place->setGeoname($geoname); return $this->view(array('placeResult' => $place)); }
/** * @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; }
/** * getFeaturedGeonames */ protected function getFeaturedGeonames() { $geonames = $this->geonameRepository->getFeatured(); return $this->view(array('geonames' => $geonames)); }