config = $config; $this->quoteCollectionFactory = $collectionFactory; } /** * Gets expired quotes * * Quote is considered expired if the latest update date * of the quote is greater than lifetime threshold * * @param StoreInterface $store * @return AbstractCollection */ public function getExpiredQuotes(StoreInterface $store): AbstractCollection { $lifetime = $this->config->getValue( $this->quoteLifetime, ScopeInterface::SCOPE_STORE, $store->getCode() ); $lifetime *= $this->secondsInDay; /** @var $quotes Collection */ $quotes = $this->quoteCollectionFactory->create(); $quotes->addFieldToFilter('store_id', $store->getId()); $quotes->addFieldToFilter('updated_at', ['to' => date("Y-m-d", time() - $lifetime)]); return $quotes; } }