public static function manyToMany($modelClass, $connection, $options = []) {
        $options['type'] = self::MANY_TO_MANY;
        $options['modelClass'] = $modelClass;
        $connection = explode('(', $connection);
        $table = $connection[0];
        list($c1, $c2) = explode(',', $connection[1]);
        $r = new self($options);
        $c1 = trim($c1);
        $c2 = trim($c2);
        $r->join(trim($table), [["t.__PK__", "j.$c1", "="]])
            ->compare(["j.$c2" => "r." . $modelClass::getDb()->getTablePk($modelClass::getTableName())]);
        return $r;
    }
public static function manyToMany($modelClass, $connection, $options = []) {
        $options['type'] = self::MANY_TO_MANY;
        $options['modelClass'] = $modelClass;
        $connection = explode('(', $connection);
        $table = $connection[0];
        list($c1, $c2) = explode(',', $connection[1]);
        $r = new self($options);
        $c1 = trim($c1);
        $c2 = trim($c2);
        $r->join(trim($table), [["t.__PK__", "j.$c1", "="]])
            ->compare(["j.$c2" => "r." . $modelClass::getDb()->getTablePk($modelClass::getTableName())]);
        return $r;
    }
public static function manyToMany ( $ modelClass , $ connection , $ options = [ ] ) { $ options [ 'type' ] = self :: MANY_TO_MANY ; $ options [ 'modelClass' ] = $ modelClass ; $ connection = explode ( '(' , $ connection ) ; $ table = $ connection [ 0 ] ; list ( $ c1 , $ c2 ) = explode ( ',' , $ connection [ 1 ] ) ; $ r = new self ( $ options ) ; $ c1 = trim ( $ c1 ) ; $ c2 = trim ( $ c2 ) ; $ r -> join ( trim ( $ table ) , [ [ "t.__PK__" , "j.$c1" , "=" ] ] ) -> compare ( [ "j.$c2" => "r." . $ modelClass :: getDb ( ) -> getTablePk ( $ modelClass :: getTableName ( ) ) ] ) ; return $ r ; }
Creates a many2many relation
@param $modelClass
@param $connection
@param array $options
@return Relation
Creates a many2many relation