original_string: protected function _checkAssociation(Event $event, $tableSuffix)
      {
          $subject = $event->subject;
          $connection = ConnectionManager::get($subject->viewVars['connection']);
          $schema = $connection->getSchemaCollection();
  
          $versionTable = sprintf('%s_%s', Hash::get($event->subject->viewVars, 'table'), $tableSuffix);
          if (!in_array($versionTable, $schema->listTables())) {
              return false;
          }
  
          $event->subject->viewVars['behaviors']['Josegonzalez/Version.Version'] = [
              sprintf("'versionTable' => '%s'", $versionTable),
          ];
  
          $event->subject->viewVars['associations']['belongsTo'] = $this->_modifyBelongsTo($event);
          $event->subject->viewVars['rulesChecker'] = $this->_modifyRulesChecker($event);
  
          return true;
      }
code: protected function _checkAssociation(Event $event, $tableSuffix)
      {
          $subject = $event->subject;
          $connection = ConnectionManager::get($subject->viewVars['connection']);
          $schema = $connection->getSchemaCollection();
  
          $versionTable = sprintf('%s_%s', Hash::get($event->subject->viewVars, 'table'), $tableSuffix);
          if (!in_array($versionTable, $schema->listTables())) {
              return false;
          }
  
          $event->subject->viewVars['behaviors']['Josegonzalez/Version.Version'] = [
              sprintf("'versionTable' => '%s'", $versionTable),
          ];
  
          $event->subject->viewVars['associations']['belongsTo'] = $this->_modifyBelongsTo($event);
          $event->subject->viewVars['rulesChecker'] = $this->_modifyRulesChecker($event);
  
          return true;
      }
code_tokens: protected function _checkAssociation ( Event $ event , $ tableSuffix ) { $ subject = $ event -> subject ; $ connection = ConnectionManager :: get ( $ subject -> viewVars [ 'connection' ] ) ; $ schema = $ connection -> getSchemaCollection ( ) ; $ versionTable = sprintf ( '%s_%s' , Hash :: get ( $ event -> subject -> viewVars , 'table' ) , $ tableSuffix ) ; if ( ! in_array ( $ versionTable , $ schema -> listTables ( ) ) ) { return false ; } $ event -> subject -> viewVars [ 'behaviors' ] [ 'Josegonzalez/Version.Version' ] = [ sprintf ( "'versionTable' => '%s'" , $ versionTable ) , ] ; $ event -> subject -> viewVars [ 'associations' ] [ 'belongsTo' ] = $ this -> _modifyBelongsTo ( $ event ) ; $ event -> subject -> viewVars [ 'rulesChecker' ] = $ this -> _modifyRulesChecker ( $ event ) ; return true ; }
docstring: Attaches the behavior and modifies associations as necessary
  
  @param Event $event An Event instance
  @param string $tableSuffix a suffix for the primary table
  @return bool true if modified, false otherwise
docstring_tokens: Attaches the behavior and modifies associations as necessary