Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ImportStep.php
1
<?php
2
namespace
Bitrix\UI\Integration\Rest
;
3
4
use \Bitrix\Main;
5
use \Bitrix\Rest;
6
7
8
abstract
class
ImportStep
{
9
//region input info
10
public
string
$entityCode
;
11
public
Main\Type\Dictionary
$data
;
12
public
Main\Type\Dictionary
$previousStep
;
13
public
Rest\Configuration\Structure
$structure
;
14
//end region
15
//region OutputInfo
16
public
Main\Type\Dictionary
$nextStep
;
17
public
Main\ErrorCollection
$errorCollection
;
18
//endregion
19
public
function
__construct
(Main\
Event
$event)
20
{
21
$this->entityCode = $event->getParameter(
'CODE'
);
22
$this->data =
new
Main\Type\Dictionary
($event->getParameter(
'CONTENT'
)[
'DATA'
]);
23
$this->structure =
new
Rest\Configuration\Structure
($event->getParameter(
'CONTEXT_USER'
));
24
25
$this->previousStep =
new
Main\Type\Dictionary
($event->getParameter(
'CONTENT'
)[
'RATIO'
]);
26
$this->nextStep =
new
Main\Type\Dictionary
();
27
$this->errorCollection =
new
Main\ErrorCollection
();
28
29
$this->
init
($event);
30
}
31
32
abstract
public
function
init
($event): void;
33
34
abstract
public
function
makeAStep
(): void;
35
36
public
function
makeAnAnswer
(): ?array
37
{
38
return
[
39
'RATIO'
=> $this->nextStep->toArray(),
40
] + (($error = $this->errorCollection->current()) ? [
41
'ERROR_MESSAGE'
=> $error->getMessage(),
42
'ERROR_ACTION'
=> $error->getCode(),
43
] : []);
44
}
45
46
public
static
function
fulfill
(Main\
Event
$event): array
47
{
48
$step =
new
static
($event);
49
if
($step->errorCollection->isEmpty())
50
{
51
$step->makeAStep();
52
}
53
return
$step->makeAnAnswer();
54
}
55
}
Bitrix\Main\ErrorCollection
Definition
errorcollection.php:14
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\Type\Dictionary
Definition
dictionary.php:6
Bitrix\Rest\Configuration\Structure
Definition
structure.php:17
Bitrix\UI\Integration\Rest\ImportStep
Definition
ImportStep.php:8
Bitrix\UI\Integration\Rest\ImportStep\fulfill
static fulfill(Main\Event $event)
Definition
ImportStep.php:46
Bitrix\UI\Integration\Rest\ImportStep\$errorCollection
Main ErrorCollection $errorCollection
Definition
ImportStep.php:17
Bitrix\UI\Integration\Rest\ImportStep\$entityCode
string $entityCode
Definition
ImportStep.php:10
Bitrix\UI\Integration\Rest\ImportStep\$data
Main Type Dictionary $data
Definition
ImportStep.php:11
Bitrix\UI\Integration\Rest\ImportStep\$previousStep
Main Type Dictionary $previousStep
Definition
ImportStep.php:12
Bitrix\UI\Integration\Rest\ImportStep\__construct
__construct(Main\Event $event)
Definition
ImportStep.php:19
Bitrix\UI\Integration\Rest\ImportStep\$structure
Rest Configuration Structure $structure
Definition
ImportStep.php:13
Bitrix\UI\Integration\Rest\ImportStep\init
init($event)
Bitrix\UI\Integration\Rest\ImportStep\$nextStep
Main Type Dictionary $nextStep
Definition
ImportStep.php:16
Bitrix\UI\Integration\Rest\ImportStep\makeAStep
makeAStep()
Bitrix\UI\Integration\Rest\ImportStep\makeAnAnswer
makeAnAnswer()
Definition
ImportStep.php:36
Bitrix\UI\Integration\Rest
Definition
App.php:3
modules
ui
lib
Integration
Rest
ImportStep.php
Создано системой
1.10.0