Magento 2:如何创建设置:以编程方式升级

问题描述

我想创建一个函数以允许运行安装程序升级,但是我不想使用Shell脚本来调用“ setup:upgrade”命令。我尝试阅读核心功能,发现了这段代码

    $request = $input->getoptions();
    $keepGenerated = $input->getoption(self::INPUT_KEY_KEEP_GENERATED);
    $installer = $this->installerFactory->create(new ConsoleLogger($output));
    $installer->updateModulesSequence($keepGenerated);
    $installer->installSchema($request);
    $installer->installDataFixtures($request);

但是我尝试将这段代码用于我的函数,但遇到了这样的问题

未捕获的错误:无法实例化接口 Zend \ ServiceManager \ ServiceLocatorInterface在 /var/www/html/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.PHP:50

我通过为ServiceLocatorInterface创建首选项来解决此问题

<preference for="Zend\ServiceManager\ServiceLocatorInterface" type="Zend\ServiceManager\ServiceManager" />

一个问题,我已经找到解决该问题的解决方法

Zend \ ServiceManager \ ServiceManager :: get无法获取或创建 Magento \ Framework \ Setup \ FilePermissions

的实例

有人知道这个问题吗?请让我知道您是否可以解决它,谢谢您!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)