• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/entity/location/factory/ormfactory.php
  • Класс: BitrixLocationEntityLocationFactoryOrmFactory
  • Вызов: OrmFactory::createLocation
static function createLocation(EO_Location $ormLocation, string $languageId): Location
{
	$result = (new Location())
		->setId($ormLocation->getId())
		->setCode($ormLocation->getCode())
		->setExternalId($ormLocation->getExternalId())
		->setSourceCode($ormLocation->getSourceCode())
		->setType(($ormLocation->getType()))
		->setLatitude($ormLocation->getLatitude())
		->setLongitude($ormLocation->getLongitude());

	if($fields = $ormLocation->getFields())
	{
		/** @var LocationField $field */
		foreach($fields as $field)
		{
			$result->setFieldValue($field->getType(), $field->getValue());
		}
	}

	foreach($ormLocation->getName() as $ormName)
	{
		if($ormName->getLanguageId() === $languageId || $ormName->getLanguageId() == '')
		{
			$result->setName($ormName->getName());
			$result->setLanguageId($ormName->getLanguageId());

			if($ormName->getLanguageId() === $languageId)
			{
				break;
			}
		}
	}

	return $result;
}