Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
dbfieldconverter.php
1<?php
2
4
7
14{
21 public static function convertToDbFields(Entity\Location $location): array
22 {
23 $result = [];
24
25 if (($location->getId() > 0))
26 {
27 $result['ID'] = $location->getId();
28 }
29
30 $latitude = $location->getLatitude();
31 $longitude = $location->getLongitude();
32
33 $result['CODE'] = $location->getCode();
34 $result['EXTERNAL_ID'] = $location->getExternalId();
35 $result['SOURCE_CODE'] = $location->getSourceCode();
36 $result['TYPE'] = $location->getType();
37 $result['LATITUDE'] = $latitude === '' ? null : (float)$latitude;
38 $result['LONGITUDE'] = $longitude === '' ? null : (float)$longitude;
39
40 return $result;
41 }
42
49 public static function convertNameToDbFields(Entity\Location $location): array
50 {
51 $normalizer = Builder::build($location->getLanguageId());
52
53 return [
54 'NAME' => $location->getName(),
55 'LANGUAGE_ID' => $location->getLanguageId(),
56 'LOCATION_ID' => $location->getId(),
57 'NAME_NORMALIZED' => $normalizer->normalize(
58 $location->getName()
59 )
60 ];
61 }
62}