Yoast\WP\Lib

ORM::add_id_column_conditions()publicYoast 1.0

Adds a WHERE clause for every column that belongs to the primary key.

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

Хуков нет.

Возвращает

Строку. The where part of the query.

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

$ORM = new ORM();
$ORM->add_id_column_conditions();

Код ORM::add_id_column_conditions() Yoast 22.4

public function add_id_column_conditions() {
	$query   = [];
	$query[] = 'WHERE';
	$keys    = \is_array( $this->get_id_column_name() ) ? $this->get_id_column_name() : [ $this->get_id_column_name() ];
	$first   = true;
	foreach ( $keys as $key ) {
		if ( $first ) {
			$first = false;
		}
		else {
			$query[] = 'AND';
		}
		$query[] = $this->quote_identifier( $key );
		$query[] = '= %s';
	}

	return \implode( ' ', $query );
}