在 Shopware 6 中解释这些 Services.xml 文件术语

Explain These Services.xml File Terms In Shopware 6

argument 和参数 type 是什么意思, tag 和标签 name 是什么意思, 在 Shopware 6 插件 services.xml 文件中?

<?xml version="1.0" ?>

<services>
    <service id="Winner\Service\ExampleService" />

    <service id="Winner\Service\ExampleServiceDecorator" decorates="Winner\Service\ExampleService">
        <tag name="kernel.event_listener" event="product.loaded" />
        <argument type="service" id="Winner\Service\ExampleServiceDecorator.inner" />
    </service>
</services>

services.xml 文件是 symfony dependency injection container 的配置文件。

默认情况下,Symfony 允许自动装配配置,但 Shopware 默认是手动配置 DI 容器。请参考Symfony docs for more information on manually configuring the DI.

还有 Symfony docs also have more information on service tags.

所以从技术上讲,这不是 Shopware 特定的问题,而是 Symfony 的问题。希望我的回答和提供的文档对您有所帮助。