/** * @static * @param int $idParentLocation * @param Application_Model_Geocoder_Location_LatLng $latLng * @param int $locationType * @return Application_Model_Geocoder_Location|null|RM_Entity * @throws Exception */ public static function createLocation($idParentLocation, Application_Model_Geocoder_Location_LatLng $latLng, $locationType) { $locationType = (int) $locationType; $idParentLocation = (int) $idParentLocation; if (!in_array($locationType, self::getHierarchy())) { throw new Exception('WRONG TYPE GIVEN'); } if (($object = self::getByLatLng($latLng, $locationType)) === null) { $object = new self(new RM_Compositor(array('idLocation' => 0, 'idParentLocation' => $idParentLocation, 'locationType' => $locationType))); $object->setLatLng($latLng); } return $object; }