src/Budkit/Datastore/Activerecord.php
final public function join($table, $cond, $type = 'LEFT')
    {

        if ($type != '') {
            $type = strtoupper(trim($type));

            if (!in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) {
                $type = '';
            } else {
                $type .= ' ';
            }
        }
        // Extract any aliases that might exist.  We use this information
        // in the _protect_identifiers to know whether to add a table prefix
        $this->traceTableAlias($table);

        // Strip apart the condition and protect the identifiers
        if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) {
            $match[1] = $this->identifiers($match[1]);
            $match[3] = $this->identifiers($match[3]);

            $cond = $match[1] . $match[2] . $match[3];
        }
        // Assemble the JOIN statement
        $join = $type . 'JOIN ' . $this->identifiers($table) . ' ON ' . $cond;

        $this->arrayJoin[] = $join;
        if ($this->arrayCaching === TRUE) {
            $this->arrayCacheJoin[] = $join;
            $this->arrayCacheExists[] = 'join';
        }

        return $this;
    }
final public function join($table, $cond, $type = 'LEFT')
    {

        if ($type != '') {
            $type = strtoupper(trim($type));

            if (!in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) {
                $type = '';
            } else {
                $type .= ' ';
            }
        }
        // Extract any aliases that might exist.  We use this information
        // in the _protect_identifiers to know whether to add a table prefix
        $this->traceTableAlias($table);

        // Strip apart the condition and protect the identifiers
        if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) {
            $match[1] = $this->identifiers($match[1]);
            $match[3] = $this->identifiers($match[3]);

            $cond = $match[1] . $match[2] . $match[3];
        }
        // Assemble the JOIN statement
        $join = $type . 'JOIN ' . $this->identifiers($table) . ' ON ' . $cond;

        $this->arrayJoin[] = $join;
        if ($this->arrayCaching === TRUE) {
            $this->arrayCacheJoin[] = $join;
            $this->arrayCacheExists[] = 'join';
        }

        return $this;
    }
final public function join ( $ table , $ cond , $ type = 'LEFT' ) { if ( $ type != '' ) { $ type = strtoupper ( trim ( $ type ) ) ; if ( ! in_array ( $ type , array ( 'LEFT' , 'RIGHT' , 'OUTER' , 'INNER' , 'LEFT OUTER' , 'RIGHT OUTER' ) ) ) { $ type = '' ; } else { $ type .= ' ' ; } } // Extract any aliases that might exist.  We use this information // in the _protect_identifiers to know whether to add a table prefix $ this -> traceTableAlias ( $ table ) ; // Strip apart the condition and protect the identifiers if ( preg_match ( '/([\w\.]+)([\W\s]+)(.+)/' , $ cond , $ match ) ) { $ match [ 1 ] = $ this -> identifiers ( $ match [ 1 ] ) ; $ match [ 3 ] = $ this -> identifiers ( $ match [ 3 ] ) ; $ cond = $ match [ 1 ] . $ match [ 2 ] . $ match [ 3 ] ; } // Assemble the JOIN statement $ join = $ type . 'JOIN ' . $ this -> identifiers ( $ table ) . ' ON ' . $ cond ; $ this -> arrayJoin [ ] = $ join ; if ( $ this -> arrayCaching === TRUE ) { $ this -> arrayCacheJoin [ ] = $ join ; $ this -> arrayCacheExists [ ] = 'join' ; } return $ this ; }
Adds a JOIN query statement

@param string $table the table name
@param string $cond The JOIN condition
@param string $type The type of JOIN e.g LEFT, RIGHT etc.
@return TuiyoDatabase
Adds a JOIN query statement