getUser()->isAdmin()) { throw new Forbidden(); } } public function actionRead($params, $data) { $data = $this->getContainer()->get('fieldManager')->read($params['name'], $params['scope']); if (!isset($data)) { throw new NotFound(); } return $data; } public function actionCreate($params, $data) { if (empty($data['name'])) { throw new Error("Field 'name' cannnot be empty"); } $name = $data['name']; unset($data['name']); return $this->getContainer()->get('fieldManager')->create($name, $data, $params['scope']); } public function actionUpdate($params, $data) { return $this->getContainer()->get('fieldManager')->update($params['name'], $data, $params['scope']); } public function actionDelete($params, $data) { return $this->getContainer()->get('fieldManager')->delete($params['name'], $params['scope']); } }