1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
relation.php
См. документацию.
1<?php
3
4
7
9{
10 protected $sourceEntityTypeId = 0;
11 protected $sourceEntityId = 0;
12
14 protected $destinationEntityId = 0;
15
17 {
18 if(!is_int($sourceEntityTypeId))
19 {
21 }
22
23 if(!is_int($sourceEntityId))
24 {
26 }
27
28 if(!is_int($destinationEntityTypeId))
29 {
31 }
32
33 if(!is_int($destinationEntityId))
34 {
36 }
37
38 $this->sourceEntityTypeId = $sourceEntityTypeId;
39 $this->sourceEntityId = $sourceEntityId;
40
41 $this->destinationEntityTypeId = $destinationEntityTypeId;
42 $this->destinationEntityId = $destinationEntityId;
43 }
44
45 public function save()
46 {
47 // region multiple relation
49 [
50 'SRC_ENTITY_TYPE_ID' => $this->sourceEntityTypeId,
51 'SRC_ENTITY_ID' => $this->sourceEntityId,
52 'DST_ENTITY_TYPE_ID' => $this->destinationEntityTypeId,
53 'DST_ENTITY_ID' => $this->destinationEntityId
54 ]
55 );
56 // endregion
57 // region single relation
59 [
60 'SRC_ENTITY_TYPE_ID' => $this->sourceEntityTypeId,
61 'SRC_ENTITY_ID' => $this->sourceEntityId,
62 'DST_ENTITY_TYPE_ID' => $this->destinationEntityTypeId,
63 'DST_ENTITY_ID' => $this->destinationEntityId
64 ]
65 );
66 // endregion
67
68 return new Result();
69 }
70
71 public static function getBySourceEntity($entityTypeId, $entityId)
72 {
73 $dbResult = Entity\B24IntegrationRelationTable::getList([
74 'filter' => [
75 '=SRC_ENTITY_TYPE_ID' => $entityTypeId,
76 '=SRC_ENTITY_ID' => $entityId
77 ]
78 ]);
79
80 $results = [];
81 while($fields = $dbResult->fetch())
82 {
83 $results[] = $fields;
84 }
85 return $results;
86 }
87
89 {
90 $filter = [];
92 $filter['=SRC_ENTITY_TYPE_ID'] = $sourceEntityTypeId;
94 $filter['=SRC_ENTITY_ID'] = $sourceEntityId;
96 $filter['=DST_ENTITY_TYPE_ID'] = $destinationEntityTypeId;
98 $filter['=DST_ENTITY_ID'] = $destinationEntityId;
99
100
101 return Entity\B24IntegrationRelationTable::getRow([
102 'filter' => [$filter]
103 ]);
104 }
105
106 public static function createFromArray(array $data)
107 {
108 $item = new Relation(
109 $data['SRC_ENTITY_TYPE_ID'],
110 $data['SRC_ENTITY_ID'],
111 $data['DST_ENTITY_TYPE_ID'],
112 $data['DST_ENTITY_ID']
113 );
114
115 return $item;
116 }
117
118 public function getSourceEntityTypeId()
119 {
120 return $this->sourceEntityTypeId;
121 }
122 public function getSourceEntityId()
123 {
124 return $this->sourceEntityId;
125 }
127 {
128 return $this->destinationEntityTypeId;
129 }
130 public function getDestinationEntityId()
131 {
132 return $this->destinationEntityId;
133 }
134
136 {
137 if(!is_int($entityId))
138 {
139 $entityId = (int)$entityId;
140 }
141
142 $this->destinationEntityId = $entityId;
143 }
144}
__construct($sourceEntityTypeId, $sourceEntityId, $destinationEntityTypeId, $destinationEntityId)
Определения relation.php:16
static createFromArray(array $data)
Определения relation.php:106
static getBySourceEntity($entityTypeId, $entityId)
Определения relation.php:71
static getByEntity($sourceEntityTypeId, $sourceEntityId, $destinationEntityTypeId, $destinationEntityId='')
Определения relation.php:88
$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
$filter
Определения iblock_catalog_list.php:54
$entityId
Определения payment.php:4
$dbResult
Определения updtr957.php:3
$fields
Определения yandex_run.php:501