• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/entity/address/converter/ormconverter.php
  • Класс: Bitrix\Location\Entity\Address\Converter\OrmConverter
  • Вызов: OrmConverter::convertFromOrm
static function convertFromOrm(EO_Address $ormAddress): Address
{
	$result = new Address($ormAddress->getLanguageId());
	$result->setId($ormAddress->getId())
		->setLatitude($ormAddress->getLatitude())
		->setLongitude($ormAddress->getLongitude());

	/** @var Address\Field $field */
	foreach ($ormAddress->getFields() as $field)
	{
		$result->setFieldValue($field->getType(), $field->getValue());
	}

	if($ormLocation = $ormAddress->getLocation())
	{
		$location = \Bitrix\Location\Entity\Location\Converter\OrmConverter::createLocation(
			$ormLocation,
			$ormAddress->getLanguageId()
		);

		if($location)
		{
			$result->setLocation($location);
		}
	}

	if($links = $ormAddress->getLinks())
	{
		/** @var EO_AddressLink $link */
		foreach ($links as $link)
		{
			$result->addLink($link->getEntityId(), $link->getEntityType());
		}
	}

	return $result;
}