Current Path : /var/www/axolotl/data/www/nn.axolotls.ru/bitrix/modules/location/lib/service/ |
Current File : /var/www/axolotl/data/www/nn.axolotls.ru/bitrix/modules/location/lib/service/addressservice.php |
<?php namespace Bitrix\Location\Service; use Bitrix\Location\Common\BaseService; use Bitrix\Location\Common\RepositoryTrait; use Bitrix\Location\Entity; use Bitrix\Location\Exception\RuntimeException; use Bitrix\Location\Infrastructure\Service\Config\Container; use Bitrix\Location\Repository\AddressRepository; /** * Class Address * @package Bitrix\Location\Service */ final class AddressService extends BaseService { use RepositoryTrait; /** @var AddressService */ protected static $instance; /** @var AddressRepository */ protected $repository; /** * @param int $id * @return Entity\Address|bool|null * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function findById(int $id) { $result = false; try { $result = $this->repository->findById($id); } catch (RuntimeException $exception) { $this->processException($exception); } return $result; } /** * @param string $entityId * @param string $entityType * @return Entity\Address\AddressCollection * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function findByLinkedEntity(string $entityId, string $entityType): Entity\Address\AddressCollection { $result = false; try { $result = $this->repository->findByLinkedEntity($entityId, $entityType); } catch (RuntimeException $exception) { $this->processException($exception); } return $result; } /** * @param Entity\Address $address * @return \Bitrix\Main\ORM\Data\AddResult|\Bitrix\Main\ORM\Data\Result|\Bitrix\Main\ORM\Data\UpdateResult */ public function save(Entity\Address $address) { return $this->repository->save($address); } /** * @param int $addressId * @return \Bitrix\Main\ORM\Data\DeleteResult * @throws \Exception */ public function delete(int $addressId) { return $this->repository->delete($addressId); } /** * AddressService constructor. * @param Container $config */ protected function __construct(Container $config) { $this->setRepository($config->get('repository')); parent::__construct($config); } }