Declaration
https://github.com/magento/magento2/blob/8fd3e8/app/code/Magento/Sales/Model/Order.php#L62-L62
Usages
1. \Magento\Authorizenet\Controller\Adminhtml\Authorizenet\Directpost\Payment\Redirect::_returnQuote()
2. \Magento\Downloadable\Observer\SetLinkStatusObserver::execute()
3. \Magento\Paypal\Model\Hostedpro::initialize()
4. \Magento\Paypal\Model\Ipn::_registerPaymentPending()
https://github.com/magento/magento2/blob/8fd3e8/app/code/Magento/Paypal/Model/Ipn.php#L376-L382
5. \Magento\Paypal\Model\Payflowlink::initialize()
6. \Magento\Paypal\Model\Payflowlink::_getOrderFromResponse()
7. \Magento\Paypal\Model\Express\Checkout::place()
8. \Magento\Reports\Model\ResourceModel\Order\Collection::_prepareSummaryLive()
9. \Magento\Reports\Model\ResourceModel\Order\Collection::_calculateTotalsLive()
10. \Magento\Reports\Model\ResourceModel\Order\Collection::calculateSales()
11. \Magento\Sales\Model\CronJob\CleanExpiredOrders::execute()
981d1f/app/code/Magento/Sales/Model/CronJob/CleanExpiredOrders.php#L43-L67
/**
* Clean expired quotes (cron process)
*
* @return void
*/
public function execute()
{
$lifetimes = $this->storesConfig->getStoresConfigByPath('sales/orders/delete_pending_after');
foreach ($lifetimes as $storeId => $lifetime) {
/** @var $orders \Magento\Sales\Model\ResourceModel\Order\Collection */
$orders = $this->orderCollectionFactory->create();
$orders->addFieldToFilter('store_id', $storeId);
$orders->addFieldToFilter('status', Order::STATE_PENDING_PAYMENT);
$orders->getSelect()->where(
new \Zend_Db_Expr('TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, `updated_at`)) >= ' . $lifetime * 60)
);
try {
$orders->walk('cancel');
$orders->walk('save');
} catch (\Exception $e) {
$this->logger->error('Error cancelling deprecated orders: ' . $e->getMessage());
}
}
}