From: Vladimir Fomichev Date: Mon, 13 Oct 2025 06:20:49 +0000 (+0300) Subject: Добавляем статусы через отношения X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=fb2f9a26b3ec535814c087c2fce61c9555a77fb2;p=erp24_rep%2Fyii-erp24%2F.git Добавляем статусы через отношения --- diff --git a/erp24/api2/controllers/OrdersController.php b/erp24/api2/controllers/OrdersController.php index 7005221b..66986f73 100644 --- a/erp24/api2/controllers/OrdersController.php +++ b/erp24/api2/controllers/OrdersController.php @@ -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, ]; }