Automattic\WooCommerce\Caching
ObjectCache::get_id_from_object_if_null
Get the id from an object if the id itself is null.
Метод класса: ObjectCache{}
Хуков нет.
Возвращает
int|string|null. Passed $id if it wasn't null, otherwise id obtained from $object using get_object_id.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_id_from_object_if_null( $object, $id );
- $object(объект|массив) (обязательный)
- The object to get the id from.
- $id(int|строка|null) (обязательный)
- An object id or null.
Код ObjectCache::get_id_from_object_if_null() ObjectCache::get id from object if null WC 11.2.1
private function get_id_from_object_if_null( $object, $id ) {
if ( null === $id ) {
$id = $this->get_object_id( $object );
if ( null === $id ) {
throw new CacheException( "Null id supplied and the cache class doesn't implement get_object_id", $this );
}
}
return $id;
}