1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
action.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Engine
;
4
5
6
use
Bitrix\Main\Error
;
7
use
Bitrix\Main\ErrorCollection
;
8
use
Bitrix\Main\Errorable
;
9
use
Bitrix\Main\SystemException
;
10
16
class
Action
implements
Errorable
17
{
19
protected
$binder
;
21
protected
$errorCollection
;
23
protected
$controller
;
25
protected
$config
;
27
protected
$name
;
28
29
public
function
__construct
(
$name
,
Controller
$controller
,
$config
=
array
())
30
{
31
$this->errorCollection =
new
ErrorCollection
;
32
$this->controller =
$controller
;
33
$this->config =
$config
;
34
$this->name =
$name
;
35
36
if
(isset(
$config
[
'configure'
]))
37
{
38
$this->
configure
(
$config
[
'configure'
]);
39
}
40
41
$this->
init
();
42
}
43
50
public
function
configure
(
$params
)
51
{}
52
53
protected
function
init
()
54
{}
55
62
final
public
function
getArguments
()
63
{
64
$binder
= $this->
buildBinder
()->getBinder();
65
66
return
$binder
->getMethodParams();
67
}
68
79
final
public
function
setArguments
(
array
$arguments)
80
{
81
$binder
= $this->
buildBinder
()->getBinder();
82
83
return
$binder
->setMethodParams($arguments);
84
}
85
86
protected
function
buildBinder
()
87
{
88
if
($this->binder ===
null
)
89
{
90
if
(!method_exists($this,
'run'
))
91
{
92
throw
new
SystemException
(static::className() .
' must implement run()'
);
93
}
94
95
$controller
= $this->
getController
();
96
$this->binder =
AutoWire\ControllerBinder::buildForMethod
($this,
'run'
)
97
->setController(
$controller
)
98
->setSourcesParametersToMap(
$controller
->getSourceParametersList())
99
->setAutoWiredParameters(
100
array_filter(array_merge(
101
[
$controller
->getPrimaryAutoWiredParameter()],
102
$controller
->getAutoWiredParameters()
103
))
104
)
105
;
106
}
107
108
return
$this;
109
}
110
111
public
function
runWithSourceParametersList
()
112
{
113
$binder
= $this->
buildBinder
()->getBinder();
114
if
($this->
onBeforeRun
())
115
{
117
$result
=
$binder
->invoke();
118
119
$this->
onAfterRun
();
120
121
return
$result
;
122
}
123
124
return
null
;
125
}
126
130
final
public
function
getBinder
()
131
{
132
return
$this->binder
;
133
}
134
138
final
public
function
getController
()
139
{
140
return
$this->controller
;
141
}
142
146
final
public
function
getName
()
147
{
148
return
$this->name
;
149
}
150
154
final
public
function
getConfig
()
155
{
156
return
$this->config
;
157
}
158
159
protected
function
onBeforeRun
()
160
{
161
return
true
;
162
}
163
164
protected
function
onAfterRun
()
165
{
166
}
167
168
final
public
function
getCurrentUser
()
169
{
170
return
$this->
getController
()->getCurrentUser();
171
}
172
180
public
function
convertKeysToCamelCase
(
$data
)
181
{
182
return
$this->
getController
()->convertKeysToCamelCase(
$data
);
183
}
184
189
final
public
static
function
className
()
190
{
191
return
get_called_class();
192
}
193
200
protected
function
addError
(
Error
$error
)
201
{
202
$this->errorCollection[] =
$error
;
203
204
return
$this;
205
}
206
213
protected
function
addErrors
(
array
$errors
)
214
{
215
$this->errorCollection->add(
$errors
);
216
217
return
$this;
218
}
219
224
final
public
function
getErrors
()
225
{
226
return
$this->errorCollection->toArray();
227
}
228
234
final
public
function
getErrorByCode
(
$code
)
235
{
236
return
$this->errorCollection->getErrorByCode(
$code
);
237
}
238
}
Bitrix\Main\Engine\Action
Определения
action.php:17
Bitrix\Main\Engine\Action\addError
addError(Error $error)
Определения
action.php:200
Bitrix\Main\Engine\Action\configure
configure($params)
Определения
action.php:50
Bitrix\Main\Engine\Action\buildBinder
buildBinder()
Определения
action.php:86
Bitrix\Main\Engine\Action\onBeforeRun
onBeforeRun()
Определения
action.php:159
Bitrix\Main\Engine\Action\getArguments
getArguments()
Определения
action.php:62
Bitrix\Main\Engine\Action\convertKeysToCamelCase
convertKeysToCamelCase($data)
Определения
action.php:180
Bitrix\Main\Engine\Action\addErrors
addErrors(array $errors)
Определения
action.php:213
Bitrix\Main\Engine\Action\$controller
$controller
Определения
action.php:23
Bitrix\Main\Engine\Action\getName
getName()
Определения
action.php:146
Bitrix\Main\Engine\Action\$config
$config
Определения
action.php:25
Bitrix\Main\Engine\Action\__construct
__construct($name, Controller $controller, $config=array())
Определения
action.php:29
Bitrix\Main\Engine\Action\init
init()
Определения
action.php:53
Bitrix\Main\Engine\Action\setArguments
setArguments(array $arguments)
Определения
action.php:79
Bitrix\Main\Engine\Action\getConfig
getConfig()
Определения
action.php:154
Bitrix\Main\Engine\Action\getErrors
getErrors()
Определения
action.php:224
Bitrix\Main\Engine\Action\$errorCollection
$errorCollection
Определения
action.php:21
Bitrix\Main\Engine\Action\onAfterRun
onAfterRun()
Определения
action.php:164
Bitrix\Main\Engine\Action\getBinder
getBinder()
Определения
action.php:130
Bitrix\Main\Engine\Action\$binder
$binder
Определения
action.php:19
Bitrix\Main\Engine\Action\getController
getController()
Определения
action.php:138
Bitrix\Main\Engine\Action\$name
$name
Определения
action.php:27
Bitrix\Main\Engine\Action\getErrorByCode
getErrorByCode($code)
Определения
action.php:234
Bitrix\Main\Engine\Action\runWithSourceParametersList
runWithSourceParametersList()
Определения
action.php:111
Bitrix\Main\Engine\Action\className
static className()
Определения
action.php:189
Bitrix\Main\Engine\Action\getCurrentUser
getCurrentUser()
Определения
action.php:168
Bitrix\Main\Engine\AutoWire\Binder\buildForMethod
static buildForMethod($instance, $method, $configuration=[])
Определения
binder.php:53
Bitrix\Main\ErrorCollection
Определения
errorcollection.php:14
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\SystemException
Определения
SystemException.php:9
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$errors
$errors
Определения
iblock_catalog_edit.php:74
Bitrix\Main\Errorable
Определения
errorable.php:6
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Main\Controller
Определения
agreement.php:2
Bitrix\Main\Engine
Определения
action.php:3
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
main
lib
engine
action.php
Создано системой
1.14.0