FOS\UserBundle\Command\DeactivateUserCommand::interact PHP Method

interact() protected method

See also: Command
protected interact ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function interact(InputInterface $input, OutputInterface $output)
    {
        if (!$input->getArgument('username')) {
            $username = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a username:', function ($username) {
                if (empty($username)) {
                    throw new \Exception('Username can not be empty');
                }
                return $username;
            });
            $input->setArgument('username', $username);
        }
    }

Usage Example

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     /** @var UserDiscriminatorInterface $discriminator */
     $discriminator = $this->getContainer()->get('rollerworks_multi_user.user_discriminator');
     $discriminator->setCurrentUser($input->getOption('user-system'));
     parent::interact($input, $output);
 }
DeactivateUserCommand