Automattic\WooCommerce\Internal\StockNotifications
Notification::__construct
Constructor.
Method of the class: Notification{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Notification = new Notification(); $Notification->__construct( $read );
- $read(int|object|array)
- ID to load from the DB (optional) or already queried data.
Notification::__construct() Notification:: construct code WC 10.3.6
public function __construct( $read = 0 ) {
parent::__construct( $read );
if ( is_numeric( $read ) && $read > 0 ) {
$this->set_id( $read );
} elseif ( $read instanceof self ) {
$this->set_id( $read->get_id() );
} elseif ( ! empty( $read->ID ) ) {
$this->set_id( absint( $read->ID ) );
} elseif ( is_array( $read ) && ! empty( $read['id'] ) ) {
$this->set_props( $read );
$this->set_object_read( true );
} else {
$this->set_object_read( true );
}
$this->data_store = \WC_Data_Store::load( 'stock_notification' );
if ( $this->get_id() > 0 ) {
$this->data_store->read( $this );
}
}