$criteria =
$this->
createCriteria($salesChannelId);
$this->eventDispatcher->
dispatch( new SitemapSalesChannelCriteriaEvent($criteria,
$context) );
$salesChannels =
$this->salesChannelRepository->
search($criteria,
$context);
/** @var SalesChannelEntity $salesChannel */
foreach ($salesChannels as $salesChannel) { /** @var list<string> $languageIds */
$languageIds =
$salesChannel->
getDomains()->
map(fn (SalesChannelDomainEntity
$salesChannelDomain) =>
$salesChannelDomain->
getLanguageId());
$languageIds =
array_unique($languageIds);
foreach ($languageIds as $languageId) { $salesChannelContext =
$this->salesChannelContextFactory->
create('',
$salesChannel->
getId(),
[SalesChannelContextService::LANGUAGE_ID =>
$languageId]);
$output->
writeln(sprintf('Generating sitemaps for sales channel %s (%s) with and language %s...',
$salesChannel->
getId(),
$salesChannel->
getName(),
$languageId));
try { $this->
generateSitemap($salesChannelContext,
$input->
getOption('force'
));
} catch (AlreadyLockedException
$exception) { $output->
writeln(sprintf('ERROR: %s',
$exception->
getMessage()));
}