Yoast\WP\Lib

ORM::run()protectedYoast 1.0

Executes the SELECT query that has been built up by chaining methods on this class. Return an array of rows as associative arrays.

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

Хуки из метода

Возвращает

Массив|false. The result rows. False if the query failed.

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

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

Код ORM::run() Yoast 22.4

protected function run() {
	global $wpdb;

	$query   = $this->build_select();
	$success = self::execute( $query, $this->values );

	if ( $success === false ) {
		// If the query fails run the migrations and try again.
		// Action is intentionally undocumented and should not be used by third-parties.
		\do_action( '_yoast_run_migrations' );
		$success = self::execute( $query, $this->values );
	}

	$this->reset_idiorm_state();

	if ( $success === false ) {
		return false;
	}

	$rows = [];
	foreach ( $wpdb->last_result as $row ) {
		$rows[] = \get_object_vars( $row );
	}

	return $rows;
}