setName("ot:site:setdomain") ->setDescription("Set a new domain for the organization website") ->setHelp("Set a new domain for the organization website. If the --redirect argument is passed, " . "a redirection will be added from the existing domain to the new one.") ->addArgument( 'organization_id', InputArgument::REQUIRED, "The organization's id in the opentalent DB" ) ->addArgument( 'domain', InputArgument::REQUIRED, "The new domain to set up" ) ->addOption( 'redirect', 'r', InputOption::VALUE_NONE, 'Use this option to add a redirection from the previous domain to the new one' ); } /** * -- This method is expected by Typo3, do not rename ou remove -- * * Executes the command for creating the new organization * * @param InputInterface $input * @param OutputInterface $output * @throws \Exception */ protected function execute(InputInterface $input, OutputInterface $output) { $org_id = $input->getArgument('organization_id'); $domain = $input->getArgument('domain'); $redirect = $input->getOption('redirect'); $io = new SymfonyStyle($input, $output); $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class); $rootUid = $siteController->setSiteDomainAction($org_id, $domain, $redirect); $io->success(sprintf("The website with root uid " . $rootUid . " domain has been set to " . $domain)); } }