public function getConnectionForAllInTransactionInvolvedTables(string ...$tableNames) : Connection
    {
        if (empty($tableNames) || count($tableNames) < 2) {
            throw new \InvalidArgumentException(__METHOD__ . ' requires at least 2 table names.', 1504801512);
        }

        if (!$this->isConnectionForAllTablesTheSame(...$tableNames)) {
            throw new \RuntimeException(
                vsprintf('The tables "%s" using different database connections. Transaction needs same database connection ' .
                    'for all tables, please reconfigure the database settings for involved tables properly.', [implode('", "', $tableNames)]
                ), 1504866142
            );
        }
        return GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(array_shift($tableNames));
    }