diff --git a/vendor/magento/module-sales/Model/ResourceModel/Grid.php b/vendor/magento/module-sales/Model/ResourceModel/Grid.php index 70588c3c5140b..53af967c8341a 100644 --- a/vendor/magento/module-sales/Model/ResourceModel/Grid.php +++ b/vendor/magento/module-sales/Model/ResourceModel/Grid.php @@ -7,6 +7,7 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Sales\Model\Grid\LastUpdateTimeCache; use Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProviderInterface; @@ -89,6 +90,8 @@ public function __construct( ObjectManager::getInstance()->get(LastUpdateTimeCache::class); parent::__construct($context, $connectionName); + + $this->connection = $this->_resources->getConnection('sales'); } /** @@ -166,7 +169,7 @@ public function getOrderIdField() * * @return \Magento\Framework\DB\Select */ - protected function getGridOriginSelect() + public function getGridOriginSelect() { $select = $this->getConnection()->select() ->from([$this->mainTableName => $this->getTable($this->mainTableName)], []); @@ -194,4 +197,15 @@ protected function getGridOriginSelect() $select->columns($columns); return $select; } + + /** + * @inheritDoc + */ + public function getMainTable() + { + if (empty($this->mainTableName)) { + throw new LocalizedException(new \Magento\Framework\Phrase('Empty main table name')); + } + return $this->mainTableName; + } }