i have added a Custom Attribute in sales_order_grid table now I want to get a record from sales_order_grid by entity_id. Is there any model that I can use easily o inject and get sales_order_grid Data in Magento 2
Asked
Active
Viewed 723 times
0
User 69
- 145
- 14
-
please try this https://magento.stackexchange.com/a/305429 – Msquare Jun 23 '20 at 12:06
1 Answers
0
within the file vendor/magento/module-sales/etc/di.xml, I extract a small part of it:
this describes the grid component pulls its data using the model: Magento\Sales\Model\ResourceModel\Order\Grid\Collection.
So my answer would be to pull the order like the grid does to use this resource Model. Now, if you do need only order data given an entity id, the recommended way is to use the sales order repository, and that is \Magento\Sales\Model\OrderRepository
Herve Tribouilloy
- 7,668
- 2
- 13
- 28
