original_string: protected function _fixVersionTables(Event $event)
      {
          if (!preg_match('/Versions$/', $event->subject->viewVars['name'])) {
              return;
          }
  
          unset($event->subject->viewVars['rulesChecker']['version_id']);
          foreach ($event->subject->viewVars['associations']['belongsTo'] as $i => $association) {
              if ($association['alias'] === 'Versions' && $association['foreignKey'] === 'version_id') {
                  unset($event->subject->viewVars['associations']['belongsTo'][$i]);
              }
          }
      }
code: protected function _fixVersionTables(Event $event)
      {
          if (!preg_match('/Versions$/', $event->subject->viewVars['name'])) {
              return;
          }
  
          unset($event->subject->viewVars['rulesChecker']['version_id']);
          foreach ($event->subject->viewVars['associations']['belongsTo'] as $i => $association) {
              if ($association['alias'] === 'Versions' && $association['foreignKey'] === 'version_id') {
                  unset($event->subject->viewVars['associations']['belongsTo'][$i]);
              }
          }
      }
code_tokens: protected function _fixVersionTables ( Event $ event ) { if ( ! preg_match ( '/Versions$/' , $ event -> subject -> viewVars [ 'name' ] ) ) { return ; } unset ( $ event -> subject -> viewVars [ 'rulesChecker' ] [ 'version_id' ] ) ; foreach ( $ event -> subject -> viewVars [ 'associations' ] [ 'belongsTo' ] as $ i => $ association ) { if ( $ association [ 'alias' ] === 'Versions' && $ association [ 'foreignKey' ] === 'version_id' ) { unset ( $ event -> subject -> viewVars [ 'associations' ] [ 'belongsTo' ] [ $ i ] ) ; } } }
docstring: Removes unnecessary associations
  
  @param Event $event An Event instance
  @return void
docstring_tokens: Removes unnecessary associations