I am trying to use the itemFactory to get last 30 minutes (updated_at) data from sales_order_item table , but not success. Anyone can hep to verify where I did wrong?
use Magento\Sales\Model\Order\ItemFactory as itemFactoryCollection; protected $itemFactory; public function __construct( itemFactoryCollection $itemFactory ) { $this->itemFactory = $itemFactory; } public function getOrderItems(): itemFactory { $orderItemCollectData = $this->itemFactory->create()->getCollection(); $orderItemCollectData->getSelect() ->where( 'updated_at >= ?', $orderItemCollectData->getConnection()->getDateSubSql( new Zend_Db_Expr('NOW()'), '30', AdapterInterface::INTERVAL_MINUTE ) ); return $orderItemCollectData; } $OrderItems = $this->getOrderItems();