public function setLocation(Application_Model_Geocoder_Location $location) { if ($location->getType() !== Application_Model_Geocoder_Location::TYPE_LOCALITY) { throw new Exception('Wrong location type given'); } $this->_dataWorker->setValue('idLocation', $location->getId()); $this->_location = $location; }
private function _getParentLocations(Application_Model_Geocoder_Location $addressLocation) { $locations = array(); foreach ($addressLocation->getParentLocations(array()) as $location) { /* @var Application_Model_Geocoder_Location $location */ $locations[] = $location; } return $locations; }
/** * @param stdClass $item * @param \Application_Model_Geocoder_Location_LatLng $LatLang * @return Application_Model_Geocoder_Location */ private function _initLocation(stdClass $item, Application_Model_Geocoder_Location_LatLng $LatLang) { if (!empty($item->types)) { $type = $this->_convertType($item->types[0]); if (!$type) { // if not empty type return null; } $location = !is_null($this->parentLocation) ? $this->parentLocation->addChildrenLocation($LatLang, $type) : Application_Model_Geocoder_Location::createLocation(0, $LatLang, $type); $location->setLocationName($this->getLang(), $item->long_name); $location->save(); return $location; } }
private function _isNeededLocation(Application_Model_Geocoder_Location $location, $formattedAddress, $neededTypes) { return $this->_isNeededType($neededTypes, $location->getType()) && $this->_isUniqueName($location->getName(), $formattedAddress); }