| @@ 173-190 (lines=18) @@ | ||
| 170 | * |
|
| 171 | * @return array |
|
| 172 | */ |
|
| 173 | public function refreshFields() |
|
| 174 | { |
|
| 175 | if ($this->id === null) { |
|
| 176 | return $this->fields = []; |
|
| 177 | } |
|
| 178 | ||
| 179 | $groupBackup = isset($this->fields['GROUP_ID']) ? $this->fields['GROUP_ID'] : null; |
|
| 180 | ||
| 181 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 182 | ||
| 183 | if ($groupBackup) { |
|
| 184 | $this->fields['GROUP_ID'] = $groupBackup; |
|
| 185 | } |
|
| 186 | ||
| 187 | $this->fieldsAreFetched = true; |
|
| 188 | ||
| 189 | return $this->fields; |
|
| 190 | } |
|
| 191 | ||
| 192 | /** |
|
| 193 | * Refresh user groups and save them to a class field. |
|
| @@ 222-239 (lines=18) @@ | ||
| 219 | * |
|
| 220 | * @return array |
|
| 221 | */ |
|
| 222 | public function refreshFields() |
|
| 223 | { |
|
| 224 | if ($this->id === null) { |
|
| 225 | return $this->fields = []; |
|
| 226 | } |
|
| 227 | ||
| 228 | $sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null; |
|
| 229 | ||
| 230 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 231 | ||
| 232 | if (!empty($sectionsBackup)) { |
|
| 233 | $this->fields['IBLOCK_SECTION'] = $sectionsBackup; |
|
| 234 | } |
|
| 235 | ||
| 236 | $this->fieldsAreFetched = true; |
|
| 237 | ||
| 238 | return $this->fields; |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * Refresh element's sections and save them to a class field. |
|