Kaynağa Gözat

Erreur 500 : Typed property Lc\CaracoleBundle\Controller\Order\CartController::$productFamily must not be accessed before initialization

Erreur 500 : An exception has been thrown during the rendering of a template ("Aucun espace n'a été trouvé").
develop
Guillaume 2 yıl önce
ebeveyn
işleme
12ea0f990e
2 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. +1
    -1
      Controller/Order/CartController.php
  2. +4
    -3
      Resolver/SectionResolver.php

+ 1
- 1
Controller/Order/CartController.php Dosyayı Görüntüle

@@ -17,7 +17,7 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class CartController extends AbstractController
{
protected ProductFamilyInterface $productFamily;
protected ?ProductFamilyInterface $productFamily = null;
protected int $quantityOrder = 1;
protected array $orderProducts = [];


+ 4
- 3
Resolver/SectionResolver.php Dosyayı Görüntüle

@@ -47,7 +47,7 @@ class SectionResolver
$this->urlResolver = $urlResolver;
}

public function getCurrent($returnDefaultIfOutOfSections = false, $returnVisitedIfOutOfSection = false)
public function getCurrent($returnDefaultIfOutOfSections = false, $returnVisitedIfOutOfSection = false, $throwExceptionIfSectionNotFound = true)
{
$requestAttributesArray = $this->requestStack->getMainRequest()->attributes->all();

@@ -95,7 +95,8 @@ class SectionResolver
$sectionCurrent = $sectionStore
->setMerchant($merchantCurrent)
->getOneBySlug($requestAttributesArray['section']);
if($sectionCurrent===null){

if($sectionCurrent === null && $throwExceptionIfSectionNotFound){
throw new NotFoundHttpException('Aucun espace n\'a été trouvé');
}
}
@@ -117,7 +118,7 @@ class SectionResolver

public function isOutOfSection(): bool
{
return $this->getCurrent() == null;
return $this->getCurrent(false, false, false) == null;
}

public function getDefault(): SectionInterface

Yükleniyor…
İptal
Kaydet