1616use Magento \SalesOrdersDataExporter \Console \Command \Link ;
1717use Magento \SalesOrdersDataExporter \Model \Indexer \DateTimeRangeOrderProcessor ;
1818use Symfony \Component \Console \Command \Command ;
19- use Symfony \Component \Console \Exception \ExceptionInterface ;
20- use Symfony \Component \Console \Input \ArrayInput ;
2119use Symfony \Component \Console \Input \InputArgument ;
2220use Symfony \Component \Console \Input \InputInterface ;
2321use Symfony \Component \Console \Output \OutputInterface ;
24- use Throwable ;
2522
2623/**
2724 * Command export orders since certain time in the past
2825 */
29- class Export extends Command
26+ class ExportOnDemmand extends Command
3027{
3128 private const COMMAND_NAME = 'commerce-data-export:orders:export-on-demmand ' ;
3229 private CommerceDataExportLoggerInterface $ logger ;
@@ -35,6 +32,13 @@ class Export extends Command
3532 private DateTimeFactory $ dateTimeFactory ;
3633 private Link $ linkCommand ;
3734
35+ /**
36+ * @param CommerceDataExportLoggerInterface $logger
37+ * @param FeedIndexMetadata $metadata
38+ * @param DateTimeRangeOrderProcessor $processor
39+ * @param DateTimeRangeOrderProcessor dateTimeFactory
40+ * @param Link $link
41+ */
3842 public function __construct (
3943 CommerceDataExportLoggerInterface $ logger ,
4044 FeedIndexMetadata $ metadata ,
@@ -51,6 +55,9 @@ public function __construct(
5155 parent ::__construct ();
5256 }
5357
58+ /**
59+ * @inheritdoc
60+ */
5461 protected function configure ()
5562 {
5663 $ this
@@ -65,14 +72,16 @@ protected function configure()
6572 parent ::configure ();
6673 }
6774
75+ /**
76+ * @inheritdoc
77+ */
6878 protected function execute (InputInterface $ input , OutputInterface $ output ): int
6979 {
7080 $ from = $ this ->dateTimeFactory ->create ($ input ->getArgument ('from ' ));
7181 $ to = $ this ->dateTimeFactory ->create ();
7282
73-
7483 $ returnCode = $ this ->ensureAssignedUuids ($ from , $ to , $ output );
75- if ($ returnCode != 0 ) {
84+ if ($ returnCode != Cli:: RETURN_SUCCESS ) {
7685 return Cli::RETURN_FAILURE ;
7786 }
7887
@@ -83,18 +92,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8392
8493 private function ensureAssignedUuids (DateTime $ from , DateTime $ to , OutputInterface $ output ): int
8594 {
86-
87-
88- try {
89- return $ this ->linkCommand ->
90- prepareForExport (10000 , $ output , $ from ->format (DateTimeInterface::W3C ),
91- $ to ->format (DateTimeInterface::W3C ));
92- } catch (ExceptionInterface $ e ) {
93- $ this ->logger ->error (
94- sprintf ('Command "commerce-data-export:orders:link" failed. Message: %s ' , $ e ->getMessage ())
95+ $ returnCode = $ this ->linkCommand ->
96+ prepareForExport (
97+ 10000 ,
98+ $ output ,
99+ $ from ->format (DateTimeInterface::W3C ),
100+ $ to ->format (DateTimeInterface::W3C )
95101 );
96-
97- return Cli:: RETURN_FAILURE ;
102+ if ( $ returnCode != Cli:: RETURN_SUCCESS ) {
103+ $ this -> logger -> error ( ' Command "commerce-data-export:orders:link" failed. ' ) ;
98104 }
105+ return $ returnCode ;
99106 }
100107}
0 commit comments