src/Titon/Db/Query.php
protected function _addJoin($type, $table, $fields, $on = []) {
        $repo = $this->getRepository();
        $join = new Join($type);
        $conditions = [];

        if (is_array($table)) {
            $alias = $table[1];
            $table = $table[0];
        } else {
            $alias = $table;
        }

        foreach ($on as $pfk => $rfk) {
            if (strpos($pfk, '.') === false) {
                $pfk = $repo->getAlias() . '.' . $pfk;
            }

            if (strpos($rfk, '.') === false) {
                $rfk = $alias . '.' . $rfk;
            }

            $conditions[$pfk] = $rfk;
        }

        $this->_joins[] = $join->from($table, $alias)->on($conditions)->fields($fields);

        return $this;
    }
protected function _addJoin($type, $table, $fields, $on = []) {
        $repo = $this->getRepository();
        $join = new Join($type);
        $conditions = [];

        if (is_array($table)) {
            $alias = $table[1];
            $table = $table[0];
        } else {
            $alias = $table;
        }

        foreach ($on as $pfk => $rfk) {
            if (strpos($pfk, '.') === false) {
                $pfk = $repo->getAlias() . '.' . $pfk;
            }

            if (strpos($rfk, '.') === false) {
                $rfk = $alias . '.' . $rfk;
            }

            $conditions[$pfk] = $rfk;
        }

        $this->_joins[] = $join->from($table, $alias)->on($conditions)->fields($fields);

        return $this;
    }
protected function _addJoin ( $ type , $ table , $ fields , $ on = [ ] ) { $ repo = $ this -> getRepository ( ) ; $ join = new Join ( $ type ) ; $ conditions = [ ] ; if ( is_array ( $ table ) ) { $ alias = $ table [ 1 ] ; $ table = $ table [ 0 ] ; } else { $ alias = $ table ; } foreach ( $ on as $ pfk => $ rfk ) { if ( strpos ( $ pfk , '.' ) === false ) { $ pfk = $ repo -> getAlias ( ) . '.' . $ pfk ; } if ( strpos ( $ rfk , '.' ) === false ) { $ rfk = $ alias . '.' . $ rfk ; } $ conditions [ $ pfk ] = $ rfk ; } $ this -> _joins [ ] = $ join -> from ( $ table , $ alias ) -> on ( $ conditions ) -> fields ( $ fields ) ; return $ this ; }
Add a new join type.

@param string $type
@param string|array $table
@param array $fields
@param array $on
@return $this
Add a new join type .