bundle/Command/InstallCommand.php
protected function doInteract()
    {
        $siteAccess = $this->askForData(
            'site-access-name',
            'Enter the name of the Netgen Admin UI siteaccess',
            'ngadminui',
            function ($siteaccess) {
                if (!preg_match('/^[a-z][a-z0-9_]*$/', $siteaccess)) {
                    throw new InvalidArgumentException(
                        'Siteaccess name is not valid. It must start with a letter, followed by any combination of letters, numbers and underscore.'
                    );
                }

                $existingSiteAccesses = $this->getContainer()->getParameter('ezpublish.siteaccess.list');
                if (in_array($siteaccess, $existingSiteAccesses, true)) {
                    throw new InvalidArgumentException(
                        sprintf('Siteaccess "%s" already exists.', $siteaccess)
                    );
                }

                return $siteaccess;
            }
        );

        $this->output->writeln('');

        $languageCode = $this->askForData(
            'language-code',
            'Enter the language code in which the Netgen Admin UI will be translated',
            'eng-GB',
            function ($languageCode) {
                $languageService = $this->getContainer()->get('ezpublish.api.repository')->getContentLanguageService();

                try {
                    $languageService->loadLanguage($languageCode);
                } catch (NotFoundException $e) {
                    throw new InvalidArgumentException(
                        sprintf('Language code "%s" does not exist.', $languageCode)
                    );
                }

                return $languageCode;
            }
        );

        $this->output->writeln('');

        $availableGroups = array_keys($this->getContainer()->getParameter('ezpublish.siteaccess.groups'));
        $availableGroups[] = 'default';

        $siteAccessGroup = $this->askForChoiceData(
            'site-access-group',
            'Enter the siteaccess group name on which the Netgen Admin UI configuration will be based. This is usually the name of your frontend siteaccess group',
            $availableGroups,
            current($availableGroups)
        );

        $this->writeSection('Summary before installation');

        $this->output->writeln(
            array(
                'You are going to generate legacy <info>' . $siteAccess . '</info> siteaccess with <info>' . $languageCode . '</info> language code based on <info>' . $siteAccessGroup . '</info> siteaccess group.',
                '',
            )
        );

        if (
            !$this->questionHelper->ask(
                $this->input,
                $this->output,
                $this->getConfirmationQuestion(
                    'Do you confirm installation (answering <comment>no</comment> will restart the process)',
                    true
                )
            )
        ) {
            $this->output->writeln('');

            return false;
        }

        return true;
    }
protected function doInteract()
    {
        $siteAccess = $this->askForData(
            'site-access-name',
            'Enter the name of the Netgen Admin UI siteaccess',
            'ngadminui',
            function ($siteaccess) {
                if (!preg_match('/^[a-z][a-z0-9_]*$/', $siteaccess)) {
                    throw new InvalidArgumentException(
                        'Siteaccess name is not valid. It must start with a letter, followed by any combination of letters, numbers and underscore.'
                    );
                }

                $existingSiteAccesses = $this->getContainer()->getParameter('ezpublish.siteaccess.list');
                if (in_array($siteaccess, $existingSiteAccesses, true)) {
                    throw new InvalidArgumentException(
                        sprintf('Siteaccess "%s" already exists.', $siteaccess)
                    );
                }

                return $siteaccess;
            }
        );

        $this->output->writeln('');

        $languageCode = $this->askForData(
            'language-code',
            'Enter the language code in which the Netgen Admin UI will be translated',
            'eng-GB',
            function ($languageCode) {
                $languageService = $this->getContainer()->get('ezpublish.api.repository')->getContentLanguageService();

                try {
                    $languageService->loadLanguage($languageCode);
                } catch (NotFoundException $e) {
                    throw new InvalidArgumentException(
                        sprintf('Language code "%s" does not exist.', $languageCode)
                    );
                }

                return $languageCode;
            }
        );

        $this->output->writeln('');

        $availableGroups = array_keys($this->getContainer()->getParameter('ezpublish.siteaccess.groups'));
        $availableGroups[] = 'default';

        $siteAccessGroup = $this->askForChoiceData(
            'site-access-group',
            'Enter the siteaccess group name on which the Netgen Admin UI configuration will be based. This is usually the name of your frontend siteaccess group',
            $availableGroups,
            current($availableGroups)
        );

        $this->writeSection('Summary before installation');

        $this->output->writeln(
            array(
                'You are going to generate legacy <info>' . $siteAccess . '</info> siteaccess with <info>' . $languageCode . '</info> language code based on <info>' . $siteAccessGroup . '</info> siteaccess group.',
                '',
            )
        );

        if (
            !$this->questionHelper->ask(
                $this->input,
                $this->output,
                $this->getConfirmationQuestion(
                    'Do you confirm installation (answering <comment>no</comment> will restart the process)',
                    true
                )
            )
        ) {
            $this->output->writeln('');

            return false;
        }

        return true;
    }
Collects all the data interactively.

@return bool