resourceConnection = $resourceConnection; } /** * @inheritdoc */ public function execute(int $orderId, callable $callable, array $args = []) { $connection = $this->resourceConnection->getConnection('sales'); $connection->beginTransaction(); $query = $connection->select() ->from($this->resourceConnection->getTableName('sales_order'), 'entity_id') ->where('entity_id = ?', $orderId) ->forUpdate(true); $connection->query($query); try { $result = $callable(...$args); $connection->commit(); return $result; } catch (\Throwable $e) { $connection->rollBack(); throw $e; } } }