1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
locationservice.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Service;
4
5use Bitrix\Location\Exception\RuntimeException;
6use Bitrix\Location\Common\BaseService;
7use Bitrix\Main\Result;
8use Bitrix\Location\Entity;
9use Bitrix\Location\Repository\LocationRepository;
10use Bitrix\Location\Infrastructure\Service\Config;
11use Bitrix\Location\Common\RepositoryTrait;
12
20final class LocationService extends BaseService
21{
22 use RepositoryTrait;
23
25 protected static $instance;
26
28 protected $repository = null;
29
38 public function findById(int $locationId, string $languageId, int $searchScope = LOCATION_SEARCH_SCOPE_ALL)
39 {
40 $result = false;
41
42 try
43 {
44 $result = $this->repository->findById($locationId, $languageId, $searchScope);
45 }
46 catch (RuntimeException $exception)
47 {
48 $this->processException($exception);
49 }
50
51 return $result;
52 }
53
63 public function findByExternalId(string $externalId, string $sourceCode, string $languageId, int $searchScope = LOCATION_SEARCH_SCOPE_ALL)
64 {
65 $result = false;
66
67 try
68 {
69 $result = $this->repository->findByExternalId($externalId, $sourceCode, $languageId, $searchScope);
70 }
71 catch (RuntimeException $exception)
72 {
73 $this->processException($exception);
74 }
75
76 return $result;
77 }
78
88 public function findByCoords(
89 float $lat,
90 float $lng,
91 int $zoom,
92 string $languageId
94 {
95 try
96 {
97 return $this->repository->findByCoords(
98 $lat,
99 $lng,
100 $zoom,
101 $languageId,
103 );
104 }
105 catch (RuntimeException $exception)
106 {
107 $this->processException($exception);
108 }
109
110 return null;
111 }
112
118 public function autocomplete(array $params, int $searchScope = LOCATION_SEARCH_SCOPE_ALL)
119 {
120 $result = [];
121
122 try
123 {
124 $result = $this->repository->autocomplete($params, $searchScope);
125 }
126 catch (RuntimeException $exception)
127 {
128 $this->processException($exception);
129 }
130
131 return $result;
132 }
133
143 public function findParents(Entity\Location $location, string $languageId, int $searchScope = LOCATION_SEARCH_SCOPE_ALL)
144 {
145 $result = false;
146
147 try
148 {
149 $result = $this->repository->findParents($location, $languageId, $searchScope);
150 }
151 catch (RuntimeException $exception)
152 {
153 $this->processException($exception);
154 }
155
156 return $result;
157 }
158
166 {
167 return $this->repository->save($location);
168 }
169
176 public function delete(Entity\Location $location): Result
177 {
178 return $this->repository->delete($location);
179 }
180
187 {
188 $this->setRepository($config->get('repository'));
189
190 parent::__construct($config);
191 }
192
200 public function saveParents(Entity\Location\Parents $parents): Result
201 {
202 return $this->repository->saveParents($parents);
203 }
204}
processException(\Exception $exception)
Определения baseservice.php:38
findByCoords(float $lat, float $lng, int $zoom, string $languageId)
Определения locationservice.php:88
findByExternalId(string $externalId, string $sourceCode, string $languageId, int $searchScope=LOCATION_SEARCH_SCOPE_ALL)
Определения locationservice.php:63
findById(int $locationId, string $languageId, int $searchScope=LOCATION_SEARCH_SCOPE_ALL)
Определения locationservice.php:38
findParents(Entity\Location $location, string $languageId, int $searchScope=LOCATION_SEARCH_SCOPE_ALL)
Определения locationservice.php:143
save(Entity\Location $location)
Определения locationservice.php:165
saveParents(Entity\Location\Parents $parents)
Определения locationservice.php:200
autocomplete(array $params, int $searchScope=LOCATION_SEARCH_SCOPE_ALL)
Определения locationservice.php:118
__construct(Config\Container $config)
Определения locationservice.php:186
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
const LOCATION_SEARCH_SCOPE_EXTERNAL
Определения include.php:5
const LOCATION_SEARCH_SCOPE_ALL
Определения include.php:3
Определения ufield.php:9
$config
Определения quickway.php:69
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$location
Определения options.php:2729