Yoast\WP\Lib
ORM::id() public Yoast 1.0
Gets the primary key ID of this object.
{} Это метод класса: ORM{}
Хуков нет.
Возвращает
Массив/Разное/null.
Использование
$ORM = new ORM(); $ORM->id( $disallow_null );
- $disallow_null(true/false)
- Whether to allow null IDs.
Код ORM::id() ORM::id Yoast 15.9.1
public function id( $disallow_null = false ) {
$id = $this->get( $this->get_id_column_name() );
if ( $disallow_null ) {
if ( \is_array( $id ) ) {
foreach ( $id as $id_part ) {
if ( $id_part === null ) {
throw new \Exception( 'Primary key ID contains null value(s)' );
}
}
}
else {
if ( $id === null ) {
throw new \Exception( 'Primary key ID missing from row or is null' );
}
}
}
return $id;
}