public function update($currentVersion, $newVersion, ConnectionInterface $con) { if (file_exists(__DIR__ . "/Config/Update/{$newVersion}.sql")) { $database = new Database($con); $database->insertSql(null, [__DIR__ . "/Config/Update/{$newVersion}.sql"]); } if ($newVersion === "0.6") { $merchantId = self::getConfigValue('merchant_id'); if (null !== $merchantId) { $googleShoppingAccount = new GoogleshoppingAccount(); $googleShoppingAccount->setMerchantId($merchantId)->save(); $googleShoppingProducts = GoogleshoppingProductSynchronisationQuery::create()->find(); if (null !== $googleShoppingProducts) { /** @var GoogleshoppingProductSynchronisation $googleShoppingProduct */ foreach ($googleShoppingProducts as $googleShoppingProduct) { $googleShoppingProduct->setGoogleshoppingAccountId($googleShoppingAccount->getId())->save(); } } } } }