protected function isManyToMany($table, $checkForeignKey = true)
    {
        $describe = $this->dataBase->describeTable($table);

        $count = 0;
        foreach ($describe as $field) {
            if (count($describe) < 3) {
                $type = $this->parseType($field->Type);
                if ($type['type'] == 'int' && $field->Key == 'PRI') {
                    // should be a foreign key
                    if ($checkForeignKey && $this->isForeignKey($table, $field->Field)) {
                        $count++;
                    }
                    if (!$checkForeignKey) {
                        $count++;
                    }
                }
            }
        }
        if ($count == 2) {
            return true;
        }

        return false;
    }
protected function isManyToMany($table, $checkForeignKey = true)
    {
        $describe = $this->dataBase->describeTable($table);

        $count = 0;
        foreach ($describe as $field) {
            if (count($describe) < 3) {
                $type = $this->parseType($field->Type);
                if ($type['type'] == 'int' && $field->Key == 'PRI') {
                    // should be a foreign key
                    if ($checkForeignKey && $this->isForeignKey($table, $field->Field)) {
                        $count++;
                    }
                    if (!$checkForeignKey) {
                        $count++;
                    }
                }
            }
        }
        if ($count == 2) {
            return true;
        }

        return false;
    }
protected function isManyToMany ( $ table , $ checkForeignKey = true ) { $ describe = $ this -> dataBase -> describeTable ( $ table ) ; $ count = 0 ; foreach ( $ describe as $ field ) { if ( count ( $ describe ) < 3 ) { $ type = $ this -> parseType ( $ field -> Type ) ; if ( $ type [ 'type' ] == 'int' && $ field -> Key == 'PRI' ) { // should be a foreign key if ( $ checkForeignKey && $ this -> isForeignKey ( $ table , $ field -> Field ) ) { $ count ++ ; } if ( ! $ checkForeignKey ) { $ count ++ ; } } } } if ( $ count == 2 ) { return true ; } return false ; }
Detect many to many tables.

@param $table
@param bool $checkForeignKey

@return bool
Detect many to many tables .