Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
pathtree.php
1<?php
2
4
8
36{
37 use Index\Internals\BulkOperation;
38
44 public static function getTableName(): string
45 {
46 return 'b_translate_path_tree';
47 }
48
49
55 public static function getMap(): array
56 {
57 return array(
58 'ID' => [
59 'data_type' => 'integer',
60 'primary' => true,
61 'autocomplete' => true,
62 ],
63 'PARENT_ID' => [
64 'data_type' => 'integer',
65 ],
66 'PATH_ID' => [
67 'data_type' => 'integer',
68 ],
69 'DEPTH_LEVEL' => [
70 'data_type' => 'integer',
71 'default_value' => 0,
72 ],
73 'PATH' => [
74 'data_type' => Index\Internals\PathIndexTable::class,
75 'reference' => [
76 '=this.PATH_ID' => 'ref.ID',
77 ],
78 'join_type' => 'INNER',
79 ],
80 );
81 }
82
90 public static function purge(?Translate\Filter $filter = null): void
91 {
92 $filterOut = static::processFilter($filter);
93 static::bulkDelete($filterOut);
94 }
95
103 public static function processFilter(?Translate\Filter $filter = null): array
104 {
105 $filterOut = [];
106
107 if ($filter !== null)
108 {
109 foreach ($filter as $key => $value)
110 {
111 if (empty($value) && $value !== '0')
112 {
113 continue;
114 }
115
116 if ($key === 'path')
117 {
118 $filterOut['=%PATH.PATH'] = $value.'%';
119 }
120 elseif ($key === 'pathId')
121 {
122 $filterOut['=PATH_ID'] = $value;
123 }
124 elseif ($key === 'parentId')
125 {
126 $filterOut['=PARENT_ID'] = $value;
127 }
128 else
129 {
130 if (static::getEntity()->hasField(trim($key, '<>!=@~%*')))
131 {
132 $filterOut[$key] = $value;
133 }
134 }
135 }
136 }
137
138 return $filterOut;
139 }
140}
static processFilter(?Translate\Filter $filter=null)
Definition pathtree.php:103
static purge(?Translate\Filter $filter=null)
Definition pathtree.php:90