diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php
index 5a3a6985..10eaecf9 100644
--- a/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php
+++ b/public/typo3conf/ext/ep_products/Classes/Service/ContingentDataService.php
@@ -32,30 +32,20 @@ use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\ContingentRepository;
use EP\EpProducts\Utility\BookingUrlUtility;
use League\Period\Period;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
class ContingentDataService
{
- public const CACHE_TTL = 60 * 60;
-
/**
* @var ContingentRepository
*/
protected $contingentRepository;
- /**
- * @var FrontendInterface
- */
- private $cache;
-
/**
* @param ContingentRepository $contingentRepository
- * @param FrontendInterface $cache
*/
- public function __construct(ContingentRepository $contingentRepository, FrontendInterface $cache)
+ public function __construct(ContingentRepository $contingentRepository)
{
$this->contingentRepository = $contingentRepository;
- $this->cache = $cache;
}
/**
@@ -66,21 +56,15 @@ class ContingentDataService
*/
public function getAvailableContingents(Hotel $hotel, Product $product)
{
- $key = 'contingents_'.sha1($hotel->getUid().$product->getUid());
-
- if (false === $contingents = $this->cache->get($key)) {
- $data = $this->contingentRepository->getAvailableContingents($hotel, $product);
- $contingents = [];
- foreach ($data as $row) {
- $contingents[$row['date']] = [
- 'date' => $row['date'],
- 'minNights' => $row['minNights'],
- 'total' => $row['total'],
- 'capacity' => $row['capacity'],
- ];
- }
-
- $this->cache->set($key, $contingents, [], self::CACHE_TTL);
+ $data = $this->contingentRepository->getAvailableContingents($hotel, $product);
+ $contingents = [];
+ foreach ($data as $row) {
+ $contingents[$row['date']] = [
+ 'date' => $row['date'],
+ 'minNights' => $row['minNights'],
+ 'total' => $row['total'],
+ 'capacity' => $row['capacity'],
+ ];
}
return $contingents;
@@ -100,34 +84,28 @@ class ContingentDataService
string $dateTo,
Hotel $hotel,
Product $product,
- $template = 'base'
+ string $template = 'base'
) {
- $key = 'rooms_'.sha1($dateFrom.$dateTo.$hotel->getUid().$product->getUid());
+ $data = $this->contingentRepository->getAvailableRooms($dateFrom, $dateTo, $hotel, $product);
+ $period = new Period($dateFrom, $dateTo);
+ $nights = $period->dateInterval()->format('%a');
+ $rooms = [];
+ foreach ($data as $row) {
+ $row['bookingUrl'] = BookingUrlUtility::generateUrl([
+ 'bookingId' => $row['busProId'],
+ 'hotelId' => $row['hotelBusProId'],
+ 'dateEnd' => $dateTo,
+ 'template' => $template,
+ ]);
- if (false === $rooms = $this->cache->get($key)) {
- $data = $this->contingentRepository->getAvailableRooms($dateFrom, $dateTo, $hotel, $product);
- $period = new Period($dateFrom, $dateTo);
- $nights = $period->dateInterval()->format('%a');
- $rooms = [];
- foreach ($data as $row) {
- $row['bookingUrl'] = BookingUrlUtility::generateUrl([
- 'bookingId' => $row['busProId'],
- 'hotelId' => $row['hotelBusProId'],
- 'dateEnd' => $dateTo,
- 'template' => $template,
- ]);
+ $row['summer'] = $row['season'] === 's';
- $row['summer'] = $row['season'] === 's';
+ $row['servicesIncluded'] = unserialize($row['servicesIncluded'], ['allowed_classes' => false]);
+ $row['servicesOptional'] = unserialize($row['servicesOptional'], ['allowed_classes' => false]);
- $row['servicesIncluded'] = unserialize($row['servicesIncluded'], ['allowed_classes' => false]);
- $row['servicesOptional'] = unserialize($row['servicesOptional'], ['allowed_classes' => false]);
+ $row['priceForSelection'] = $row['price'] + ($nights - $row['minNights']) * $row['additionalNightPrice'];
- $row['priceForSelection'] = $row['price'] + ($nights - $row['minNights']) * $row['additionalNightPrice'];
-
- $rooms[] = $row;
- }
-
- $this->cache->set($key, $rooms, [], self::CACHE_TTL);
+ $rooms[] = $row;
}
return $rooms;
diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php
index 311f707d..69c28b3d 100644
--- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php
+++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php
@@ -33,15 +33,12 @@ use EP\EpProducts\Domain\Repository\DateRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Utility\BookingUrlUtility;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
class DateService implements SingletonInterface
{
- public const CACHE_TTL = 60 * 60;
-
/**
* @var ProductRepository
*/
@@ -62,11 +59,6 @@ class DateService implements SingletonInterface
*/
protected $uriBuilder;
- /**
- * @var FrontendInterface
- */
- protected $cache;
-
/**
* @var string[]
*/
@@ -84,22 +76,19 @@ class DateService implements SingletonInterface
* @param DateRepository $dateRepository
* @param FilterService $filterService
* @param UriBuilder $uriBuilder
- * @param FrontendInterface $cache
*/
public function __construct
(
ProductRepository $productRepository,
DateRepository $dateRepository,
FilterService $filterService,
- UriBuilder $uriBuilder,
- FrontendInterface $cache
+ UriBuilder $uriBuilder
)
{
$this->productRepository = $productRepository;
$this->filterService = $filterService;
$this->dateRepository = $dateRepository;
$this->uriBuilder = $uriBuilder;
- $this->cache = $cache;
}
/**
@@ -125,19 +114,10 @@ class DateService implements SingletonInterface
$filterSettings = $this->filterService->getNormalizedFilterSettings();
}
- $keyValues = $product->getUid().$hotel->getUid().serialize($filterSettings);
- $keyValues.= $date ? $date->getUid() : 0;
- $key = 'pricetable_'.sha1($keyValues);
-
- if (false === $priceTableData = $this->cache->get($key)) {
- $priceTableData = $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date);
- $this->cache->set($key, $priceTableData, ['ep_products'], self::CACHE_TTL);
- }
-
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
return $this->preprocessPriceTable([
- 'priceTableData' => $priceTableData,
+ 'priceTableData' => $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date),
'template' => $template,
'paCode' => $paCode,
'isDayTrip' => $product->isDaytrip(),
@@ -174,13 +154,7 @@ class DateService implements SingletonInterface
$filterSettings = $this->filterService->getNormalizedFilterSettings();
}
- $key = 'datestable_'.sha1($product->getUid().$hotel->getUid().serialize($filterSettings));
- if (false === $datesTableData = $this->cache->get($key)) {
- $datesTableData = $this->productRepository->getAvailableDates($product, $hotel, $filterSettings);
- $this->cache->set($key, $datesTableData, ['ep_products'], self::CACHE_TTL);
- }
-
- return $datesTableData;
+ return $this->productRepository->getAvailableDates($product, $hotel, $filterSettings);
}
/**
@@ -196,14 +170,8 @@ class DateService implements SingletonInterface
public function getEventPriceTable(Product $product, int $maxPax = 99, string $template = 'base'): array
{
- $key = 'pricetable_'.sha1($product->getUid());
- if (false === $priceTableData = $this->cache->get($key)) {
- $priceTableData = $this->productRepository->getEventPriceTable($product);
- $this->cache->set($key, $priceTableData, ['ep_products'], self::CACHE_TTL);
- }
-
return $this->preprocessEventPriceTable([
- 'priceTableData' => $priceTableData,
+ 'priceTableData' => $this->productRepository->getEventPriceTable($product),
'maxPax' => $maxPax,
'template' => $template,
]);
diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php b/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php
index 01b1edf9..d71e9d9a 100644
--- a/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php
+++ b/public/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php
@@ -29,13 +29,10 @@ namespace EP\EpProducts\Service;
use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\SingletonInterface;
class ProductDataService implements SingletonInterface
{
- public const CACHE_TTL = 60 * 60;
-
/**
* @var ProductRepository
*/
@@ -56,11 +53,6 @@ class ProductDataService implements SingletonInterface
*/
protected $hotelImageService;
- /**
- * @var FrontendInterface
- */
- protected $cache;
-
/**
* @param ProductRepository $productRepository
* @param HotelRepository $hotelRepository
@@ -71,14 +63,12 @@ class ProductDataService implements SingletonInterface
ProductRepository $productRepository,
HotelRepository $hotelRepository,
HotelImageService $hotelImageService,
- ProductImageService $productImageService,
- FrontendInterface $cache
+ ProductImageService $productImageService
) {
$this->productRepository = $productRepository;
$this->hotelRepository = $hotelRepository;
$this->productImageService = $productImageService;
$this->hotelImageService = $hotelImageService;
- $this->cache = $cache;
}
/**
@@ -88,13 +78,8 @@ class ProductDataService implements SingletonInterface
*/
public function getTeaser(array $filterSettings): ?array
{
- $key = 'teaser_group_'.sha1(serialize($filterSettings));
-
- if (false === $teasers = $this->cache->get($key)) {
- $teaserData = $this->productRepository->getTeasers($filterSettings);
- $teasers = $this->preprocessTeasergroup($teaserData);
- $this->cache->set($key, $teasers, ['ep_products'], self::CACHE_TTL);
- }
+ $teaserData = $this->productRepository->getTeasers($filterSettings);
+ $teasers = $this->preprocessTeasergroup($teaserData);
if (0 === count($teasers)) {
return null;
@@ -112,13 +97,8 @@ class ProductDataService implements SingletonInterface
*/
public function getTeasergroup(array $filterSettings, array $excludedConceptUids = [], int $limit = 0): array
{
- $key = 'teaser_group_'.sha1(serialize($filterSettings).serialize($excludedConceptUids));
-
- if (false === $teasers = $this->cache->get($key)) {
- $teaserData = $this->productRepository->getTeasers($filterSettings, $excludedConceptUids);
- $teasers = $this->preprocessTeasergroup($teaserData);
- $this->cache->set($key, $teasers, ['ep_products'], self::CACHE_TTL);
- }
+ $teaserData = $this->productRepository->getTeasers($filterSettings, $excludedConceptUids);
+ $teasers = $this->preprocessTeasergroup($teaserData);
if ($limit > 0) {
return \array_slice($teasers, 0, $limit);
diff --git a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_pricetable.xml b/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_pricetable.xml
index a7219b08..af6b5ae5 100644
--- a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_pricetable.xml
+++ b/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_pricetable.xml
@@ -16,6 +16,7 @@
reload
select
+ selectSingle
Pricetable->event
diff --git a/public/typo3conf/ext/ep_products/Configuration/Services.yaml b/public/typo3conf/ext/ep_products/Configuration/Services.yaml
index f6854165..999f8f4a 100644
--- a/public/typo3conf/ext/ep_products/Configuration/Services.yaml
+++ b/public/typo3conf/ext/ep_products/Configuration/Services.yaml
@@ -27,15 +27,3 @@ services:
EP\EpProducts\Service\ProductImageService:
arguments:
$cache: '@cache.ep_cache'
-
- EP\EpProducts\Service\DateService:
- arguments:
- $cache: '@cache.ep_cache'
-
- EP\EpProducts\Service\ProductDataService:
- arguments:
- $cache: '@cache.ep_cache'
-
- EP\EpProducts\Service\ContingentDataService:
- arguments:
- $cache: '@cache.ep_cache'