Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
addressservice.php
1<?php
2
4
6use Bitrix\Location\Common\RepositoryTrait;
12
13Loc::loadMessages(__FILE__);
14
22final class AddressService extends BaseService
23{
24 use RepositoryTrait;
25
27 protected static $instance;
28
30 protected $repository;
31
38 public function findById(int $addressId)
39 {
40 $result = false;
41
42 try
43 {
44 $result = $this->repository->findById($addressId);
45 }
46 catch (RuntimeException $exception)
47 {
48 $this->processException($exception);
49 }
50
51 return $result;
52 }
53
61 public function findByLinkedEntity(string $entityId, string $entityType): Entity\Address\AddressCollection
62 {
63 $result = false;
64
65 try
66 {
67 $result = $this->repository->findByLinkedEntity($entityId, $entityType);
68 }
69 catch (RuntimeException $exception)
70 {
71 $this->processException($exception);
72 }
73
74 return $result;
75 }
76
83 public function save(Entity\Address $address)
84 {
85 return $this->repository->save($address);
86 }
87
94 public function delete(int $addressId): \Bitrix\Main\ORM\Data\DeleteResult
95 {
96 return $this->repository->delete($addressId);
97 }
98
105 public function isLimitReached(): bool
106 {
107 return false;
108 }
109
114 protected function __construct(Container $config)
115 {
116 $this->setRepository($config->get('repository'));
117 parent::__construct($config);
118 }
119}
processException(\Exception $exception)
findByLinkedEntity(string $entityId, string $entityType)
static loadMessages($file)
Definition loc.php:64