- Модуль: location
- Путь к файлу: ~/bitrix/modules/location/lib/controller/location.php
- Класс: BitrixLocationControllerLocation
- Вызов: Location::findByExternalIdAction
public function findByExternalIdAction(string $externalId, string $sourceCode, string $languageId)
{
$result = null;
$location = ServiceLocationService::getInstance()->findByExternalId($externalId, $sourceCode, $languageId);
/* Temporary. To decrease the usage of the Google API */
if($location && $location->getId() > 0)
{
$externalLocation = ServiceLocationService::getInstance()->findByExternalId(
$externalId,
$sourceCode,
$languageId,
LOCATION_SEARCH_SCOPE_EXTERNAL
);
if($externalLocation)
{
$location->setAddress($externalLocation->getAddress());
}
}
/* */
if($location)
{
$result = BitrixLocationEntityLocationConverterArrayConverter::convertToArray($location);
}
else
{
if(ErrorService::getInstance()->hasErrors())
{
$result = AjaxJson::createError(
ErrorService::getInstance()->getErrors()
);
}
}
return $result;
}