public function getManyToMany($target, $through, $key = null, $target_key = null){
        $factory = $this->_db->factory($target);

        if(null === $key){
            $key = $this->getPK();
        }
        if(null === $target_key){
            $target_key = $factory->getPK();
        }
        
        $through = $this->parseThrough($through);
        if(!$through[1]){
            $through[1] = $key;
        }
        if(!$through[2]){
            $through[2] = $target_key;
        }
        
        $rows = $this->_db->builder()
            ->select('t.*')
            ->from($factory->getTable().' t')
            ->leftJoin($through[0].' m', 'm.'.$through[2].'=t.'.$target_key)
            ->where('m.'.$through[1].'=:value', array(
                ':value' => $this->get($key)
            ))
        ->queryAll();
        
        if(false === $rows){
            return false;
        }
        
        return $factory->mapModels($rows);
    }
public function getManyToMany($target, $through, $key = null, $target_key = null){
        $factory = $this->_db->factory($target);

        if(null === $key){
            $key = $this->getPK();
        }
        if(null === $target_key){
            $target_key = $factory->getPK();
        }
        
        $through = $this->parseThrough($through);
        if(!$through[1]){
            $through[1] = $key;
        }
        if(!$through[2]){
            $through[2] = $target_key;
        }
        
        $rows = $this->_db->builder()
            ->select('t.*')
            ->from($factory->getTable().' t')
            ->leftJoin($through[0].' m', 'm.'.$through[2].'=t.'.$target_key)
            ->where('m.'.$through[1].'=:value', array(
                ':value' => $this->get($key)
            ))
        ->queryAll();
        
        if(false === $rows){
            return false;
        }
        
        return $factory->mapModels($rows);
    }
public function getManyToMany ( $ target , $ through , $ key = null , $ target_key = null ) { $ factory = $ this -> _db -> factory ( $ target ) ; if ( null === $ key ) { $ key = $ this -> getPK ( ) ; } if ( null === $ target_key ) { $ target_key = $ factory -> getPK ( ) ; } $ through = $ this -> parseThrough ( $ through ) ; if ( ! $ through [ 1 ] ) { $ through [ 1 ] = $ key ; } if ( ! $ through [ 2 ] ) { $ through [ 2 ] = $ target_key ; } $ rows = $ this -> _db -> builder ( ) -> select ( 't.*' ) -> from ( $ factory -> getTable ( ) . ' t' ) -> leftJoin ( $ through [ 0 ] . ' m' , 'm.' . $ through [ 2 ] . '=t.' . $ target_key ) -> where ( 'm.' . $ through [ 1 ] . '=:value' , array ( ':value' => $ this -> get ( $ key ) ) ) -> queryAll ( ) ; if ( false === $ rows ) { return false ; } return $ factory -> mapModels ( $ rows ) ; }
Many to many

@param string $target
@param string $through
@param string $key
@param string $target_key
@return array
Many to many