Example #1
0
 public function editAction($version, $uuid)
 {
     try {
         $file = Models\File::findFirstByUuid($uuid);
         if (!$file) {
             throw new Exception('File not found', 404);
         }
         $file->name = $this->request->get('name', 'string', $file->name);
         $success = $file->save();
         if (!$success) {
             throw new Exception($file->getMessages()[0]);
         } else {
             $this->response->setJsonContent(array('status' => 'OK', 'message' => 'File saved'));
         }
         $this->response->send();
     } catch (\Exception $exception) {
         $this->throwException($exception);
     }
 }