| @@ 134-151 (lines=18) @@ | ||
| 131 | * |
|
| 132 | * @return array |
|
| 133 | */ |
|
| 134 | public function refreshFields() |
|
| 135 | { |
|
| 136 | if ($this->id === null) { |
|
| 137 | return $this->fields = []; |
|
| 138 | } |
|
| 139 | ||
| 140 | $groupBackup = isset($this->fields['GROUP_ID']) ? $this->fields['GROUP_ID'] : null; |
|
| 141 | ||
| 142 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 143 | ||
| 144 | if ($groupBackup) { |
|
| 145 | $this->fields['GROUP_ID'] = $groupBackup; |
|
| 146 | } |
|
| 147 | ||
| 148 | $this->fieldsAreFetched = true; |
|
| 149 | ||
| 150 | return $this->fields; |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * Refresh user groups and save them to a class field. |
|
| @@ 180-197 (lines=18) @@ | ||
| 177 | * |
|
| 178 | * @return array |
|
| 179 | */ |
|
| 180 | public function refreshFields() |
|
| 181 | { |
|
| 182 | if ($this->id === null) { |
|
| 183 | return $this->fields = []; |
|
| 184 | } |
|
| 185 | ||
| 186 | $sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null; |
|
| 187 | ||
| 188 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 189 | ||
| 190 | if (!empty($sectionsBackup)) { |
|
| 191 | $this->fields['IBLOCK_SECTION'] = $sectionsBackup; |
|
| 192 | } |
|
| 193 | ||
| 194 | $this->fieldsAreFetched = true; |
|
| 195 | ||
| 196 | return $this->fields; |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * Refresh element's sections and save them to a class field. |
|