Magento2升级脚本将模块从模块阵列中删除


Magento2 upgrade script removes module out of modules array

我有我的模块配置

app/code/SET/HelloWorld/ec.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    
    <router id="standard">
    
        <route id="helloworld" frontName="helloworld">
    
            <module name="SET_HelloWorld" />
    
        </route>
    
    </router>
    
</config>
       

并将其添加到etc/config.php中:

'SET_HelloWorld' => 1,

但是在运行bin/magento setup:upgrade之后,te config.php数组中的键就不见了。

有人能告诉我为什么吗?

我发现我错过了Registration.php

<?php
'Magento'Framework'Component'ComponentRegistrar::register(
    'Magento'Framework'Component'ComponentRegistrar::MODULE,
    'SET_HelloWorld',
    __DIR__
);

如果模块未注册,则magento会自动将其从config.php数组中删除。

这个注册是最近添加的,在

的许多在线教程中都找不到