瀏覽代碼

Erreur 500 : Argument 1 passed to Lc\CaracoleBundle\Factory\Order\OrderProductFactory::create() must implement interface Lc\CaracoleBundle\Model\Product\ProductInterface, null given #295

develop
Guillaume Bourgeois 2 年之前
父節點
當前提交
74f31426ba
共有 1 個檔案被更改,包括 5 行新增0 行删除
  1. +5
    -0
      Form/Order/OrderProductsType.php

+ 5
- 0
Form/Order/OrderProductsType.php 查看文件

@@ -4,6 +4,7 @@ namespace Lc\CaracoleBundle\Form\Order;

use App\Repository\Product\ProductFamilyStore;
use Doctrine\ORM\EntityManagerInterface;
use Http\Discovery\Exception\NotFoundException;
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory;
use Lc\CaracoleBundle\Solver\Product\ProductFamilySolver;
use Symfony\Component\Form\AbstractType;
@@ -70,6 +71,10 @@ class OrderProductsType extends AbstractType
}
}

if(is_null($product)) {
throw new NotFoundException('Aucun Product trouvé pour le ProductFamily #'.$productFamily->getId());
}

$orderProduct = $this->orderProductFactory->create($product, 1);

$builder->add('order_product_0', OrderProductType::class, [

Loading…
取消
儲存