sphinx\Query join()

join() public method

Appends a JOIN part to the query.

The first parameter specifies what type of join it is.

public $this join ( $type, $table, $on = '', $params = [] )
$type string

The type of join, such as INNER JOIN, LEFT JOIN.

$table string|array

The table to be joined.

Use a string to represent the name of the table to be joined. The table name can contain a schema prefix (e.g. 'public.user') and/or table alias (e.g. 'user u'). The method will automatically quote the table name unless it contains some parenthesis (which means the table is given as a sub-query or DB expression).

Use an array to represent joining with a sub-query. The array must contain only one element. The value must be a yii\sphinx\Query object representing the sub-query while the corresponding key represents the alias for the sub-query.

$on string|array

The join condition that should appear in the ON part. Please refer to where() on how to specify this parameter.

Note that the array format of where() is designed to match columns to values instead of columns to columns, so the following would not work as expected: ['post.author_id' => 'user.id'], it would match the post.author_id column value against the string 'user.id'. It is recommended to use the string syntax here which is more suited for a join:

'post.author_id = user.id'
$params array

The parameters (name => value) to be bound to the query.

return $this

The query object itself

doc_Yii
2016-10-30 17:12:19
Comments
Leave a Comment

Please login to continue.