Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
collection.php
1<?php
2
4
8
15{
17 protected $items = [];
18
19 public function addItem($location): int
20 {
21 if(!($location instanceof Location))
22 {
23 throw new ArgumentTypeException('location must be the instance of Location');
24 }
25
26 return parent::addItem($location);
27 }
28
32 public function save(): Result
33 {
34 $result = new Result();
35
36 foreach($this->items as $location)
37 {
38 $res = $location->save();
39
40 if(!$res->isSuccess())
41 {
42 $result->addErrors($res->getErrors());
43 }
44 }
45
46 return $result;
47 }
48}