Yoast\WP\Lib
ORM::find_one() public Yoast 1.0
Tells the ORM that you are expecting a single result back from your query, and execute it. Will return a single instance of the ORM class, or false if no rows were returned. As a shortcut, you may supply an ID as a parameter to this method. This will perform a primary key lookup on the table.
{} Это метод класса: ORM{}
Хуков нет.
Возвращает
true|false/Model
. Null. Ничего.
Использование
$ORM = new ORM(); $ORM->find_one( $id );
- $id(null/число)
- An (optional) ID.
Код ORM::find_one() ORM::find one Yoast 16.1.1
public function find_one( $id = null ) {
if ( ! \is_null( $id ) ) {
$this->where_id_is( $id );
}
$this->limit( 1 );
$rows = $this->run();
if ( empty( $rows ) ) {
return false;
}
return $this->create_instance_from_row( $rows[0] );
}