Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/location/lib/repository/ |
Upload File : |
<?php namespace Bitrix\Location\Repository; use Bitrix\Location\Entity\Source; use Bitrix\Location\Model\SourceTable; /** * Class SourceRepository * @package Bitrix\Location\Repository * @internal */ final class SourceRepository { /** @var Source\OrmConverter */ private $ormConverter; /** * SourceRepository constructor. * @param Source\OrmConverter $ormConverter */ public function __construct(Source\OrmConverter $ormConverter) { $this->ormConverter = $ormConverter; } /** * @return Source[] * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function findAll(): array { $result = []; $queryResult = SourceTable::getList(); while ($ormSource = $queryResult->fetchObject()) { $result[] = $this->ormConverter->convertFromOrm($ormSource); } return $result; } /** * @param string $code * @return Source|null * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function findByCode(string $code): ?Source { $result = null; $ormSource = SourceTable::getList( [ 'filter' => [ '=CODE' => $code ], 'limit' => 1, ] )->fetchObject(); if (!$ormSource) { return null; } return $this->ormConverter->convertFromOrm($ormSource); } /** * @param Source $source * @return \Bitrix\Main\ORM\Data\Result * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function save(Source $source) { return $this->ormConverter->convertToOrm($source)->save(); } }