original_string: public function onSaveAttachmentConfig()
      {
          try {
              $fileModel = $this->getRelationModel();
              if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) {
                  $file->title = post('title');
                  $file->description = post('description');
                  $file->save();
  
                  return ['displayName' => $file->title ?: $file->file_name];
              }
  
              throw new ApplicationException('Unable to find file, it may no longer exist');
          }
          catch (Exception $ex) {
              return json_encode(['error' => $ex->getMessage()]);
          }
      }
code: public function onSaveAttachmentConfig()
      {
          try {
              $fileModel = $this->getRelationModel();
              if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) {
                  $file->title = post('title');
                  $file->description = post('description');
                  $file->save();
  
                  return ['displayName' => $file->title ?: $file->file_name];
              }
  
              throw new ApplicationException('Unable to find file, it may no longer exist');
          }
          catch (Exception $ex) {
              return json_encode(['error' => $ex->getMessage()]);
          }
      }
code_tokens: public function onSaveAttachmentConfig ( ) { try { $ fileModel = $ this -> getRelationModel ( ) ; if ( ( $ fileId = post ( 'file_id' ) ) && ( $ file = $ fileModel :: find ( $ fileId ) ) ) { $ file -> title = post ( 'title' ) ; $ file -> description = post ( 'description' ) ; $ file -> save ( ) ; return [ 'displayName' => $ file -> title ? : $ file -> file_name ] ; } throw new ApplicationException ( 'Unable to find file, it may no longer exist' ) ; } catch ( Exception $ ex ) { return json_encode ( [ 'error' => $ ex -> getMessage ( ) ] ) ; } }
docstring: Commit the changes of the attachment configuration form.
docstring_tokens: Commit the changes of the attachment configuration form .