From 7239cdaa75742f06b34c2eb59c19fdbe51b68b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Thu, 13 Jun 2019 13:50:41 +0200 Subject: [PATCH] Don't lazy load associations to avoid issues with undefined properties --- .../Classes/Controller/ProductController.php | 18 ++++++++---------- .../Classes/Domain/Model/Concept.php | 1 - .../ep_products/Classes/Domain/Model/Hotel.php | 2 -- .../Classes/Domain/Model/Product.php | 8 -------- .../Private/Partials/Product/HeaderDetail.html | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php index 2a3c5542..31cc1cbd 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php @@ -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([ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Concept.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Concept.php index d63bd835..57cca052 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Concept.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Concept.php @@ -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; diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php index adb10498..33c41e7b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php @@ -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; diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php index e267e341..1cd0843f 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Product.php @@ -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; diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html index 254ef185..9031f4dc 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Product/HeaderDetail.html @@ -1,7 +1,7 @@ {namespace v=FluidTYPO3\Vhs\ViewHelpers} {namespace ep=EP\EpTheme\ViewHelpers}
-
+