1

Magento 2 has a console command admin:user:create

At a quick search we find a class that defines a command with such a name Magento\Setup\Console\Command\AdminUserCreateCommand

Yet putting a breakpoint or even the old var_dump die seems to have no effect when this console command is run admin:user:create.

So what code is executed when we run admin:user:create from the console?

 /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        var_dump("here");
        exit;
        $errors = $this->validate($input);
        if ($errors) {
            $output->writeln('<error>' . implode('</error>' . PHP_EOL . '<error>', $errors) . '</error>');
            // we must have an exit code higher than zero to indicate something was wrong
            return \Magento\Framework\Console\Cli::RETURN_FAILURE;
        }
        $installer = $this->installerFactory->create(new ConsoleLogger($output));
        $installer->installAdminUser($input->getOptions());
        $output->writeln(
            '<info>Created Magento administrator user named ' . $input->getOption(AdminAccount::KEY_USER) . '</info>'
        );
    }

Does nothing. The command executes freely.

2

1 Answer 1

1

There are two classes Magento\Setup\Console\Command\AdminUserCreateCommand. One is placed inside setup dir and the other one is inside vendor/magento2-base.

Magento usses the one from root/setup/src/Magento/Setup...

The interact method always executes first. Followed by the execute method.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.