Browse Source

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 years ago
parent
commit
74f31426ba
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      Form/Order/OrderProductsType.php

+ 5
- 0
Form/Order/OrderProductsType.php View File

@@ -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…
Cancel
Save