| @@ 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. |
|
| @@ 300-320 (lines=21) @@ | ||
| 297 | * |
|
| 298 | * @return array |
|
| 299 | */ |
|
| 300 | public function refreshFields() |
|
| 301 | { |
|
| 302 | if ($this->id === null) { |
|
| 303 | $this->original = []; |
|
| 304 | return $this->fields = []; |
|
| 305 | } |
|
| 306 | ||
| 307 | $sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null; |
|
| 308 | ||
| 309 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 310 | ||
| 311 | if (!empty($sectionsBackup)) { |
|
| 312 | $this->fields['IBLOCK_SECTION'] = $sectionsBackup; |
|
| 313 | } |
|
| 314 | ||
| 315 | $this->fieldsAreFetched = true; |
|
| 316 | ||
| 317 | $this->original = $this->fields; |
|
| 318 | ||
| 319 | return $this->fields; |
|
| 320 | } |
|
| 321 | ||
| 322 | /** |
|
| 323 | * Refresh element's sections and save them to a class field. |
|