| @@ 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. |
|
| @@ 179-196 (lines=18) @@ | ||
| 176 | * |
|
| 177 | * @return array |
|
| 178 | */ |
|
| 179 | public function refreshFields() |
|
| 180 | { |
|
| 181 | if ($this->id === null) { |
|
| 182 | return $this->fields = []; |
|
| 183 | } |
|
| 184 | ||
| 185 | $sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null; |
|
| 186 | ||
| 187 | $this->fields = static::query()->getById($this->id)->fields; |
|
| 188 | ||
| 189 | if (!empty($sectionsBackup)) { |
|
| 190 | $this->fields['IBLOCK_SECTION'] = $sectionsBackup; |
|
| 191 | } |
|
| 192 | ||
| 193 | $this->fieldsAreFetched = true; |
|
| 194 | ||
| 195 | return $this->fields; |
|
| 196 | } |
|
| 197 | ||
| 198 | /** |
|
| 199 | * Refresh element's sections and save them to a class field. |
|