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; use Bitrix\Location\Model\AreaTable; use Bitrix\Main\ORM; use Bitrix\Location\Model\EO_Area; class AreaRepository { /** * @param array $args * @return Entity\Area[] */ public function findByArguments(array $args): array { $result = []; $areasList = AreaTable::getList($args); while ($area = $areasList->fetchObject()) { $result[] = Entity\Area\Converter\OrmConverter::convertFromOrm($area); } return $result; } /** * @param string $type * @param string|null $code * @return Entity\Area|null */ public function findByTypeAndCode(string $type, ?string $code = null): ?Entity\Area { /** @var EO_Area $area */ $area = AreaTable::getList(['filter' => [ '=TYPE' => $type, '=CODE' => $code, ]])->fetchObject(); return $area ? Entity\Area\Converter\OrmConverter::convertFromOrm($area) : null; } /** * @param Entity\Area $area * @return ORM\Data\Result */ public function store(Entity\Area $area) { return Entity\Area\Converter\OrmConverter::convertToOrm($area)->save(); } }