Sylius / InvoicingPlugin

Generate an Invoice for every placed order
MIT License
79 stars 82 forks source link

GenerateInvoicesCommand.php will select orders without order number #147

Open tom10271 opened 5 years ago

tom10271 commented 5 years ago

https://github.com/Sylius/InvoicingPlugin/pull/148

Root cause: vendor/sylius/invoicing-plugin/src/Cli/GenerateInvoicesCommand.php

$orders = $this->orderRepository->findAll();

Fix by:

/** @var array $orders */
$orders = $this->orderRepository
    ->createQueryBuilder('o')
    ->where('o.number IS NOT NULL')
    ->getQuery()
    ->getResult();

Error message:

symfony console sylius-invoicing:generate-invoices -vvv

In InvoiceCreator.php line 35:

  [Symfony\Component\Debug\Exception\FatalThrowableError]                                                                                                                                                                                                
  Argument 1 passed to Sylius\InvoicingPlugin\Creator\InvoiceCreator::__invoke() must be of the type string, null given, called in ~/Sites/hbx-cn/vendor/sylius/invoicing-plugin/src/Creator/MassInvoicesCreator.php on line 32  

Exception trace:
 () at ~/Sites/hbx-cn/vendor/sylius/invoicing-plugin/src/Creator/InvoiceCreator.php:35
 Sylius\InvoicingPlugin\Creator\InvoiceCreator->__invoke() at ~/Sites/hbx-cn/vendor/sylius/invoicing-plugin/src/Creator/MassInvoicesCreator.php:32
 Sylius\InvoicingPlugin\Creator\MassInvoicesCreator->__invoke() at ~/Sites/hbx-cn/vendor/sylius/invoicing-plugin/src/Cli/GenerateInvoicesCommand.php:36
 Sylius\InvoicingPlugin\Cli\GenerateInvoicesCommand->execute() at ~/Sites/hbx-cn/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at ~/Sites/hbx-cn/vendor/symfony/console/Application.php:939
 Symfony\Component\Console\Application->doRunCommand() at ~/Sites/hbx-cn/vendor/symfony/framework-bundle/Console/Application.php:87
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at ~/Sites/hbx-cn/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at ~/Sites/hbx-cn/vendor/symfony/framework-bundle/Console/Application.php:73
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at ~/Sites/hbx-cn/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at ~/Sites/hbx-cn/bin/console:38

sylius-invoicing:generate-invoices [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

exit status 255
tom10271 commented 5 years ago

https://github.com/Sylius/InvoicingPlugin/pull/148