PartKeepr\AuthBundle\Command\ProtectUserCommand::execute PHP Method

execute() public method

public execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    public function execute(InputInterface $input, OutputInterface $output)
    {
        $userService = $this->getContainer()->get('partkeepr.userservice');
        $fosUser = $this->getContainer()->get('fos_user.user_manager')->findUserByUsername($input->getArgument('username'));
        if ($fosUser === null) {
            $output->writeln(sprintf('User %s not found', $input->getArgument('username')));
        } else {
            $user = $userService->getProxyUser($fosUser->getUsername(), $userService->getBuiltinProvider(), true);
            $userService->protect($user);
            $output->writeln(sprintf('User %s protected against changes', $input->getArgument('username')));
        }
    }
ProtectUserCommand