original_string: public function onRelationManageDelete()
      {
          $this->beforeAjax();
  
          /*
           * Multiple (has many, belongs to many)
           */
          if ($this->viewMode == 'multi') {
              if (($checkedIds = post('checked')) && is_array($checkedIds)) {
                   foreach ($checkedIds as $relationId) {
                      if (!$obj = $this->relationModel->find($relationId)) {
                          continue;
                      }
  
                      $obj->delete();
                  }
              }
          }
          /*
           * Single (belongs to, has one)
           */
          elseif ($this->viewMode == 'single') {
              $relatedModel = $this->viewModel;
              if ($relatedModel->exists) {
                  $relatedModel->delete();
              }
  
              $this->viewWidget->setFormValues([]);
              $this->viewModel = $this->relationModel;
          }
  
          return $this->relationRefresh();
      }
code: public function onRelationManageDelete()
      {
          $this->beforeAjax();
  
          /*
           * Multiple (has many, belongs to many)
           */
          if ($this->viewMode == 'multi') {
              if (($checkedIds = post('checked')) && is_array($checkedIds)) {
                   foreach ($checkedIds as $relationId) {
                      if (!$obj = $this->relationModel->find($relationId)) {
                          continue;
                      }
  
                      $obj->delete();
                  }
              }
          }
          /*
           * Single (belongs to, has one)
           */
          elseif ($this->viewMode == 'single') {
              $relatedModel = $this->viewModel;
              if ($relatedModel->exists) {
                  $relatedModel->delete();
              }
  
              $this->viewWidget->setFormValues([]);
              $this->viewModel = $this->relationModel;
          }
  
          return $this->relationRefresh();
      }
code_tokens: public function onRelationManageDelete ( ) { $ this -> beforeAjax ( ) ; /*
           * Multiple (has many, belongs to many)
           */ if ( $ this -> viewMode == 'multi' ) { if ( ( $ checkedIds = post ( 'checked' ) ) && is_array ( $ checkedIds ) ) { foreach ( $ checkedIds as $ relationId ) { if ( ! $ obj = $ this -> relationModel -> find ( $ relationId ) ) { continue ; } $ obj -> delete ( ) ; } } } /*
           * Single (belongs to, has one)
           */ elseif ( $ this -> viewMode == 'single' ) { $ relatedModel = $ this -> viewModel ; if ( $ relatedModel -> exists ) { $ relatedModel -> delete ( ) ; } $ this -> viewWidget -> setFormValues ( [ ] ) ; $ this -> viewModel = $ this -> relationModel ; } return $ this -> relationRefresh ( ) ; }
docstring: Delete an existing related model completely
docstring_tokens: Delete an existing related model completely