Don't lazy load associations to avoid issues with undefined properties
This commit is contained in:
@@ -86,8 +86,7 @@ class ProductController extends ActionController
|
|||||||
HotelDataService $hotelDataService,
|
HotelDataService $hotelDataService,
|
||||||
DateService $dateService,
|
DateService $dateService,
|
||||||
FilterService $filterService
|
FilterService $filterService
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
$this->productDataService = $productDataService;
|
$this->productDataService = $productDataService;
|
||||||
@@ -106,8 +105,7 @@ class ProductController extends ActionController
|
|||||||
public function detailAction(
|
public function detailAction(
|
||||||
Product $product = null,
|
Product $product = null,
|
||||||
Hotel $hotel = null
|
Hotel $hotel = null
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
// Get product to display from flexform settings if not provided via url
|
// Get product to display from flexform settings if not provided via url
|
||||||
if ($product === null) {
|
if ($product === null) {
|
||||||
$productUid = $this->settings['productUid'];
|
$productUid = $this->settings['productUid'];
|
||||||
@@ -118,7 +116,7 @@ class ProductController extends ActionController
|
|||||||
$this->redirect('search', 'Search', null, null, $this->settings['defaultSearchPageUid']);
|
$this->redirect('search', 'Search', null, null, $this->settings['defaultSearchPageUid']);
|
||||||
}
|
}
|
||||||
// Get hotel to display from flexform settings if not provided via url
|
// Get hotel to display from flexform settings if not provided via url
|
||||||
if ((int) $this->settings['hotelUid'] > 0) {
|
if ((int)$this->settings['hotelUid'] > 0) {
|
||||||
$hotelUid = $this->settings['hotelUid'];
|
$hotelUid = $this->settings['hotelUid'];
|
||||||
$hotel = $this->hotelRepository->findByIdentifier($hotelUid);
|
$hotel = $this->hotelRepository->findByIdentifier($hotelUid);
|
||||||
}
|
}
|
||||||
@@ -136,9 +134,11 @@ class ProductController extends ActionController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
||||||
$isProductWithExcludedConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), $excludedConceptUids, false);
|
$isProductWithExcludedConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(),
|
||||||
|
$excludedConceptUids, false);
|
||||||
$noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']);
|
$noInfoConceptUids = GeneralUtility::trimExplode(',', $this->settings['noInfoConceptUids']);
|
||||||
$isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(), $noInfoConceptUids, false);
|
$isProductWithNoInfoConcept = ($product->getConcept() !== null) && \in_array($product->getConcept()->getUid(),
|
||||||
|
$noInfoConceptUids, false);
|
||||||
$this->view->assignMultiple([
|
$this->view->assignMultiple([
|
||||||
'hotel' => $hotel,
|
'hotel' => $hotel,
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
@@ -166,9 +166,7 @@ class ProductController extends ActionController
|
|||||||
/**
|
/**
|
||||||
* @param Product $product
|
* @param Product $product
|
||||||
*/
|
*/
|
||||||
public function hotelListAction(
|
public function hotelListAction(Product $product)
|
||||||
Product $product
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$hotels = $this->hotelDataService->getList($product);
|
$hotels = $this->hotelDataService->getList($product);
|
||||||
$this->view->assignMultiple([
|
$this->view->assignMultiple([
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ class Concept extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $products;
|
protected $products;
|
||||||
|
|
||||||
|
|||||||
@@ -223,13 +223,11 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $teamer;
|
protected $teamer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $products;
|
protected $products;
|
||||||
|
|
||||||
|
|||||||
@@ -182,49 +182,41 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \EP\EpProducts\Domain\Model\Concept
|
* @var \EP\EpProducts\Domain\Model\Concept
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $concept;
|
protected $concept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \EP\EpProducts\Domain\Model\Country
|
* @var \EP\EpProducts\Domain\Model\Country
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $country;
|
protected $country;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \EP\EpProducts\Domain\Model\Region
|
* @var \EP\EpProducts\Domain\Model\Region
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $region;
|
protected $region;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \EP\EpProducts\Domain\Model\City
|
* @var \EP\EpProducts\Domain\Model\City
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $city;
|
protected $city;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \EP\EpProducts\Domain\Model\Journey
|
* @var \EP\EpProducts\Domain\Model\Journey
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $journey;
|
protected $journey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $facts;
|
protected $facts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Hotel>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Hotel>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $hotels;
|
protected $hotels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Faq>
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Faq>
|
||||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
protected $faqs;
|
protected $faqs;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
|
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
|
||||||
{namespace ep=EP\EpTheme\ViewHelpers}
|
{namespace ep=EP\EpTheme\ViewHelpers}
|
||||||
<div class="container ep-product-detail product-header">
|
<div class="container ep-product-detail product-header">
|
||||||
<div class="ep-product-detail-bg season-{product.region.season -> v:or(alternative: 'w')}"></div>
|
<div class="ep-product-detail-bg season-{product.region.season}"></div>
|
||||||
<div class="col-sm-6 col-sm-offset-1 pull-right">
|
<div class="col-sm-6 col-sm-offset-1 pull-right">
|
||||||
<div class="slider slider--product">
|
<div class="slider slider--product">
|
||||||
<div class="slider__items">
|
<div class="slider__items">
|
||||||
|
|||||||
Reference in New Issue
Block a user