Completed
Pull Request — experimental/sf (#3269)
by k-yamamura
37:12 queued 29:26
created

OrderController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 9
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
ccs 10
cts 10
cp 1
crap 1

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Controller\Admin\Order;
15
16
use Eccube\Common\Constant;
17
use Eccube\Controller\AbstractController;
18
use Eccube\Entity\Csv;
19
use Eccube\Entity\Master\CsvType;
20
use Eccube\Entity\OrderItem;
21
use Eccube\Entity\Shipping;
22
use Eccube\Event\EccubeEvents;
23
use Eccube\Event\EventArgs;
24
use Eccube\Form\Type\Admin\SearchOrderType;
25
use Eccube\Repository\CustomerRepository;
26
use Eccube\Repository\Master\OrderStatusRepository;
27
use Eccube\Repository\Master\PageMaxRepository;
28
use Eccube\Repository\Master\ProductStatusRepository;
29
use Eccube\Repository\Master\SexRepository;
30
use Eccube\Repository\OrderRepository;
31
use Eccube\Repository\PaymentRepository;
32
use Eccube\Service\CsvExportService;
33
use Eccube\Util\FormUtil;
34
use Knp\Component\Pager\PaginatorInterface;
35
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
36
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
37
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
38
use Symfony\Component\HttpFoundation\Request;
39
use Symfony\Component\HttpFoundation\StreamedResponse;
40
use Eccube\Entity\Master\OrderStatus;
41
use Symfony\Component\HttpFoundation\RedirectResponse;
42
use Eccube\Entity\Order;
43
use Eccube\Service\PurchaseFlow\PurchaseContext;
44
use Eccube\Service\PurchaseFlow\PurchaseFlow;
45
use Eccube\Service\PurchaseFlow\PurchaseException;
46
47
class OrderController extends AbstractController
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
48
{
49
    /**
50
     * @var PurchaseFlow
51
     */
52
    protected $purchaseFlow;
53
54
    /**
55
     * @var CsvExportService
56
     */
57
    protected $csvExportService;
58
59
    /**
60
     * @var CustomerRepository
61
     */
62
    protected $customerRepository;
63
64
    /**
65
     * @var PaymentRepository
66
     */
67
    protected $paymentRepository;
68
69
    /**
70
     * @var SexRepository
71
     */
72
    protected $sexRepository;
73
74
    /**
75
     * @var OrderStatusRepository
76
     */
77
    protected $orderStatusRepository;
78
79
    /**
80
     * @var PageMaxRepository
81
     */
82
    protected $pageMaxRepository;
83
84
    /**
85
     * @var ProductStatusRepository
86
     */
87
    protected $productStatusRepository;
88
89
    /**
90
     * @var OrderRepository
91
     */
92
    protected $orderRepository;
93
94
    /**
95
     * OrderController constructor.
96
     *
97
     * @param PurchaseFlow $orderPurchaseFlow
0 ignored issues
show
introduced by
Expected 12 spaces after parameter type; 1 found
Loading history...
98
     * @param CsvExportService $csvExportService
0 ignored issues
show
introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
99
     * @param CustomerRepository $customerRepository
0 ignored issues
show
introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
100
     * @param PaymentRepository $paymentRepository
0 ignored issues
show
introduced by
Expected 7 spaces after parameter type; 1 found
Loading history...
101
     * @param SexRepository $sexRepository
0 ignored issues
show
introduced by
Expected 11 spaces after parameter type; 1 found
Loading history...
102
     * @param OrderStatusRepository $orderStatusRepository
0 ignored issues
show
introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
103
     * @param PageMaxRepository $pageMaxRepository
0 ignored issues
show
introduced by
Expected 7 spaces after parameter type; 1 found
Loading history...
104
     * @param ProductStatusRepository $productStatusRepository
105
     * @param OrderRepository $orderRepository
0 ignored issues
show
introduced by
Expected 9 spaces after parameter type; 1 found
Loading history...
106
     */
107 13
    public function __construct(
108
        PurchaseFlow $orderPurchaseFlow,
109
        CsvExportService $csvExportService,
110
        CustomerRepository $customerRepository,
111
        PaymentRepository $paymentRepository,
112
        SexRepository $sexRepository,
113
        OrderStatusRepository $orderStatusRepository,
114
        PageMaxRepository $pageMaxRepository,
115
        ProductStatusRepository $productStatusRepository,
116
        OrderRepository $orderRepository
117
    ) {
118 13
        $this->purchaseFlow = $orderPurchaseFlow;
119 13
        $this->csvExportService = $csvExportService;
120 13
        $this->customerRepository = $customerRepository;
121 13
        $this->paymentRepository = $paymentRepository;
122 13
        $this->sexRepository = $sexRepository;
123 13
        $this->orderStatusRepository = $orderStatusRepository;
124 13
        $this->pageMaxRepository = $pageMaxRepository;
125 13
        $this->productStatusRepository = $productStatusRepository;
126 13
        $this->orderRepository = $orderRepository;
127
    }
128
129
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$request" missing
Loading history...
introduced by
Doc comment for parameter "$page_no" missing
Loading history...
introduced by
Doc comment for parameter "$paginator" missing
Loading history...
130
     * 受注一覧画面.
131
     *
132
     * - 検索条件, ページ番号, 表示件数はセッションに保持されます.
133
     * - クエリパラメータでresume=1が指定された場合、検索条件, ページ番号, 表示件数をセッションから復旧します.
134
     * - 各データの, セッションに保持するアクションは以下の通りです.
135
     *   - 検索ボタン押下時
136
     *      - 検索条件をセッションに保存します
137
     *      - ページ番号は1で初期化し、セッションに保存します。
138
     *   - 表示件数変更時
139
     *      - クエリパラメータpage_countをセッションに保存します。
140
     *      - ただし, mtb_page_maxと一致しない場合, eccube_default_page_countが保存されます.
141
     *   - ページング時
142
     *      - URLパラメータpage_noをセッションに保存します.
143
     *   - 初期表示
144
     *      - 検索条件は空配列, ページ番号は1で初期化し, セッションに保存します.
145
     *
146
     * @Route("/%eccube_admin_route%/order", name="admin_order")
147
     * @Route("/%eccube_admin_route%/order/page/{page_no}", requirements={"page_no" = "\d+"}, name="admin_order_page")
148
     * @Template("@admin/Order/index.twig")
149
     */
0 ignored issues
show
introduced by
Missing @return tag in function comment
Loading history...
150 9
    public function index(Request $request, $page_no = null, PaginatorInterface $paginator)
0 ignored issues
show
Coding Style introduced by
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
151
    {
152 9
        $builder = $this->formFactory
153 9
            ->createBuilder(SearchOrderType::class);
154
155 9
        $event = new EventArgs(
156
            [
157 9
                'builder' => $builder,
158
            ],
159 9
            $request
160
        );
161 9
        $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_ORDER_INDEX_INITIALIZE, $event);
162
163 9
        $searchForm = $builder->getForm();
164
165
        /**
166
         * ページの表示件数は, 以下の順に優先される.
167
         * - リクエストパラメータ
168
         * - セッション
169
         * - デフォルト値
170
         * また, セッションに保存する際は mtb_page_maxと照合し, 一致した場合のみ保存する.
171
         **/
172 9
        $page_count = $this->session->get('eccube.admin.order.search.page_count',
173 9
                $this->eccubeConfig->get('eccube_default_page_count'));
174
175 9
        $page_count_param = (int) $request->get('page_count');
176 9
        $pageMaxis = $this->pageMaxRepository->findAll();
177
178 9
        if ($page_count_param) {
179 1
            foreach ($pageMaxis as $pageMax) {
180 1
                if ($page_count_param == $pageMax->getName()) {
181
                    $page_count = $pageMax->getName();
182
                    $this->session->set('eccube.admin.order.search.page_count', $page_count);
183 1
                    break;
184
                }
185
            }
186
        }
187
188 9
        if ('POST' === $request->getMethod()) {
189 7
            $searchForm->handleRequest($request);
190
191 7
            if ($searchForm->isValid()) {
192
                /**
193
                 * 検索が実行された場合は, セッションに検索条件を保存する.
194
                 * ページ番号は最初のページ番号に初期化する.
195
                 */
196 7
                $page_no = 1;
197 7
                $searchData = $searchForm->getData();
198
199
                // 検索条件, ページ番号をセッションに保持.
200 7
                $this->session->set('eccube.admin.order.search', FormUtil::getViewData($searchForm));
201 7
                $this->session->set('eccube.admin.order.search.page_no', $page_no);
202
            } else {
203
                // 検索エラーの際は, 詳細検索枠を開いてエラー表示する.
204
                return [
205 7
                    'searchForm' => $searchForm->createView(),
206
                    'pagination' => [],
207
                    'pageMaxis' => $pageMaxis,
208
                    'page_no' => $page_no,
209
                    'page_count' => $page_count,
210
                    'has_errors' => true,
211
                ];
212
            }
213
        } else {
214 3
            if (null !== $page_no || $request->get('resume')) {
215
                /*
216
                 * ページ送りの場合または、他画面から戻ってきた場合は, セッションから検索条件を復旧する.
217
                 */
218 1
                if ($page_no) {
219
                    // ページ送りで遷移した場合.
220 1
                    $this->session->set('eccube.admin.order.search.page_no', (int) $page_no);
221
                } else {
222
                    // 他画面から遷移した場合.
223
                    $page_no = $this->session->get('eccube.admin.order.search.page_no', 1);
224
                }
225 1
                $viewData = $this->session->get('eccube.admin.order.search', []);
226 1
                $searchData = FormUtil::submitAndGetData($searchForm, $viewData);
227
            } else {
228
                /**
229
                 * 初期表示の場合.
230
                 */
231 2
                $page_no = 1;
232 2
                $searchData = [];
233
234
                // セッション中の検索条件, ページ番号を初期化.
235 2
                $this->session->set('eccube.admin.order.search', $searchData);
236 2
                $this->session->set('eccube.admin.order.search.page_no', $page_no);
237
            }
238
        }
239
240 9
        $qb = $this->orderRepository->getQueryBuilderBySearchDataForAdmin($searchData);
241
242 9
        $event = new EventArgs(
243
            [
244 9
                'qb' => $qb,
245 9
                'searchData' => $searchData,
246
            ],
247 9
            $request
248
        );
249
250 9
        $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_ORDER_INDEX_SEARCH, $event);
251
252 9
        $pagination = $paginator->paginate(
253 9
            $qb,
254 9
            $page_no,
255 9
            $page_count
256
        );
257
258
        return [
259 9
            'searchForm' => $searchForm->createView(),
260 9
            'pagination' => $pagination,
261 9
            'pageMaxis' => $pageMaxis,
262 9
            'page_no' => $page_no,
263 9
            'page_count' => $page_count,
264
            'has_errors' => false,
265 9
            'OrderStatuses' => $this->orderStatusRepository->findBy([], ['sort_no' => 'ASC']),
266
        ];
267
    }
268
269
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$request" missing
Loading history...
270
     * @Method("POST")
271
     * @Route("/%eccube_admin_route%/order/bulk_delete", name="admin_order_bulk_delete")
272
     */
0 ignored issues
show
introduced by
Missing @return tag in function comment
Loading history...
273 1
    public function bulkDelete(Request $request)
274
    {
275 1
        $this->isTokenValid();
276 1
        $ids = $request->get('ids');
277 1
        foreach ($ids as $order_id) {
278 1
            $Order = $this->orderRepository
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $Order is correct as $this->orderRepository->find($order_id) (which targets Doctrine\ORM\EntityRepository::find()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
279 1
                ->find($order_id);
280 1
            if ($Order) {
281 1
                $this->entityManager->remove($Order);
282 1
                log_info('受注削除', [$Order->getId()]);
283
            }
284
        }
285
286 1
        $this->entityManager->flush();
287
288 1
        $this->addSuccess('admin.order.delete.complete', 'admin');
289
290 1
        return $this->redirect($this->generateUrl('admin_order', ['resume' => Constant::ENABLED]));
291
    }
292
293
    /**
294
     * 受注CSVの出力.
295
     *
296
     * @Route("/%eccube_admin_route%/order/export/order", name="admin_order_export_order")
297
     *
298
     * @param Request $request
299
     *
300
     * @return StreamedResponse
301
     */
302 1
    public function exportOrder(Request $request)
303
    {
304
        // タイムアウトを無効にする.
305 1
        set_time_limit(0);
306
307
        // sql loggerを無効にする.
308 1
        $em = $this->entityManager;
309 1
        $em->getConfiguration()->setSQLLogger(null);
310
311 1
        $response = new StreamedResponse();
312 1
        $response->setCallback(function () use ($request) {
313
            // CSV種別を元に初期化.
314 1
            $this->csvExportService->initCsvType(CsvType::CSV_TYPE_ORDER);
315
316
            // ヘッダ行の出力.
317 1
            $this->csvExportService->exportHeader();
318
319
            // 受注データ検索用のクエリビルダを取得.
320 1
            $qb = $this->csvExportService
321 1
                ->getOrderQueryBuilder($request);
322
323
            // データ行の出力.
324 1
            $this->csvExportService->setExportQueryBuilder($qb);
325 1 View Code Duplication
            $this->csvExportService->exportData(function ($entity, $csvService) use ($request) {
326 1
                $Csvs = $csvService->getCsvs();
327
328 1
                $Order = $entity;
329 1
                $OrderItems = $Order->getOrderItems();
330
331 1
                foreach ($OrderItems as $OrderItem) {
332 1
                    $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
333
334
                    // CSV出力項目と合致するデータを取得.
335 1
                    foreach ($Csvs as $Csv) {
336
                        // 受注データを検索.
337 1
                        $ExportCsvRow->setData($csvService->getData($Csv, $Order));
338 1
                        if ($ExportCsvRow->isDataNull()) {
339
                            // 受注データにない場合は, 受注明細を検索.
340 1
                            $ExportCsvRow->setData($csvService->getData($Csv, $OrderItem));
341
                        }
342
343 1
                        $event = new EventArgs(
344
                            [
345 1
                                'csvService' => $csvService,
346 1
                                'Csv' => $Csv,
347 1
                                'OrderItem' => $OrderItem,
348 1
                                'ExportCsvRow' => $ExportCsvRow,
349
                            ],
350 1
                            $request
351
                        );
352 1
                        $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_ORDER_CSV_EXPORT_ORDER, $event);
353
354 1
                        $ExportCsvRow->pushData();
355
                    }
356
357
                    //$row[] = number_format(memory_get_usage(true));
358
                    // 出力.
359 1
                    $csvService->fputcsv($ExportCsvRow->getRow());
360
                }
361 1
            });
362 1
        });
363
364 1
        $now = new \DateTime();
365 1
        $filename = 'order_'.$now->format('YmdHis').'.csv';
366 1
        $response->headers->set('Content-Type', 'application/octet-stream');
367 1
        $response->headers->set('Content-Disposition', 'attachment; filename='.$filename);
368 1
        $response->send();
369
370 1
        log_info('受注CSV出力ファイル名', [$filename]);
371
372 1
        return $response;
373
    }
374
375
    /**
376
     * 配送CSVの出力.
377
     *
378
     * @Route("/%eccube_admin_route%/order/export/shipping", name="admin_order_export_shipping")
379
     *
380
     * @param Request $request
381
     *
382
     * @return StreamedResponse
383
     */
384 1
    public function exportShipping(Request $request)
385
    {
386
        // タイムアウトを無効にする.
387 1
        set_time_limit(0);
388
389
        // sql loggerを無効にする.
390 1
        $em = $this->entityManager;
391 1
        $em->getConfiguration()->setSQLLogger(null);
392
393 1
        $response = new StreamedResponse();
394 1
        $response->setCallback(function () use ($request) {
395
            // CSV種別を元に初期化.
396 1
            $this->csvExportService->initCsvType(CsvType::CSV_TYPE_SHIPPING);
397
398
            // ヘッダ行の出力.
399 1
            $this->csvExportService->exportHeader();
400
401
            // 受注データ検索用のクエリビルダを取得.
402 1
            $qb = $this->csvExportService
403 1
                ->getShippingQueryBuilder($request);
404
405
            // データ行の出力.
406 1
            $this->csvExportService->setExportQueryBuilder($qb);
407 1
            $this->csvExportService->exportData(function ($entity, $csvService) use ($request) {
408
                /** @var Csv[] $Csvs */
409 1
                $Csvs = $csvService->getCsvs();
410
411
                /** @var Shipping $Shipping */
412 1
                $Shipping = $entity;
413
                /** @var OrderItem[] $OrderItems */
414 1
                $OrderItems = $Shipping->getOrderItems();
415
416 1
                foreach ($OrderItems as $OrderItem) {
417 1
                    $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
418
419 1
                    $Order = $OrderItem->getOrder();
420
                    // CSV出力項目と合致するデータを取得.
421 1
                    foreach ($Csvs as $Csv) {
422
                        // 受注データを検索.
423 1
                        $ExportCsvRow->setData($csvService->getData($Csv, $Order));
424
425 1
                        if ($ExportCsvRow->isDataNull()) {
426
                            // 受注データにない場合は, 出荷データを検索.
427 1
                            $ExportCsvRow->setData($csvService->getData($Csv, $Shipping));
428
                        }
429 1
                        if ($ExportCsvRow->isDataNull()) {
430
                            // 出荷データにない場合は, 出荷明細を検索.
431 1
                            $ExportCsvRow->setData($csvService->getData($Csv, $OrderItem));
432
                        }
433
434 1
                        $event = new EventArgs(
435
                            [
436 1
                                'csvService' => $csvService,
437 1
                                'Csv' => $Csv,
438 1
                                'OrderItem' => $OrderItem,
439 1
                                'ExportCsvRow' => $ExportCsvRow,
440
                            ],
441 1
                            $request
442
                        );
443 1
                        $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_ORDER_CSV_EXPORT_SHIPPING, $event);
444
445 1
                        $ExportCsvRow->pushData();
446
                    }
447
                    //$row[] = number_format(memory_get_usage(true));
448
                    // 出力.
449 1
                    $csvService->fputcsv($ExportCsvRow->getRow());
450
                }
451 1
            });
452 1
        });
453
454 1
        $now = new \DateTime();
455 1
        $filename = 'shipping_'.$now->format('YmdHis').'.csv';
456 1
        $response->headers->set('Content-Type', 'application/octet-stream');
457 1
        $response->headers->set('Content-Disposition', 'attachment; filename='.$filename);
458 1
        $response->send();
459
460 1
        log_info('出荷CSV出力ファイル名', [$filename]);
461
462 1
        return $response;
463
    }
464
465
    /**
466
     * Bulk action to order status
467
     *
468
     * @Method("POST")
469
     * @Route("/%eccube_admin_route%/order/bulk/order-status/{id}", requirements={"id" = "\d+"}, name="admin_order_bulk_order_status")
470
     *
471
     * @param Request $request
0 ignored issues
show
introduced by
Expected 5 spaces after parameter type; 1 found
Loading history...
472
     * @param OrderStatus $OrderStatus
473
     *
474
     * @return RedirectResponse
475
     */
476 2
    public function bulkOrderStatus(Request $request, OrderStatus $OrderStatus)
477
    {
478 2
        $this->isTokenValid();
479
480
        /** @var Order[] $Orders */
481 2
        $Orders = $this->orderRepository->findBy(['id' => $request->get('ids')]);
482
483 2
        $count = 0;
484 2
        foreach ($Orders as $Order) {
485
            try {
486
                // TODO: should support event for plugin customize
487
                // 編集前の受注情報を保持
488 2
                $OriginOrder = clone $Order;
489
490 2
                $Order->setOrderStatus($OrderStatus);
491
492 2
                $purchaseContext = new PurchaseContext($OriginOrder, $OriginOrder->getCustomer());
493
494 2
                $flowResult = $this->purchaseFlow->validate($Order, $purchaseContext);
495 2
                if ($flowResult->hasWarning()) {
496
                    foreach ($flowResult->getWarning() as $warning) {
497
                        $msg = $this->translator->trans('admin.order.index.bulk_warning', [
498
                          '%orderId%' => $Order->getId(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 28 spaces, but found 26.
Loading history...
499
                          '%message%' => $warning->getMessage(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 28 spaces, but found 26.
Loading history...
500
                        ]);
501
                        $this->addWarning($msg, 'admin');
502
                    }
503
                }
504
505 2
                if ($flowResult->hasError()) {
506
                    foreach ($flowResult->getErrors() as $error) {
507
                        $msg = $this->translator->trans('admin.order.index.bulk_error', [
508
                          '%orderId%' => $Order->getId(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 28 spaces, but found 26.
Loading history...
509
                          '%message%' => $error->getMessage(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 28 spaces, but found 26.
Loading history...
510
                        ]);
511
                        $this->addError($msg, 'admin');
512
                    }
513
                    continue;
514
                }
515
516
                try {
517 2
                    $this->purchaseFlow->commit($Order, $purchaseContext);
518
                } catch (PurchaseException $e) {
519
                    $msg = $this->translator->trans('admin.order.index.bulk_error', [
520
                      '%orderId%' => $Order->getId(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 24 spaces, but found 22.
Loading history...
521
                      '%message%' => $e->getMessage(),
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 24 spaces, but found 22.
Loading history...
522
                    ]);
523
                    $this->addError($msg, 'admin');
524
                    continue;
525
                }
526
527 2
                $this->orderRepository->save($Order);
528
529 2
                $count++;
530
            } catch (\Exception $e) {
531 2
                $this->addError('#'.$Order->getId().': '.$e->getMessage(), 'admin');
532
            }
533
        }
534
        try {
535 2 View Code Duplication
            if ($count) {
536 2
                $this->entityManager->flush();
537 2
                $msg = $this->translator->trans('admin.order.index.bulk_order_status_success_count', [
538 2
                    '%count%' => $count,
539 2
                    '%status%' => $OrderStatus->getName(),
540
                ]);
541 2
                $this->addSuccess($msg, 'admin');
542
            }
543
        } catch (\Exception $e) {
544
            log_error('Bulk order status error', [$e]);
545
            $this->addError('admin.flash.register_failed', 'admin');
546
        }
547
548 2
        return $this->redirectToRoute('admin_order', ['resume' => Constant::ENABLED]);
549
    }
550
}
551