Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
result.php
1
<?php
9
namespace
Bitrix\Main
;
10
11
use
Bitrix\Main\DB\SqlExpression
;
12
13
class
Result
14
{
16
protected
$isSuccess
=
true
;
17
19
protected
$errors
;
20
22
protected
$data
= array();
23
24
public
function
__construct
()
25
{
26
$this->errors =
new
ErrorCollection
();
27
}
28
29
public
function
__clone
()
30
{
31
$this->errors = clone
$this->errors
;
32
}
33
39
public
function
isSuccess
()
40
{
41
return
$this->isSuccess
;
42
}
43
50
public
function
addError
(
Error
$error)
51
{
52
$this->
isSuccess
=
false
;
53
$this->errors[] = $error;
54
return
$this;
55
}
56
62
public
function
getErrors
()
63
{
64
return
$this->errors->toArray();
65
}
66
72
public
function
getErrorCollection
()
73
{
74
return
$this->errors
;
75
}
76
82
public
function
getErrorMessages
()
83
{
84
$messages = array();
85
86
foreach
($this->
getErrors
() as $error)
87
$messages[] = $error->getMessage();
88
89
return
$messages;
90
}
91
98
public
function
addErrors
(array
$errors
)
99
{
100
if
(
$errors
)
101
{
102
$this->
isSuccess
=
false
;
103
$this->errors->add(
$errors
);
104
}
105
return
$this;
106
}
107
113
public
function
setData
(array
$data
)
114
{
115
// do not save sql expressions
116
foreach
(
$data
as $k => $v)
117
{
118
if
($v instanceof
SqlExpression
)
119
{
120
unset(
$data
[$k]);
121
}
122
}
123
124
$this->data =
$data
;
125
126
return
$this;
127
}
128
133
public
function
getData
()
134
{
135
return
$this->data
;
136
}
137
}
Bitrix\Main\DB\SqlExpression
Definition
sqlexpression.php:19
Bitrix\Main\ErrorCollection
Definition
errorcollection.php:14
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\ORM\Data\Result\getErrors
getErrors()
Definition
result.php:67
Bitrix\Main\Result\addError
addError(Error $error)
Definition
result.php:50
Bitrix\Main\Result\__construct
__construct()
Definition
result.php:24
Bitrix\Main\Result\addErrors
addErrors(array $errors)
Definition
result.php:98
Bitrix\Main\Result\$isSuccess
$isSuccess
Definition
result.php:16
Bitrix\Main\Result\isSuccess
isSuccess()
Definition
result.php:39
Bitrix\Main\Result\getErrors
getErrors()
Definition
result.php:62
Bitrix\Main\Result\$data
$data
Definition
result.php:22
Bitrix\Main\Result\getData
getData()
Definition
result.php:133
Bitrix\Main\Result\setData
setData(array $data)
Definition
result.php:113
Bitrix\Main\Result\getErrorCollection
getErrorCollection()
Definition
result.php:72
Bitrix\Main\Result\$errors
$errors
Definition
result.php:19
Bitrix\Main\Result\__clone
__clone()
Definition
result.php:29
Bitrix\Main\Result\getErrorMessages
getErrorMessages()
Definition
result.php:82
Bitrix\Main
modules
main
lib
result.php
Создано системой
1.10.0