0

In Continue with

Magento 2: How many tables required to change Order Status Programmatically?

I have below code

$orderIds = array();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Grid\Collection');
$update = $orderCollection->update('sales_order_grid', ['status' => 'complete',], ["entity_id", ["in" => $orderIds]]);

$orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Collection');
$update = $orderCollection->update('sales_order', ['status' => 'complete',], ["entity_id", ["in" => $orderIds]]);

Can i update at both tables at 1 time or one go like https://stackoverflow.com/questions/8765490/mysql-update-two-tables-at-once

Looking for answer in Magento 2 Way, if above is possible

2
  • If you do update in transaction there no differents to update one or two table
    – KAndy
    Oct 4, 2016 at 8:01
  • @KAndy Question still remains how to update multiple tables at one shot? Above is just example. I'm talking about in General for Magento 2
    – Jackson
    Oct 4, 2016 at 8:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.