Не удается добавить новую команду командной строки "Класс не существует" при установке: обновление


Я пытаюсь добавить пользовательскую команду для начала "привет, мир". Я делаю все по инструкции, но всегда есть эта ошибка

[Исключение отражения]
Класс Hesoy\HelloWorld\Консоль\Команда\Команда HelloWorld не существует

Это мои шаги по настройке:

  1. Очистить кэш
  2. настройка: обновление

Это мой файлы

Команда

namespace Hesoy\HelloWorld\Console\Command;


use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class HelloWorldCommand extends Command
{
    public function __construct($name = null)
    {
        parent::__construct($name);
    }

    protected function configure()
    {
        $this->setName('hesoy:hello-world')
            ->setDescription('Hello world');

        parent::configure();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Hello world!');
    }
}

Di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\Console\CommandListInterface">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="helloWorld" xsi:type="object">Hesoy\HelloWorld\Console\Command\HelloWorldCommand</item>
            </argument>
        </arguments>
    </type>
</config>

Module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Hesoy_HelloWorld" setup_version="0.1.0">
    </module>
</config

Registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Hesoy_HelloWorld',
    __DIR__
);
Author: Teja Bhagavan Kollepara, 2018-01-18

2 answers

Недопустимый di.xml . Пожалуйста, исправьте это.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\Console\CommandListInterface">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="helloWorld" xsi:type="object">Hesoy\HelloWorld\Console\Command\HelloWorldCommand</item>
            </argument>
        </arguments>
    </type>
</config>
 1
Author: Suresh Chikani, 2018-01-19 05:19:32

Итак, идиотская ошибка, это был неправильный модуль [Имя поставщика]/[Имя модуля]. Было app/code/hesoy/hello-world и нужно app/code/Hesoy/HelloWorld.

 0
Author: hesoy, 2018-01-18 23:32:46