Yoast\WP\Lib
ORM::add_condition() protected Yoast 1.0
Adds a HAVING or WHERE condition to the query. Internal method.
{} Это метод класса: ORM{}
Хуков нет.
Возвращает
ORM
. Null. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->add_condition( $type, $fragment, $values );
- $type(строка) (обязательный)
- The type.
- $fragment(строка) (обязательный)
- The fragment.
- $values(массив)
- The values.
По умолчанию: empty array
Код ORM::add_condition() ORM::add condition Yoast 16.1.1
protected function add_condition( $type, $fragment, $values = [] ) {
$conditions_class_property_name = "{$type}_conditions";
if ( ! \is_array( $values ) ) {
$values = [ $values ];
}
\array_push(
$this->{$conditions_class_property_name},
[
self::CONDITION_FRAGMENT => $fragment,
self::CONDITION_VALUES => $values,
]
);
return $this;
}