src/Exporter.php
private function exportOrder(Order $order, int $foundOrder)
    {
        $logger = $this->getLogger();

        try {
            $eventDispatcher = $this->getEventDispatcher();
            $filesystem = $this->getFilesystem();

            $event = $eventDispatcher->dispatch(
                EventStore::PRE_ORDER_EXPORT,
                new PrepareOrderExportEvent($filesystem, $order)
            );

            $logger->debug(
                'Try to write the order export.',
                [
                    'file' => $file = $this->getOrderNameGenerator()->getOrderName($order),
                    'number' => $foundOrder
                ] + ($exportData = $event->getExportData())
            );

            $written = ($isStopped = $event->isPropagationStopped())
                ? false
                : $filesystem->put($file, $this->getView()->render($this->getFileTemplate(), $exportData));

            if (!$written) {
                $logger->error(
                    'Failed to write order export file.',
                    ['file' => $file, 'number' => $foundOrder, 'isStopped' => $isStopped] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT_FAIL,
                    new FailedOrderExportEvent($filesystem, $order)
                );
            } else {
                $logger->info(
                    'Wrote order export file.',
                    ['file' => $file, 'number' => $foundOrder] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT,
                    new FinishOrderExportEvent($file, $filesystem, $order)
                );
            }
        } catch (SkippableException $exc) {
            $logger->warning(
                'Exception while writing the order export file.',
                ['exception' => $exc, 'order' => $order]
            );

            $eventDispatcher->dispatch(
                EventStore::POST_ORDER_EXPORT_FAIL,
                (new FailedOrderExportEvent($filesystem, $order))->setException($exc)
            );
        }
    }
private function exportOrder(Order $order, int $foundOrder)
    {
        $logger = $this->getLogger();

        try {
            $eventDispatcher = $this->getEventDispatcher();
            $filesystem = $this->getFilesystem();

            $event = $eventDispatcher->dispatch(
                EventStore::PRE_ORDER_EXPORT,
                new PrepareOrderExportEvent($filesystem, $order)
            );

            $logger->debug(
                'Try to write the order export.',
                [
                    'file' => $file = $this->getOrderNameGenerator()->getOrderName($order),
                    'number' => $foundOrder
                ] + ($exportData = $event->getExportData())
            );

            $written = ($isStopped = $event->isPropagationStopped())
                ? false
                : $filesystem->put($file, $this->getView()->render($this->getFileTemplate(), $exportData));

            if (!$written) {
                $logger->error(
                    'Failed to write order export file.',
                    ['file' => $file, 'number' => $foundOrder, 'isStopped' => $isStopped] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT_FAIL,
                    new FailedOrderExportEvent($filesystem, $order)
                );
            } else {
                $logger->info(
                    'Wrote order export file.',
                    ['file' => $file, 'number' => $foundOrder] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT,
                    new FinishOrderExportEvent($file, $filesystem, $order)
                );
            }
        } catch (SkippableException $exc) {
            $logger->warning(
                'Exception while writing the order export file.',
                ['exception' => $exc, 'order' => $order]
            );

            $eventDispatcher->dispatch(
                EventStore::POST_ORDER_EXPORT_FAIL,
                (new FailedOrderExportEvent($filesystem, $order))->setException($exc)
            );
        }
    }
private function exportOrder ( Order $ order , int $ foundOrder ) { $ logger = $ this -> getLogger ( ) ; try { $ eventDispatcher = $ this -> getEventDispatcher ( ) ; $ filesystem = $ this -> getFilesystem ( ) ; $ event = $ eventDispatcher -> dispatch ( EventStore :: PRE_ORDER_EXPORT , new PrepareOrderExportEvent ( $ filesystem , $ order ) ) ; $ logger -> debug ( 'Try to write the order export.' , [ 'file' => $ file = $ this -> getOrderNameGenerator ( ) -> getOrderName ( $ order ) , 'number' => $ foundOrder ] + ( $ exportData = $ event -> getExportData ( ) ) ) ; $ written = ( $ isStopped = $ event -> isPropagationStopped ( ) ) ? false : $ filesystem -> put ( $ file , $ this -> getView ( ) -> render ( $ this -> getFileTemplate ( ) , $ exportData ) ) ; if ( ! $ written ) { $ logger -> error ( 'Failed to write order export file.' , [ 'file' => $ file , 'number' => $ foundOrder , 'isStopped' => $ isStopped ] + $ exportData ) ; $ eventDispatcher -> dispatch ( EventStore :: POST_ORDER_EXPORT_FAIL , new FailedOrderExportEvent ( $ filesystem , $ order ) ) ; } else { $ logger -> info ( 'Wrote order export file.' , [ 'file' => $ file , 'number' => $ foundOrder ] + $ exportData ) ; $ eventDispatcher -> dispatch ( EventStore :: POST_ORDER_EXPORT , new FinishOrderExportEvent ( $ file , $ filesystem , $ order ) ) ; } } catch ( SkippableException $ exc ) { $ logger -> warning ( 'Exception while writing the order export file.' , [ 'exception' => $ exc , 'order' => $ order ] ) ; $ eventDispatcher -> dispatch ( EventStore :: POST_ORDER_EXPORT_FAIL , ( new FailedOrderExportEvent ( $ filesystem , $ order ) ) -> setException ( $ exc ) ) ; } }
Exports the given order.
@param Order $order
@param int $foundOrder
Exports the given order .