/** * Return collection of order status history items. * * @return HistoryCollection */ public function getStatusHistoryCollection() { $collection = $this->_historyCollectionFactory->create()->setOrderFilter($this)->setOrder('created_at', 'desc')->setOrder('entity_id', 'desc'); if ($this->getId()) { foreach ($collection as $status) { $status->setOrder($this); } } return $collection; }
/** * Return collection of order status history items. * * @param bool $reload * @return HistoryCollection */ public function getStatusHistoryCollection($reload = false) { if (is_null($this->_statusHistory) || $reload) { $this->_statusHistory = $this->_historyCollectionFactory->create()->setOrderFilter($this)->setOrder('created_at', 'desc')->setOrder('entity_id', 'desc'); if ($this->getId()) { foreach ($this->_statusHistory as $status) { $status->setOrder($this); } } } return $this->_statusHistory; }