public function update($id, $data) { if (!$this->settingManager->has($id)) { return new ApiProblem(ApiProblemResponse::STATUS_CODE_404, 'The setting does not exists.'); } $this->settingManager->set($id, $data->value); $this->settingManager->flush(); return new SettingEntity($id, $data->value); }
public function indexAction() { $this->settingsForm->setData($this->settingsManager->getAll()); if ($this->getRequest()->isPost()) { $this->settingsForm->setData($this->getRequest()->getPost()); if ($this->settingsForm->isValid()) { $data = $this->settingsForm->getData(); $this->settingsManager->set('application_title', $data['application_title']); $this->settingsManager->flush(); $this->flashMessenger()->addSuccessMessage('The settings have been saved.'); return $this->redirect()->toRoute('admin/system/settings'); } } return new ViewModel(['settingsForm' => $this->settingsForm]); }