symfonyshopware5

After upgrade from Shopware 5.6.10->5.7.6, custom console commands are missing


We upgraded a Shopware 5 system for testing from 5.6.10 to 5.7.6

Now the console command

hpr:orders:export  

is missing.

This is from a marketplace module which is no longer officially supported - the question is if there is an easy way to patch it.

Old installation:

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.

After Upgrade:

 php7.4 ./console |grep hpr
 (no output)

In the upgrade guide for 5.7, it states that Symfony was upgraded ... but no breaking changes concerning this are mentioned directly.

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');
    }

The plugin is enabled:

 php7.4 console sw:plugin:list|grep Order
 | HPrAutomaticOrderExport             | Automatic XML Order-Export Standard                                        
 | 3.7.1   | Windeit Software GmbH    | Yes    | Yes       |

services.xml EDIT

    <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>

UPDATE We just disabled the plugin, because we don't really need it - I still leave this open for further readers.


Solution

  • Based on Michael T's comment:

    After changing the tag to

    <tag name="console.command" value="hpr:orders:export"/>
    

    and cache flush the command is dispalyed in the console again.