从 Shopware 5.6.10->5.7.6 升级后,自定义控制台命令丢失
After upgrade from Shopware 5.6.10->5.7.6, custom console commands are missing
我们将用于测试的 Shopware 5 系统从 5.6.10 升级到 5.7.6
现在控制台命令
hpr:orders:export
丢失。
这是来自不再受官方支持的市场模块 - 问题是是否有一种简单的方法来修补它。
旧安装:
php7.2 ./console |grep hpr
hpr
hpr:orders:export Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.
升级后:
php7.4 ./console |grep hpr
(no output)
在 upgrade guide for 5.7 中,它声明 Symfony 已升级...但没有直接提及与此相关的重大更改。
namespace HPrAutomaticOrderExport\Components;
use Exception;
use Shopware\Commands\ShopwareCommand;
use Shopware\Components\Plugin\ConfigReader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class CLICommand extends ShopwareCommand
{
protected function configure()
{
$this->setName('hpr:orders:export');
$this->setDescription('Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.');
$this->addOption('states', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of order-states ids to filter output');
$this->addOption('statespayment', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of payment-states ids to filter output');
$this->addOption('range', null, InputOption::VALUE_OPTIONAL, 'date range: startdate,enddate'); //TODO syntax for today - n days would be great!!!!!!
$this->addOption('start', null, InputOption::VALUE_OPTIONAL, 'start index in list of orders (defaukt is 0, beginning of the list)');
$this->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'maximal count of orders to export (default is 100)');
$this->addOption('number', null, InputOption::VALUE_OPTIONAL, 'number of a single order');
$this->addOption('exportall', null, InputOption::VALUE_OPTIONAL, 'export all orders, ignore states');
}
插件已启用:
php7.4 console sw:plugin:list|grep Order
| HPrAutomaticOrderExport | Automatic XML Order-Export Standard
| 3.7.1 | Windeit Software GmbH | Yes | Yes |
services.xml 编辑
<service id="hp_order_export_command" class="HPrAutomaticOrderExport\Components\CLICommand">
<tag name="console.command" />
<argument type="service" id="shopware.plugin.config_reader"/>
<argument type="service" id="hp_order_export_service"/>
</service>
更新 我们刚刚禁用了这个插件,因为我们真的不需要它 - 我仍然把它留给更多的读者。
根据 Michael T 的评论:
将标签更改为
后
<tag name="console.command" value="hpr:orders:export"/>
并且缓存刷新命令再次显示在控制台中。
我在升级到 Shopware 5 后也遇到了一些问题。7.x。
我的情况是
"The "hp_order_export_service" service or alias has been removed or
inlined when the container was compiled. You should either make it
public, or stop using the container directly and use dependency
injection instead."
我在 custom/plugins/HPrAutomaticOrderExport/Resources/services.xml <services>
下添加了行 <defaults public="true"/>
很有帮助,也许对其他人也有帮助。
我们将用于测试的 Shopware 5 系统从 5.6.10 升级到 5.7.6
现在控制台命令
hpr:orders:export
丢失。
这是来自不再受官方支持的市场模块 - 问题是是否有一种简单的方法来修补它。
旧安装:
php7.2 ./console |grep hpr
hpr
hpr:orders:export Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.
升级后:
php7.4 ./console |grep hpr
(no output)
在 upgrade guide for 5.7 中,它声明 Symfony 已升级...但没有直接提及与此相关的重大更改。
namespace HPrAutomaticOrderExport\Components;
use Exception;
use Shopware\Commands\ShopwareCommand;
use Shopware\Components\Plugin\ConfigReader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class CLICommand extends ShopwareCommand
{
protected function configure()
{
$this->setName('hpr:orders:export');
$this->setDescription('Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.');
$this->addOption('states', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of order-states ids to filter output');
$this->addOption('statespayment', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of payment-states ids to filter output');
$this->addOption('range', null, InputOption::VALUE_OPTIONAL, 'date range: startdate,enddate'); //TODO syntax for today - n days would be great!!!!!!
$this->addOption('start', null, InputOption::VALUE_OPTIONAL, 'start index in list of orders (defaukt is 0, beginning of the list)');
$this->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'maximal count of orders to export (default is 100)');
$this->addOption('number', null, InputOption::VALUE_OPTIONAL, 'number of a single order');
$this->addOption('exportall', null, InputOption::VALUE_OPTIONAL, 'export all orders, ignore states');
}
插件已启用:
php7.4 console sw:plugin:list|grep Order
| HPrAutomaticOrderExport | Automatic XML Order-Export Standard
| 3.7.1 | Windeit Software GmbH | Yes | Yes |
services.xml 编辑
<service id="hp_order_export_command" class="HPrAutomaticOrderExport\Components\CLICommand">
<tag name="console.command" />
<argument type="service" id="shopware.plugin.config_reader"/>
<argument type="service" id="hp_order_export_service"/>
</service>
更新 我们刚刚禁用了这个插件,因为我们真的不需要它 - 我仍然把它留给更多的读者。
根据 Michael T 的评论:
将标签更改为
后<tag name="console.command" value="hpr:orders:export"/>
并且缓存刷新命令再次显示在控制台中。
我在升级到 Shopware 5 后也遇到了一些问题。7.x。
我的情况是
"The "hp_order_export_service" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead."
我在 custom/plugins/HPrAutomaticOrderExport/Resources/services.xml <services>
下添加了行 <defaults public="true"/>
很有帮助,也许对其他人也有帮助。