|
|
@@ -18,6 +18,11 @@ class SectionResolver |
|
|
|
protected bool $isCachedSection = false; |
|
|
|
protected ?SectionInterface $section = null; |
|
|
|
|
|
|
|
// cache front |
|
|
|
protected ?SectionInterface $cacheSectionCurrent = null; |
|
|
|
protected ?SectionInterface $cacheSectionVisited = null; |
|
|
|
protected ?SectionInterface $cacheSectionDefault = null; |
|
|
|
|
|
|
|
protected EntityManagerInterface $entityManager; |
|
|
|
protected Security $security; |
|
|
|
protected MerchantResolver $merchantResolver; |
|
|
@@ -64,6 +69,15 @@ class SectionResolver |
|
|
|
} |
|
|
|
} // front |
|
|
|
else { |
|
|
|
|
|
|
|
if ($this->cacheSectionCurrent) { |
|
|
|
return $this->cacheSectionCurrent; |
|
|
|
} elseif ($returnVisitedIfOutOfSection && $this->cacheSectionVisited) { |
|
|
|
return $this->cacheSectionVisited; |
|
|
|
} elseif ($returnDefaultIfOutOfSections && $this->cacheSectionDefault) { |
|
|
|
return $this->cacheSectionDefault; |
|
|
|
} |
|
|
|
|
|
|
|
$userCurrent = $this->security->getUser(); |
|
|
|
$merchantCurrent = $this->merchantResolver->getCurrent(); |
|
|
|
$sectionStore = $this->sectionStore->setMerchant($merchantCurrent); |
|
|
@@ -83,10 +97,13 @@ class SectionResolver |
|
|
|
} |
|
|
|
|
|
|
|
if ($sectionCurrent) { |
|
|
|
$this->cacheSectionCurrent = $sectionCurrent; |
|
|
|
return $sectionCurrent; |
|
|
|
} elseif ($returnVisitedIfOutOfSection && $currentVisitedSection) { |
|
|
|
$this->cacheSectionVisited = $currentVisitedSection; |
|
|
|
return $currentVisitedSection; |
|
|
|
} elseif ($returnDefaultIfOutOfSections && $sectionDefault) { |
|
|
|
$this->cacheSectionDefault = $sectionDefault; |
|
|
|
return $sectionDefault; |
|
|
|
} |
|
|
|
|