N98\Magento\Command\Admin\User\DeleteUserCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Результат integer | void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output);
        if (!$this->initMagento()) {
            return;
        }
        /** @var $dialog DialogHelper */
        $dialog = $this->getHelper('dialog');
        // Username
        $id = $this->getOrAskForArgument('id', $input, $output, 'Username or Email');
        $user = $this->getUserModel()->loadByUsername($id);
        if (!$user->getId()) {
            $user = $this->getUserModel()->load($id, 'email');
        }
        if (!$user->getId()) {
            $output->writeln('<error>User was not found</error>');
            return;
        }
        $shouldRemove = $input->getOption('force');
        if (!$shouldRemove) {
            $shouldRemove = $dialog->askConfirmation($output, '<question>Are you sure?</question> <comment>[n]</comment>: ', false);
        }
        if ($shouldRemove) {
            try {
                $user->delete();
                $output->writeln('<info>User was successfully deleted</info>');
            } catch (Exception $e) {
                $output->writeln('<error>' . $e->getMessage() . '</error>');
            }
        } else {
            $output->writeln('<error>Aborting delete</error>');
        }
    }
DeleteUserCommand