Yoast\WP\Lib

ORM::add_result_column()protectedYoast 1.0

Adds an unquoted expression to the set of columns returned by the SELECT query. Internal method.

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

Хуков нет.

Возвращает

ORM.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_result_column( $expr, $alias );
$expr(строка) (обязательный)
The expression.
$alias(строка|null)
The alias to return the expression as.
По умолчанию: null

Код ORM::add_result_column() Yoast 22.4

protected function add_result_column( $expr, $alias = null ) {
	if ( ! \is_null( $alias ) ) {
		$expr .= ' AS ' . $this->quote_identifier( $alias );
	}
	if ( $this->using_default_result_columns ) {
		$this->result_columns               = [ $expr ];
		$this->using_default_result_columns = false;
	}
	else {
		$this->result_columns[] = $expr;
	}

	return $this;
}