1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
result.php
См. документацию.
1<?php
2namespace Bitrix\Sale;
3
4use Bitrix\Main\Entity;
5use Bitrix\Main\Error;
6use Bitrix\Main\ErrorCollection;
7
9{
11 protected $id;
12
13 protected $warnings = array();
14
16 protected $isSuccess = true;
17
18 public function __construct()
19 {
20 $this->warnings = new ErrorCollection();
21 parent::__construct();
22 }
23
24 public function setId($id)
25 {
26 $this->id = $id;
27 }
28
33 public function getId()
34 {
35 return $this->id;
36 }
37
38 public function __destruct()
39 {
40 //just quietly die in contrast Entity\Result either checked errors or not.
41 }
42
43 public function addData(array $data)
44 {
45 if (is_array($this->data))
46 {
47 $this->data = $this->data + $data;
48 }
49 else
50 {
51 $this->data = $data;
52 }
53 }
54
55 public function get($offset)
56 {
57 if (isset($this->data[$offset]) || array_key_exists($offset, $this->data))
58 {
59 return $this->data[$offset];
60 }
61
62 return null;
63 }
64
65 public function set($offset, $value)
66 {
67 if ($offset === null)
68 {
69 $this->data[] = $value;
70 }
71 else
72 {
73 $this->data[$offset] = $value;
74 }
75 }
76
82 public function addWarnings(array $errors)
83 {
85 foreach ($errors as $error)
86 {
87 $this->addWarning(ResultWarning::create($error));
88 }
89 }
90
96 public function addWarning(Error $error)
97 {
98 $this->warnings[] = $error;
99 }
100
107 public function addError(Error $error)
108 {
109 if ($error instanceof ResultWarning)
110 {
111 static::addWarning($error);
112 }
113 else
114 {
115 $this->isSuccess = false;
116 $this->errors[] = $error;
117 }
118
119 return $this;
120 }
121
127 public function getWarnings()
128 {
129 return $this->warnings->toArray();
130 }
131
137 public function getWarningMessages()
138 {
139 $messages = array();
140
141 foreach($this->getWarnings() as $warning)
142 $messages[] = $warning->getMessage();
143
144 return $messages;
145 }
146
147
151 public function hasWarnings()
152 {
153 return (count($this->warnings));
154 }
155
156
157}
158
160 extends Entity\EntityError
161{
167 public static function create(Error $error)
168 {
169 return new static($error->getMessage(), $error->getCode());
170 }
171}
172
174 extends ResultError
175{
176
177}
178
180 extends ResultError
181{
182
183}
Определения error.php:15
isSuccess($internalCall=false)
Определения result.php:47
$data
Определения result.php:22
static create(Error $error)
Определения result.php:167
addError(Error $error)
Определения result.php:107
__construct()
Определения result.php:18
getId()
Определения result.php:33
$isSuccess
Определения result.php:16
__destruct()
Определения result.php:38
$warnings
Определения result.php:13
addData(array $data)
Определения result.php:43
addWarning(Error $error)
Определения result.php:96
setId($id)
Определения result.php:24
getWarningMessages()
Определения result.php:137
getWarnings()
Определения result.php:127
hasWarnings()
Определения result.php:151
$id
Определения result.php:11
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$errors
Определения iblock_catalog_edit.php:74
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$messages
Определения template.php:8
$error
Определения subscription_card_product.php:20