Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
filediff.php
1<?php
2
4
8
39{
40 use Index\Internals\BulkOperation;
41
47 public static function getTableName()
48 {
49 return 'b_translate_diff';
50 }
51
57 public static function getObjectClass()
58 {
59 return Index\FileDiff::class;
60 }
61
67 public static function getCollectionClass()
68 {
69 return Index\FileDiffCollection::class;
70 }
71
77 public static function getMap()
78 {
79 return array(
80 'ID' => array(
81 'data_type' => 'integer',
82 'primary' => true,
83 'autocomplete' => true,
84 ),
85 'FILE_ID' => array(
86 'data_type' => 'integer',
87 ),
88 'PATH_ID' => array(
89 'data_type' => 'integer',
90 ),
91 'LANG_ID' => array(
92 'data_type' => 'string',
93 ),
94 'AGAINST_LANG_ID' => array(
95 'data_type' => 'string',
96 ),
97 'EXCESS_COUNT' => array(
98 'data_type' => 'integer',
99 ),
100 'DEFICIENCY_COUNT' => array(
101 'data_type' => 'integer',
102 ),
103 'FILE' => array(
104 'data_type' => '\Bitrix\Translate\Index\Internals\FileIndexTable',
105 'reference' => array(
106 '=this.FILE_ID' => 'ref.ID',
107 '=this.LANG_ID' => 'ref.LANG_ID',
108 ),
109 'join_type' => 'INNER',
110 ),
111 'PATH' => array(
112 'data_type' => '\Bitrix\Translate\Index\Internals\PathIndexTable',
113 'reference' => array(
114 '=this.PATH_ID' => 'ref.ID',
115 ),
116 'join_type' => 'INNER',
117 ),
118 );
119 }
120
121
129 public static function purge(Translate\Filter $filter = null)
130 {
131 if (($filterOut = static::processFilter($filter)) !== false)
132 {
133 static::bulkDelete($filterOut);
134 }
135 }
136
144 public static function processFilter(Translate\Filter $filter = null)
145 {
146 $filterOut = array();
147
148 if ($filter !== null && ($filter instanceof Translate\Filter || $filter instanceof \Traversable))
149 {
150 foreach ($filter as $key => $value)
151 {
152 if (empty($value) && $value !== '0')
153 {
154 continue;
155 }
156
157 if ($key === 'path')
158 {
159 $filterOut['=%PATH.PATH'] = $value.'%';
160 }
161 elseif ($key === 'fileId')
162 {
163 $filterOut['=FILE_ID'] = $value;
164 }
165 elseif ($key === 'pathId')
166 {
167 $filterOut['=PATH_ID'] = $value;
168 }
169 elseif ($key === 'langId')
170 {
171 $filterOut['=LANG_ID'] = $value;
172 }
173 elseif ($key === 'indexedTime')
174 {
175 $filterOut['<FILE.INDEXED_TIME'] = $value;
176 }
177 else
178 {
179 if (static::getEntity()->hasField(trim($key, '<>!=@~%*')))
180 {
181 $filterOut[$key] = $value;
182 }
183 }
184 }
185 }
186
187 return $filterOut;
188 }
189}
static purge(Translate\Filter $filter=null)
Definition filediff.php:129
static processFilter(Translate\Filter $filter=null)
Definition filediff.php:144