You appear to be a bot. Output may be restricted
Description
Add a JOIN source to the query. Internal method.
The join_operator should be one of INNER, LEFT OUTER, CROSS etc – this will be prepended to JOIN.
The table should be the name of the table to join to.
The constraint may be either a string or an array with three elements. If it is a string, it will be compiled into the query as-is, with no escaping. The recommended way to supply the constraint is as an array with three elements:
first_column, operator, second_column
Example: array('user.id', '=', 'profile.user_id')
will compile to
ON user`.`id
= profile`.`user_id
The final (optional) argument specifies an alias for the joined table.
Usage
$ORM = ORM::add_join_source( $join_operator, $table, $constraint, $table_alias );
Parameters
- $join_operator
- ( string ) required – The join_operator should be one of INNER, LEFT OUTER, CROSS etc – this will be prepended to JOIN.
- $table
- ( string ) required – The table should be the name of the table to join to.
- $constraint
- ( string ) required – The constraint.
- $table_alias
- ( string|null ) optional – The alias for the joined table. Defaults to null.
Returns
ORM
Source
File name: wordpress-seo/lib/orm.php
Lines:
protected function add_join_source( $join_operator, $table, $constraint, $table_alias = null ) { $join_operator = \trim( "{$join_operator} JOIN" ); $table = $this->quote_identifier( $table ); // Add table alias if present. if ( ! \is_null( $table_alias ) ) { $table_alias = $this->quote_identifier( $table_alias ); $table .= " {$table_alias}"; } // Build the constraint. if ( \is_array( $constraint ) ) { list( $first_column, $operator, $second_column ) = $constraint; $first_column = $this->quote_identifier( $first_column ); $second_column = $this->quote_identifier( $second_column ); $constraint = "{$first_column} {$operator} {$second_column}"; } $this->join_sources[] = "{$join_operator} {$table} ON {$constraint}"; return $this; }