Models/DBOperator.php
public function updateManyTable($info) {
        $structure = array(
            'table'     => $info['manyTable'],
            'columns'   => array(),
            'indexes'   => array(),
            'constraints'   => array(),
        );

        $localName = Inflector::singularize($info['localTable']);
        $foreignName = Inflector::singularize($info['foreignTable']);

        $structure['columns']['id'] = array('type' => 'int(11) unsigned', 'auto_increment'=>true);
        $structure['columns']['id_'. $localName] = 'int(11) unsigned';
        $structure['columns']['id_'. $foreignName] = 'int(11) unsigned';
        $structure['indexes']['primary'] = array('columns'=>array('id'), 'type'=>'primary');
        $structure['indexes']['unique_id_'.$localName.'_id_'.$foreignName] = array(
            'columns'   => array(
                'id_'.$localName,
                'id_'.$foreignName
            ),
            'type'      => 'unique'
        );
        $foreignKeysInfo = array(
            'local_table'   => $info['manyTable'],
            'foreign_table' => $info['localTable'],
            'local_field'   => 'id_'.$localName,
            'foreign_field' => $info['foreignKey']
        );
        $structure['constraints'][$this->generateForeignKeyName($foreignKeysInfo)] = $foreignKeysInfo;
        $foreignKeysInfo = array(
            'local_table'   => $info['manyTable'],
            'foreign_table' => $info['foreignTable'],
            'local_field'   => 'id_'.$foreignName,
            'foreign_field' => $info['foreignKey']
        );
        $structure['constraints'][$this->generateForeignKeyName($foreignKeysInfo)] = $foreignKeysInfo;

        $diffs = $this->getDifferenceSQL($structure, $info['manyTable']);
        if ($diffs['result'] === true) {
            QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0');
            if (!empty($diffs['sql']['ADD'])) {
                try {
                    QC::executeArrayOfSQL($diffs['sql']['ADD']);
                } catch(\Exception $e) {
                    var_dump($e->getMessage());die();
                }
            }
        }
        return $diffs['result'];

    }
public function updateManyTable($info) {
        $structure = array(
            'table'     => $info['manyTable'],
            'columns'   => array(),
            'indexes'   => array(),
            'constraints'   => array(),
        );

        $localName = Inflector::singularize($info['localTable']);
        $foreignName = Inflector::singularize($info['foreignTable']);

        $structure['columns']['id'] = array('type' => 'int(11) unsigned', 'auto_increment'=>true);
        $structure['columns']['id_'. $localName] = 'int(11) unsigned';
        $structure['columns']['id_'. $foreignName] = 'int(11) unsigned';
        $structure['indexes']['primary'] = array('columns'=>array('id'), 'type'=>'primary');
        $structure['indexes']['unique_id_'.$localName.'_id_'.$foreignName] = array(
            'columns'   => array(
                'id_'.$localName,
                'id_'.$foreignName
            ),
            'type'      => 'unique'
        );
        $foreignKeysInfo = array(
            'local_table'   => $info['manyTable'],
            'foreign_table' => $info['localTable'],
            'local_field'   => 'id_'.$localName,
            'foreign_field' => $info['foreignKey']
        );
        $structure['constraints'][$this->generateForeignKeyName($foreignKeysInfo)] = $foreignKeysInfo;
        $foreignKeysInfo = array(
            'local_table'   => $info['manyTable'],
            'foreign_table' => $info['foreignTable'],
            'local_field'   => 'id_'.$foreignName,
            'foreign_field' => $info['foreignKey']
        );
        $structure['constraints'][$this->generateForeignKeyName($foreignKeysInfo)] = $foreignKeysInfo;

        $diffs = $this->getDifferenceSQL($structure, $info['manyTable']);
        if ($diffs['result'] === true) {
            QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0');
            if (!empty($diffs['sql']['ADD'])) {
                try {
                    QC::executeArrayOfSQL($diffs['sql']['ADD']);
                } catch(\Exception $e) {
                    var_dump($e->getMessage());die();
                }
            }
        }
        return $diffs['result'];

    }
Updates many to many tables
@param $info
@return mixed