Yoast\WP\Lib

ORM::raw_join()publicYoast 1.0

Adds a RAW JOIN source to the query.

Метод класса: ORM{}

Хуков нет.

Возвращает

ORM.

Использование

$ORM = new ORM();
$ORM->raw_join( $table, $constraint, $table_alias, $parameters );
$table(строка) (обязательный)
The table name.
$constraint(строка) (обязательный)
The constraint.
$table_alias(строка) (обязательный)
The table alias.
$parameters(массив)
The parameters.
По умолчанию: an empty array

Код ORM::raw_join() Yoast 22.4

public function raw_join( $table, $constraint, $table_alias, $parameters = [] ) {
	// Add table alias if present.
	if ( ! \is_null( $table_alias ) ) {
		$table_alias = $this->quote_identifier( $table_alias );
		$table      .= " {$table_alias}";
	}
	$this->values = \array_merge( $this->values, $parameters );
	// 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[] = "{$table} ON {$constraint}";

	return $this;
}