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,
|
||||
DateService $dateService,
|
||||
FilterService $filterService
|
||||
)
|
||||
{
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->productRepository = $productRepository;
|
||||
$this->productDataService = $productDataService;
|
||||
@@ -106,8 +105,7 @@ class ProductController extends ActionController
|
||||
public function detailAction(
|
||||
Product $product = null,
|
||||
Hotel $hotel = null
|
||||
)
|
||||
{
|
||||
) {
|
||||
// Get product to display from flexform settings if not provided via url
|
||||
if ($product === null) {
|
||||
$productUid = $this->settings['productUid'];
|
||||
@@ -118,7 +116,7 @@ class ProductController extends ActionController
|
||||
$this->redirect('search', 'Search', null, null, $this->settings['defaultSearchPageUid']);
|
||||
}
|
||||
// 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'];
|
||||
$hotel = $this->hotelRepository->findByIdentifier($hotelUid);
|
||||
}
|
||||
@@ -136,9 +134,11 @@ class ProductController extends ActionController
|
||||
}
|
||||
}
|
||||
$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']);
|
||||
$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([
|
||||
'hotel' => $hotel,
|
||||
'product' => $product,
|
||||
@@ -166,9 +166,7 @@ class ProductController extends ActionController
|
||||
/**
|
||||
* @param Product $product
|
||||
*/
|
||||
public function hotelListAction(
|
||||
Product $product
|
||||
)
|
||||
public function hotelListAction(Product $product)
|
||||
{
|
||||
$hotels = $this->hotelDataService->getList($product);
|
||||
$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>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
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>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $teamer;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $products;
|
||||
|
||||
|
||||
@@ -182,49 +182,41 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
|
||||
|
||||
/**
|
||||
* @var \EP\EpProducts\Domain\Model\Concept
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $concept;
|
||||
|
||||
/**
|
||||
* @var \EP\EpProducts\Domain\Model\Country
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $country;
|
||||
|
||||
/**
|
||||
* @var \EP\EpProducts\Domain\Model\Region
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $region;
|
||||
|
||||
/**
|
||||
* @var \EP\EpProducts\Domain\Model\City
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $city;
|
||||
|
||||
/**
|
||||
* @var \EP\EpProducts\Domain\Model\Journey
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $journey;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $facts;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Hotel>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $hotels;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Faq>
|
||||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
|
||||
*/
|
||||
protected $faqs;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
|
||||
{namespace ep=EP\EpTheme\ViewHelpers}
|
||||
<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="slider slider--product">
|
||||
<div class="slider__items">
|
||||
|
||||
Reference in New Issue
Block a user