]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавляем статусы через отношения
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 13 Oct 2025 06:20:49 +0000 (09:20 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 13 Oct 2025 06:20:49 +0000 (09:20 +0300)
erp24/api2/controllers/OrdersController.php

index 7005221bd513c3663a3d538062ff654519956bbf..66986f7362e493daa99aa6300541b113e9d86607 100644 (file)
@@ -242,12 +242,12 @@ class OrdersController extends BaseController
 
             $orders = MarketplaceOrders::find()
                 ->with('items')
+                ->with('status1C')
                 ->where(['store_id' => $storeId])
                 ->andWhere(['>=', 'creation_date', $startTime->format('Y-m-d H:i:s')])
                 ->andWhere(['<=', 'creation_date', $currentTime->format('Y-m-d H:i:s')])
                 ->orderBy(['id' => SORT_DESC])
                 ->all();
-            $statuses1C = MarketplaceOrder1cStatuses::find()->all();
 
             $result = [];
             foreach ($orders as $order) {
@@ -267,7 +267,7 @@ class OrdersController extends BaseController
 
                 $result[] = [
                     'order_id' => $order->guid,
-                    'status' => $order->status_id,
+                    'status' => $order->status1C ? $order->status1C->status_id : null,
                     'items' => $items,
                 ];
             }