$this->themeLifecycleService->
refreshThemes($context);
$themeCriteria =
new Criteria();
$themeCriteria->
addAssociation('salesChannels'
);
$themeCriteria->
addFilter(new EqualsFilter('technicalName', 'Storefront'
));
/** @var ThemeEntity|null $theme */
$theme =
$this->themeRepository->
search($themeCriteria,
$context)->
first();
if (!
$theme) { throw new \
RuntimeException('Default theme not found'
);
} $themeSalesChannels =
$theme->
getSalesChannels();
// only run if the themes are not already initialised
if ($themeSalesChannels &&
$themeSalesChannels->
count() > 0
) { return;
} $salesChannelCriteria =
new Criteria();
$salesChannelCriteria->
addFilter(new EqualsFilter('typeId', Defaults::SALES_CHANNEL_TYPE_STOREFRONT
));
$salesChannelIds =
$this->salesChannelRepository->
search($salesChannelCriteria,
$context)->
getIds();
foreach ($salesChannelIds as $id) { $this->themeService->
compileTheme($id,
$theme->
getId(),
$context);
$this->themeSalesChannelRepository->
upsert([[