diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/classes/JsonApi/Routes/ConfigValues/ConfigValuesUpdate.php | 6 | ||||
| -rw-r--r-- | lib/classes/JsonApi/Routes/ConfigValues/HelperTrait.php | 9 | ||||
| -rw-r--r-- | lib/models/ConfigValue.php | 10 |
3 files changed, 20 insertions, 5 deletions
diff --git a/lib/classes/JsonApi/Routes/ConfigValues/ConfigValuesUpdate.php b/lib/classes/JsonApi/Routes/ConfigValues/ConfigValuesUpdate.php index cf46134..c4fda2f 100644 --- a/lib/classes/JsonApi/Routes/ConfigValues/ConfigValuesUpdate.php +++ b/lib/classes/JsonApi/Routes/ConfigValues/ConfigValuesUpdate.php @@ -31,7 +31,11 @@ class ConfigValuesUpdate extends JsonApiController $resource = $this->findOrFakeConfigValue($range, $field); // TODO: zunächst kann diese Route nur Konfigurationseinstellungen vom Typ bool ändern - if ('boolean' !== $resource->entry['type'] && $resource->entry['field'] !== 'MY_COURSES_OPEN_GROUPS') { + if ( + 'boolean' !== $resource->entry['type'] + && $resource->entry['field'] !== 'MY_COURSES_OPEN_GROUPS' + && $resource->entry['field'] !== 'MY_COURSES_VIEW_SETTINGS' + ) { throw new NotImplementedException(); } diff --git a/lib/classes/JsonApi/Routes/ConfigValues/HelperTrait.php b/lib/classes/JsonApi/Routes/ConfigValues/HelperTrait.php index 3742fb5..eac1d37 100644 --- a/lib/classes/JsonApi/Routes/ConfigValues/HelperTrait.php +++ b/lib/classes/JsonApi/Routes/ConfigValues/HelperTrait.php @@ -2,11 +2,12 @@ namespace JsonApi\Routes\ConfigValues; +use ConfigValue; use JsonApi\Errors\RecordNotFoundException; trait HelperTrait { - private function generateId(\ConfigValue $resource): string + private function generateId(ConfigValue $resource): string { return join('_', [$resource['range_id'], $resource['field']]); } @@ -29,10 +30,10 @@ trait HelperTrait return $range; } - private function findOrFakeConfigValue(?\Range $range, string $field) + private function findOrFakeConfigValue(?\Range $range, string $field): ConfigValue { // first search optimistically for this config value - if ($configValue = \ConfigValue::find([$field, $range->id])) { + if ($configValue = ConfigValue::find([$field, $range->id])) { return $configValue; } @@ -41,7 +42,7 @@ trait HelperTrait throw new RecordNotFoundException(); } - return \ConfigValue::build([ + return ConfigValue::build([ 'field' => $field, 'range_id' => $range->id, 'value' => $configEntry->value, diff --git a/lib/models/ConfigValue.php b/lib/models/ConfigValue.php index 4e27ec7..829567d 100644 --- a/lib/models/ConfigValue.php +++ b/lib/models/ConfigValue.php @@ -12,6 +12,16 @@ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 * * @category Stud.IP + * + * @property array $id + * @property string $field + * @property string $range_id + * @property string $value + * @property int $mkdate + * @property int $chdate + * @property string $comment + * + * @property ConfigEntry $entry */ class ConfigValue extends SimpleORMap |
