1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Integration.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Rest\Model\Mapper;
6
7use Bitrix\Rest\Entity;
8use Bitrix\Rest\Preset\EO_Integration;
9
11{
13 {
14 return new Entity\Integration(
15 elementCode: $model->getElementCode(),
16 title: $model->getTitle(),
17 id: $model->getId(),
18 userId: $model->getUserId(),
19 passwordId: $model->getPasswordId(),
20 appId: $model->getAppId(),
21 scope: $model->getScope(),
22 widgetList: $model->getWidgetList(),
23 outgoingEvents: $model->getOutgoingEvents(),
24 outgoingNeeded: is_null($model->getOutgoingNeeded()) ? null : ($model->getOutgoingNeeded() === 'Y'),
25 outgoingHandler: $model->getOutgoingHandlerUrl(),
26 widgetNeeded: is_null($model->getWidgetNeeded()) ? null : ($model->getWidgetNeeded() === 'Y'),
27 widgetHandler: $model->getWidgetHandlerUrl(),
28 applicationToken: $model->getApplicationToken(),
29 applicationNeeded: is_null($model->getApplicationNeeded()) ? null : ($model->getApplicationNeeded() === 'Y'),
30 onlyApi: is_null($model->getApplicationOnlyApi()) ? null : ($model->getApplicationOnlyApi() === 'Y'),
31 botId: $model->getBotId(),
32 botHandlerUrl: $model->getBotHandlerUrl(),
33 );
34 }
35
36 public function mapEntityToModel(Entity\Integration $integration): EO_Integration
37 {
38 $model = new EO_Integration();
39 $model->setId($integration->getId());
40 $model->setElementCode($integration->getElementCode());
41 $model->setTitle($integration->getTitle());
42 $model->setUserId($integration->getUserId());
43 $model->setPasswordId($integration->getPasswordId());
44 $model->setAppId($integration->getAppId());
45 $model->setScope($integration->getScope());
46 $model->setWidgetList($integration->getWidgetList());
47 $model->setOutgoingEvents($integration->getOutgoingEvents());
48 $model->setOutgoingNeeded(is_null($integration->getOutgoingNeeded()) ? null : ($integration->getOutgoingNeeded() ? 'Y' : 'N'));
49 $model->setOutgoingHandlerUrl($integration->getOutgoingHandler());
50 $model->setWidgetNeeded(is_null($integration->getWidgetNeeded()) ? null : ($integration->getWidgetNeeded() ? 'Y' : 'N'));
51 $model->setWidgetHandlerUrl($integration->getWidgetHandler());
52 $model->setApplicationToken($integration->getApplicationToken());
53 $model->setApplicationNeeded(is_null($integration->getApplicationNeeded()) ? null : ($integration->getApplicationNeeded() ? 'Y' : 'N'));
54 $model->setApplicationOnlyApi(is_null($integration->getOnlyApi()) ? null : ($integration->getOnlyApi() ? 'Y' : 'N'));
55 $model->setBotId($integration->getBotId());
56 $model->setBotHandlerUrl($integration->getBotHandlerUrl());
57
58 return $model;
59 }
60
62 {
63 return new Entity\Integration(
64 elementCode: $data['ELEMENT_CODE'] ?? null,
65 title: $data['TITLE'],
66 id: isset($data['ID']) ? (int)$data['ID'] : null,
67 userId: isset($data['USER_ID']) ? (int)$data['USER_ID'] : null,
68 passwordId: isset($data['PASSWORD_ID']) ? (int)$data['PASSWORD_ID'] : null,
69 appId: isset($data['APP_ID']) ? (int)$data['APP_ID'] : null,
70 scope: isset($data['SCOPE']) && is_array($data['SCOPE']) ? $data['SCOPE'] : null,
71 widgetList: isset($data['WIDGET_LIST']) && is_array($data['WIDGET_LIST']) ? $data['WIDGET_LIST'] : null,
72 outgoingEvents: isset($data['OUTGOING_EVENTS']) && is_array($data['OUTGOING_EVENTS']) ? $data['OUTGOING_EVENTS'] : null,
73 outgoingNeeded: empty($data['OUTGOING_NEEDED']) ? null : $data['OUTGOING_NEEDED'] === 'Y',
74 outgoingHandler: $data['OUTGOING_HANDLER_URL'] ?? null,
75 widgetNeeded: empty($data['WIDGET_NEEDED']) ? null : $data['WIDGET_NEEDED'] === 'Y',
76 widgetHandler: $data['WIDGET_HANDLER_URL'] ?? null,
77 applicationToken: $data['APPLICATION_TOKEN'] ?? null,
78 applicationNeeded: empty($data['APPLICATION_NEEDED']) ? null : $data['APPLICATION_NEEDED'] === 'Y',
79 onlyApi: empty($data['APPLICATION_ONLY_API']) ? null : $data['APPLICATION_ONLY_API'] === 'Y',
80 botId: isset($data['BOT_ID']) ? (int)$data['BOT_ID'] : null,
81 botHandlerUrl: $data['BOT_HANDLER_URL'] ?? null,
82 );
83 }
84}
mapArrayToEntity(array $data)
Определения Integration.php:61
mapModelToEntity(EO_Integration $model)
Определения Integration.php:12
mapEntityToModel(Entity\Integration $integration)
Определения Integration.php:36
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения ufield.php:9
<? endif;?> window document title
Определения prolog_main_admin.php:76