@@ 246-266 (lines=21) @@ | ||
243 | * |
|
244 | * @return array |
|
245 | */ |
|
246 | public function refreshFields() |
|
247 | { |
|
248 | if ($this->id === null) { |
|
249 | $this->original = []; |
|
250 | return $this->fields = []; |
|
251 | } |
|
252 | ||
253 | $sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null; |
|
254 | ||
255 | $this->fields = static::query()->getById($this->id)->fields; |
|
256 | ||
257 | if (!empty($sectionsBackup)) { |
|
258 | $this->fields['IBLOCK_SECTION'] = $sectionsBackup; |
|
259 | } |
|
260 | ||
261 | $this->fieldsAreFetched = true; |
|
262 | ||
263 | $this->original = $this->fields; |
|
264 | ||
265 | return $this->fields; |
|
266 | } |
|
267 | ||
268 | /** |
|
269 | * Refresh element's sections and save them to a class field. |
@@ 176-196 (lines=21) @@ | ||
173 | * |
|
174 | * @return array |
|
175 | */ |
|
176 | public function refreshFields() |
|
177 | { |
|
178 | if ($this->id === null) { |
|
179 | $this->original = []; |
|
180 | return $this->fields = []; |
|
181 | } |
|
182 | ||
183 | $groupBackup = isset($this->fields['GROUP_ID']) ? $this->fields['GROUP_ID'] : null; |
|
184 | ||
185 | $this->fields = static::query()->getById($this->id)->fields; |
|
186 | ||
187 | if ($groupBackup) { |
|
188 | $this->fields['GROUP_ID'] = $groupBackup; |
|
189 | } |
|
190 | ||
191 | $this->fieldsAreFetched = true; |
|
192 | ||
193 | $this->original = $this->fields; |
|
194 | ||
195 | return $this->fields; |
|
196 | } |
|
197 | ||
198 | /** |
|
199 | * Refresh user groups and save them to a class field. |