Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
arearepository.php
1<?php
2
4
8use Bitrix\Location\Model\EO_Area;
9
11{
16 public function findByArguments(array $args): array
17 {
18 $result = [];
19
20 $areasList = AreaTable::getList($args);
21 while ($area = $areasList->fetchObject())
22 {
23 $result[] = Entity\Area\Converter\OrmConverter::convertFromOrm($area);
24 }
25
26 return $result;
27 }
28
34 public function findByTypeAndCode(string $type, ?string $code = null): ?Entity\Area
35 {
37 $area = AreaTable::getList(['filter' => [
38 '=TYPE' => $type,
39 '=CODE' => $code,
40 ]])->fetchObject();
41
42 return $area ? Entity\Area\Converter\OrmConverter::convertFromOrm($area) : null;
43 }
44
49 public function store(Entity\Area $area)
50 {
51 return Entity\Area\Converter\OrmConverter::convertToOrm($area)->save();
52 }
53}