Yoast\WP\Lib

ORM::build_conditions()protectedYoast 1.0

Builds a WHERE or HAVING clause.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->build_conditions( $type );
$type(строка) (обязательный)
Where or having.

Код ORM::build_conditions() Yoast 22.4

protected function build_conditions( $type ) {
	$conditions_class_property_name = "{$type}_conditions";
	// If there are no clauses, return empty string.
	if ( \count( $this->{$conditions_class_property_name} ) === 0 ) {
		return '';
	}
	$conditions = [];
	foreach ( $this->{$conditions_class_property_name} as $condition ) {
		$conditions[] = $condition[ self::CONDITION_FRAGMENT ];
		$this->values = \array_merge( $this->values, $condition[ self::CONDITION_VALUES ] );
	}

	return \strtoupper( $type ) . ' ' . \implode( ' AND ', $conditions );
}