Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
binding.php
1<?php
3
4use \Bitrix\Main\Localization\Loc;
5use \Bitrix\Main\Entity;
6
7Loc::loadMessages(__FILE__);
8
25class BindingTable extends Entity\DataManager
26{
30 const ENTITY_TYPE_SITE = 'S';
31
36
41 public static function getTableName()
42 {
43 return 'b_landing_binding';
44 }
45
50 public static function getMap()
51 {
52 return array(
53 'ID' => new Entity\IntegerField('ID', array(
54 'primary' => true,
55 'autocomplete' => true,
56 'title' => 'ID'
57 )),
58 'ENTITY_ID' => new Entity\IntegerField('ENTITY_ID', array(
59 'title' => Loc::getMessage('LANDING_TABLE_FIELD_ENTITY_ID'),
60 'required' => true
61 )),
62 'ENTITY_TYPE' => new Entity\StringField('ENTITY_TYPE', array(
63 'title' => Loc::getMessage('LANDING_TABLE_FIELD_ENTITY_TYPE'),
64 'required' => true
65 )),
66 'BINDING_ID' => new Entity\StringField('BINDING_ID', array(
67 'title' => Loc::getMessage('LANDING_TABLE_FIELD_BINDING_ID'),
68 'required' => true
69 )),
70 'BINDING_TYPE' => new Entity\StringField('BINDING_TYPE', array(
71 'title' => Loc::getMessage('LANDING_TABLE_FIELD_BINDING_TYPE'),
72 'required' => true
73 ))
74 );
75 }
76
83 protected static function entityClear($entityId, $entityType)
84 {
85 $res = self::getList([
86 'select' => [
87 'ID'
88 ],
89 'filter' => [
90 '=ENTITY_TYPE' => $entityType,
91 'ENTITY_ID' => $entityId
92 ]
93 ]);
94 while ($row = $res->fetch())
95 {
96 self::delete($row['ID'])->isSuccess();
97 }
98 }
99
105 public static function siteClear($siteId)
106 {
107 self::entityClear((int) $siteId, self::ENTITY_TYPE_SITE);
108 }
109}
static entityClear($entityId, $entityType)
Definition binding.php:83
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29