original_string: public function detach($id)
      {
          $instance = $this->_getOrThrow($id, ['locked' => false]);
          $this->loadModel('Field.FieldInstances');
  
          if ($this->FieldInstances->delete($instance)) {
              $this->Flash->success(__d('field', 'Field detached successfully!'));
          } else {
              $this->Flash->danger(__d('field', 'Field could not be detached'));
          }
  
          $this->title(__d('field', 'Detach Field'));
          $this->redirect($this->referer());
      }
code: public function detach($id)
      {
          $instance = $this->_getOrThrow($id, ['locked' => false]);
          $this->loadModel('Field.FieldInstances');
  
          if ($this->FieldInstances->delete($instance)) {
              $this->Flash->success(__d('field', 'Field detached successfully!'));
          } else {
              $this->Flash->danger(__d('field', 'Field could not be detached'));
          }
  
          $this->title(__d('field', 'Detach Field'));
          $this->redirect($this->referer());
      }
code_tokens: public function detach ( $ id ) { $ instance = $ this -> _getOrThrow ( $ id , [ 'locked' => false ] ) ; $ this -> loadModel ( 'Field.FieldInstances' ) ; if ( $ this -> FieldInstances -> delete ( $ instance ) ) { $ this -> Flash -> success ( __d ( 'field' , 'Field detached successfully!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'field' , 'Field could not be detached' ) ) ; } $ this -> title ( __d ( 'field' , 'Detach Field' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
docstring: Detach action.
  
  Detaches a Field from table being managed.
  
  @param int $id ID of the instance to detach
  @return void
docstring_tokens: Detach action .