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]);
            }
        }
    }
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]);
            }
        }
    }
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 ] ) ; } } }
Removes unnecessary associations

@param Event $event An Event instance
@return void
Removes unnecessary associations