Remove potentially unused left join to avoid duplication of result rows

This commit is contained in:
Björn Fromme
2020-04-28 20:27:51 +02:00
parent b1ce1ffefa
commit b84e9e9550
4 changed files with 5 additions and 13 deletions
@@ -117,12 +117,8 @@ abstract class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Reposit
;
} elseif (count($filterSettings->getRegionUids()) > 0) {
$query
->andWhere(
$query->expr()->orX(
$query->expr()->in('date.region', $filterSettings->getRegionUids()),
$query->expr()->in('mm.uid_foreign', $filterSettings->getRegionUids()
))
)
->andWhere('date.region IN (:regionUids)')
->setParameter('regionUids', $filterSettings->getRegionUids(), Connection::PARAM_INT_ARRAY)
;
} elseif (count($filterSettings->getCountryUids()) > 0) {
$query
@@ -96,7 +96,6 @@ class DateRepository extends AbstractRepository
)
->from('tx_epproducts_domain_model_date', 'date')
->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid')
->leftJoin('date', 'tx_epproducts_product_region_mm', 'mm', 'mm.uid_local = date.product')
->where('date.date_start >= NOW()')
->andWhere('date.product_searchable = 1')
->andWhere('date.hotel_type > 0')
@@ -104,7 +104,6 @@ class ProductRepository extends AbstractRepository
)
->from('tx_epproducts_domain_model_date', 'date')
->leftJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid')
->leftJoin('date', 'tx_epproducts_product_region_mm', 'mm', 'mm.uid_local = date.product')
->where('date.product_searchable = 1')
->andWhere('date.date_start >= NOW()')
->groupBy('date.product')
@@ -159,7 +158,6 @@ class ProductRepository extends AbstractRepository
'board'
)
->from('tx_epproducts_domain_model_date', 'date')
->leftJoin('date', 'tx_epproducts_product_region_mm', 'mm', 'mm.uid_local = date.product')
->where('date_start >= NOW()')
->groupBy('product')
->addGroupBy('date.hotel')
@@ -217,13 +215,12 @@ class ProductRepository extends AbstractRepository
'date.uid as dateUid', 'date.date_start as dateStart', 'date.date_end as dateEnd', 'date.bus_pro_id as dateBusProId',
'date.hotel as hotelUid', 'date.hotel_bus_pro_id as hotelBusProId', 'date.bus_included as dateBusIncluded',
'date.skipass_included as dateSkipassIncluded',
'room.uid as as roomUid', 'room.bus_pro_id as roomBusProId', 'room.name as roomName',
'room.uid as roomUid', 'room.bus_pro_id as roomBusProId', 'room.name as roomName',
'room.price as roomPrice', 'date.discount as roomDiscount', 'date.bus_price as busPrice',
'room.services as roomOptionalServices', 'room.nights as roomNights', 'room.available as roomAvailable'
)
->from('tx_epproducts_domain_model_date', 'date')
->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'date.uid = room.date')
->leftJoin('date', 'tx_epproducts_product_region_mm', 'mm', 'mm.uid_local = date.product')
->orderBy('date.date_start', 'ASC')
->addOrderBy('room.pax', 'ASC')
->addOrderBy('room.price', 'ASC')
@@ -270,7 +267,6 @@ class ProductRepository extends AbstractRepository
)
->from('tx_epproducts_domain_model_date', 'date')
->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid')
->leftJoin('date', 'tx_epproducts_product_region_mm', 'mm', 'mm.uid_local = date.product')
->orderBy('date.date_start', 'ASC')
->addOrderBy('date.min_price', 'ASC')
->where('date.date_start >= NOW()')
@@ -104,9 +104,10 @@ class DateService implements SingletonInterface
}
$nonBookableDateUids = GeneralUtility::trimExplode(',', $product->getNonBookableDates(), true);
$priceTableData = $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date);
return $this->preprocessPriceTable([
'priceTableData' => $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date),
'priceTableData' => $priceTableData,
'template' => $template,
'paCode' => $paCode,
'isDayTrip' => $product->isDaytrip(),