Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
error.php
1
<?php
2
namespace
Bitrix\Landing
;
3
4
class
Error
5
{
10
protected
$errors
= array();
11
18
public
function
addError
($code, $message=
''
)
19
{
20
$this->errors[] = new \Bitrix\Main\Error($message !=
''
? $message : $code, $code);
21
}
22
28
public
function
copyError
(\
Bitrix
\
Landing
\
Error
$error)
29
{
30
foreach
($error->getErrors() as $err)
31
{
32
$this->errors[] = $err;
33
}
34
}
35
40
public
function
getFirstError
()
41
{
42
if
($this->errors)
43
{
44
$errors
= array_values($this->errors);
45
return
array_shift(
$errors
);
46
}
47
return
null
;
48
}
49
54
public
function
getErrors
()
55
{
56
return
$this->errors
;
57
}
58
63
public
function
isEmpty
()
64
{
65
return
empty($this->errors);
66
}
67
73
public
function
addFromResult
($result)
74
{
75
if
(
76
(
77
$result instanceof \
Bitrix
\Main\
Result
||
78
$result instanceof \
Bitrix
\Main\
Entity
\
AddResult
||
79
$result instanceof \
Bitrix
\Main\
Entity
\
UpdateResult
||
80
$result instanceof \
Bitrix
\Main\
Entity
\
DeleteResult
81
) && !$result->isSuccess()
82
)
83
{
84
foreach
($result->getErrors() as $error)
85
{
86
$this->
addError
(
87
$error->getCode(),
88
$error->getMessage()
89
);
90
}
91
}
92
}
93
}
Bitrix\Landing\Binding\Entity
Definition
entity.php:11
Bitrix\Landing\Connector\Landing
Definition
landing.php:12
Bitrix\Landing\Error
Definition
error.php:5
Bitrix\Landing\Error\getFirstError
getFirstError()
Definition
error.php:40
Bitrix\Landing\Error\addFromResult
addFromResult($result)
Definition
error.php:73
Bitrix\Landing\Error\getErrors
getErrors()
Definition
error.php:54
Bitrix\Landing\Error\copyError
copyError(\Bitrix\Landing\Error $error)
Definition
error.php:28
Bitrix\Landing\Error\$errors
$errors
Definition
error.php:10
Bitrix\Landing\Error\isEmpty
isEmpty()
Definition
error.php:63
Bitrix\Landing\Error\addError
addError($code, $message='')
Definition
error.php:18
Bitrix\Main\ORM\Data\AddResult
Definition
addresult.php:12
Bitrix\Main\ORM\Data\DeleteResult
Definition
deleteresult.php:12
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\ORM\Data\UpdateResult
Definition
updateresult.php:14
Bitrix\Landing
Definition
agent.php:2
Bitrix
modules
landing
lib
error.php
Создано системой
1.10.0