Yoast\WP\Lib

ORM::build_update()protectedYoast 1.0

Builds an UPDATE query.

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

Хуков нет.

Возвращает

Строку. The update query.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->build_update();

Код ORM::build_update() Yoast 22.4

protected function build_update() {
	$query      = [];
	$query[]    = "UPDATE {$this->quote_identifier($this->table_name)} SET";
	$field_list = [];
	foreach ( $this->dirty_fields as $key => $value ) {
		if ( ! \array_key_exists( $key, $this->expr_fields ) ) {
			$value = ( $value === null ) ? 'NULL' : '%s';
		}
		$field_list[] = "{$this->quote_identifier($key)} = {$value}";
	}
	$query[] = \implode( ', ', $field_list );

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