protected function prepareJoins($fromAlias): string
    {
        if (!isset($this->join[$fromAlias])) {
            return '';
        }

        $query = '';

        foreach ($this->join[$fromAlias] as $join) {
            $query .= ' ' . strtoupper($join['joinType'])
                . ' JOIN ' . Db::quoteIdentifier($join['joinTable']) . ' AS ' . Db::quoteIdentifier($join['joinAlias'])
                . ' ON ' . $join['joinCondition'];
            $query .= $this->prepareJoins($join['joinAlias']);
        }

        return $query;
    }
protected function prepareJoins($fromAlias): string
    {
        if (!isset($this->join[$fromAlias])) {
            return '';
        }

        $query = '';

        foreach ($this->join[$fromAlias] as $join) {
            $query .= ' ' . strtoupper($join['joinType'])
                . ' JOIN ' . Db::quoteIdentifier($join['joinTable']) . ' AS ' . Db::quoteIdentifier($join['joinAlias'])
                . ' ON ' . $join['joinCondition'];
            $query .= $this->prepareJoins($join['joinAlias']);
        }

        return $query;
    }
protected function prepareJoins ( $ fromAlias ) : string { if ( ! isset ( $ this -> join [ $ fromAlias ] ) ) { return '' ; } $ query = '' ; foreach ( $ this -> join [ $ fromAlias ] as $ join ) { $ query .= ' ' . strtoupper ( $ join [ 'joinType' ] ) . ' JOIN ' . Db :: quoteIdentifier ( $ join [ 'joinTable' ] ) . ' AS ' . Db :: quoteIdentifier ( $ join [ 'joinAlias' ] ) . ' ON ' . $ join [ 'joinCondition' ] ; $ query .= $ this -> prepareJoins ( $ join [ 'joinAlias' ] ) ; } return $ query ; }
Generate SQL string for JOINs

@param  string $fromAlias The alias of the table

@return string
Generate SQL string for JOINs