Php 如何在Shopware 5中注册我的服务和组件?

Php 如何在Shopware 5中注册我的服务和组件?,php,symfony,shopware,Php,Symfony,Shopware,在services.xml中注册服务和组件时遇到问题 这是我尝试注册组件时收到的信息 PHP致命错误:未捕获Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:服务“task.task\u订户”依赖于不存在的服务“task.service.random\u product”。在/var/www/shopware/vendor/symfony/dependency injection/Compiler/c

在services.xml中注册服务和组件时遇到问题

这是我尝试注册组件时收到的信息

PHP致命错误:未捕获Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:服务“task.task\u订户”依赖于不存在的服务“task.service.random\u product”。在/var/www/shopware/vendor/symfony/dependency injection/Compiler/checkexceptionninvalidereferencebehaviorpass.php:31\n堆栈跟踪:\n#0/var/www/shopware/vendor/symfony/dependency injection/Compiler/AbstractRecursivePass.php(60):symfony\Component\dependency injection\Compiler\checkexceptionnivalidereferencebehaviorpass->->\processValue(对象(Symfony\Component\DependencyInjection\Reference),false)\n#1/var/www/shopware/vendor/Symfony/dependency injection/Compiler/checkexceptionninvalidreferencebehaviorpass.php(28):Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->->processValue(数组,false)\n#2/var/www/shopware/vendor/symfony/dependency injection/Compiler/AbstractRecursivePass.php(67):symfony\Component\dependency injection\Compiler\checkexception无效引用行为过程->过程值(数组)\第31行的/var/www/shopware/vendor/symfony/dependency injection/Compiler/checkexceptionninvalidreferencebehaviorpass.php中的n#3/var

这是my services.xml


%任务。插件名称%
%任务.插件目录%

有人能给我解释一下问题是什么吗?

task.components.random\u product
vs
task.random\u product
两者都不起作用。您试图调试这个问题的原因是什么?另外,为什么服务定义在给定的错误消息中遗漏了任何出现的
task.service.random\u product
?您正在注册正在使用id
task.random\u product
禁用服务,但尝试将其与
task.components.random\u product
一起使用。您需要在两个位置使用相同的id。
<services>
    <service id="task.task_subscriber" class="Task\Subscriber\TaskSubscriber">
        <argument>%task.plugin_name%</argument>
        <argument>%task.plugin_dir%</argument>
        <argument type="service" id="task.components.random_product" />
        <argument type="service" id="shopware.plugin.cached_config_reader" />
        <tag name="shopware.event_subscriber" />
    </service>

    <service id="task.random_product" class="Task\Components\RandomProduct">
        <argument type="service" id="dbal_connection"/>
    </service>
</services>