protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
$resourceId = new \Newscoop\Service\Resource\ResourceId(__CLASS__);
$themeService = $resourceId->getService(IThemeManagementService::NAME_1);
$publicationService = $this->getContainer()->getService('content.publication');
$publications = $publicationService->findAll();
$themeToSet = (string) $input->getArgument('theme');
if ($themeToSet != null) {
foreach ($themeService->getUnassignedThemes() as $theme) {
if (strpos($theme->getPath(), $themeToSet) !== false) {
foreach ($publications as $publication) {
$themeService->assignTheme($theme, $publication, true);
}
}
}
} else {
foreach ($themeService->getUnassignedThemes() as $theme) {
foreach ($publications as $publication) {
$themeService->assignTheme($theme, $publication, true);
}
}
}
}