Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
address.php
1<?php
2
4
9
16{
17 protected function init()
18 {
19 parent::init();
20 ErrorService::getInstance()->setThrowExceptionOnError(true);
21 }
22
23 protected function getDefaultPreFilters()
24 {
25 return [];
26 }
27
35 public function findById(int $addressId): array
36 {
37 $result = null;
38
39 if($address = Service\AddressService::getInstance()->findById($addressId))
40 {
41 $result = ArrayConverter::convertToArray($address);
42 }
43
44 return $result;
45 }
46
51 protected function createArrayFromAddressCollection(array $collection): array
52 {
53 $result = [];
54
55 foreach ($collection as $address)
56 {
57 $result[] = ArrayConverter::convertToArray($address);
58 }
59
60 return $result;
61 }
62
67 public static function saveAction(array $address): array
68 {
69 $entity = ArrayConverter::convertFromArray($address);
70 $result = $entity->save();
71
72 return [
73 'isSuccess' => $result->isSuccess(),
74 'errors' => $result->getErrorMessages(),
75 'address' => ArrayConverter::convertToArray($entity)
76 ];
77 }
78
84 public function deleteAction(int $addressId): \Bitrix\Main\ORM\Data\DeleteResult
85 {
86 return Service\AddressService::getInstance()->delete($addressId);
87 }
88}
static saveAction(array $address)
Definition address.php:67
createArrayFromAddressCollection(array $collection)
Definition address.php:51