1 | <?php |
||
12 | class SectionQuery extends OldCoreQuery |
||
13 | { |
||
14 | /** |
||
15 | * Query sort. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | public $sort = ['SORT' => 'ASC']; |
||
20 | |||
21 | /** |
||
22 | * Query bIncCnt. |
||
23 | * This is sent to getList directly. |
||
24 | * |
||
25 | * @var array|false |
||
26 | */ |
||
27 | public $countElements = false; |
||
28 | |||
29 | /** |
||
30 | * Iblock id. |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | protected $iblockId; |
||
35 | |||
36 | /** |
||
37 | * List of standard entity fields. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $standardFields = [ |
||
42 | 'ID', |
||
43 | 'CODE', |
||
44 | 'EXTERNAL_ID', |
||
45 | 'IBLOCK_ID', |
||
46 | 'IBLOCK_SECTION_ID', |
||
47 | 'TIMESTAMP_X', |
||
48 | 'SORT', |
||
49 | 'NAME', |
||
50 | 'ACTIVE', |
||
51 | 'GLOBAL_ACTIVE', |
||
52 | 'PICTURE', |
||
53 | 'DESCRIPTION', |
||
54 | 'DESCRIPTION_TYPE', |
||
55 | 'LEFT_MARGIN', |
||
56 | 'RIGHT_MARGIN', |
||
57 | 'DEPTH_LEVEL', |
||
58 | 'SEARCHABLE_CONTENT', |
||
59 | 'SECTION_PAGE_URL', |
||
60 | 'MODIFIED_BY', |
||
61 | 'DATE_CREATE', |
||
62 | 'CREATED_BY', |
||
63 | 'DETAIL_PICTURE', |
||
64 | ]; |
||
65 | |||
66 | /** |
||
67 | * Constructor. |
||
68 | * |
||
69 | * @param object $bxObject |
||
70 | * @param string $modelName |
||
71 | */ |
||
72 | public function __construct($bxObject, $modelName) |
||
78 | |||
79 | /** |
||
80 | * CIBlockSection::getList substitution. |
||
81 | * |
||
82 | * @return Collection |
||
83 | */ |
||
84 | protected function loadModels() |
||
122 | |||
123 | /** |
||
124 | * Get the first section with a given code. |
||
125 | * |
||
126 | * @param string $code |
||
127 | * |
||
128 | * @return SectionModel |
||
129 | */ |
||
130 | public function getByCode($code) |
||
136 | |||
137 | /** |
||
138 | * Get the first section with a given external id. |
||
139 | * |
||
140 | * @param string $id |
||
141 | * |
||
142 | * @return SectionModel |
||
143 | */ |
||
144 | public function getByExternalId($id) |
||
150 | |||
151 | /** |
||
152 | * Get count of sections that match filter. |
||
153 | * |
||
154 | * @return int |
||
155 | */ |
||
156 | public function count() |
||
170 | |||
171 | /** |
||
172 | * Setter for countElements. |
||
173 | * |
||
174 | * @param $value |
||
175 | * |
||
176 | * @return $this |
||
177 | */ |
||
178 | public function countElements($value) |
||
184 | |||
185 | /** |
||
186 | * Normalize filter before sending it to getList. |
||
187 | * This prevents some inconsistency. |
||
188 | * |
||
189 | * @return array |
||
190 | */ |
||
191 | protected function normalizeFilter() |
||
197 | |||
198 | /** |
||
199 | * Normalize select before sending it to getList. |
||
200 | * This prevents some inconsistency. |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | protected function normalizeSelect() |
||
219 | } |
||
220 |