1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ormconverter.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Entity\Address\Converter;
4
5use Bitrix\Location\Entity\Address;
6use Bitrix\Location\Model\EO_Address;
7use Bitrix\Location\Model\EO_Address_Collection;
8use Bitrix\Location\Model\EO_AddressLink;
9
15final class OrmConverter
16{
25 public static function convertFromOrm(EO_Address $ormAddress): Address
26 {
27 $result = new Address($ormAddress->getLanguageId());
28 $result->setId($ormAddress->getId())
29 ->setLatitude($ormAddress->getLatitude())
30 ->setLongitude($ormAddress->getLongitude());
31
33 foreach ($ormAddress->getFields() as $field)
34 {
35 $result->setFieldValue($field->getType(), $field->getValue());
36 }
37
38 if($ormLocation = $ormAddress->getLocation())
39 {
40 $location = \Bitrix\Location\Entity\Location\Converter\OrmConverter::createLocation(
41 $ormLocation,
42 $ormAddress->getLanguageId()
43 );
44
45 if($location)
46 {
47 $result->setLocation($location);
48 }
49 }
50
51 if($links = $ormAddress->getLinks())
52 {
54 foreach ($links as $link)
55 {
56 $result->addLink($link->getEntityId(), $link->getEntityType());
57 }
58 }
59
60 return $result;
61 }
62
72 public static function convertCollectionFromOrm(EO_Address_Collection $collection): Address\AddressCollection
73 {
75
77 foreach ($collection as $item)
78 {
79 $result->addItem(self::convertFromOrm($item));
80 }
81
82 return $result;
83 }
84}
$result
Определения get_property_values.php:14
$location
Определения options.php:2729