From: fomichev Date: Fri, 17 Apr 2026 13:55:22 +0000 (+0300) Subject: fix(ERP-292): type cast и null guard в AutoMarkService X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=52d6e18d08e678c444fa29098b1a3422b33407bf;p=erp24_rep%2Fyii-erp24%2F.git fix(ERP-292): type cast и null guard в AutoMarkService --- diff --git a/erp24/services/AutoMarkService.php b/erp24/services/AutoMarkService.php index d1f9e502..b524372b 100644 --- a/erp24/services/AutoMarkService.php +++ b/erp24/services/AutoMarkService.php @@ -64,10 +64,13 @@ class AutoMarkService $nomenclature = Products1cNomenclature::findOne($prediction->product_id); if ($nomenclature === null) { - $nomenclature = new Products1cNomenclature(); - $nomenclature->id = $prediction->product_id; $product = Products1c::findOne($prediction->product_id); - $nomenclature->name = $product?->name ?? ''; + if ($product === null) { + return false; + } + $nomenclature = new Products1cNomenclature(); + $nomenclature->id = $prediction->product_id; + $nomenclature->name = $product->name; $nomenclature->location = ''; $nomenclature->type_num = ''; } @@ -96,7 +99,7 @@ class AutoMarkService $count = 0; foreach ($productIds as $id) { - if ($this->predictForProduct($id) !== null) { + if ($this->predictForProduct((string) $id) !== null) { $count++; } }