|
|
|
|
|
|
|
|
if (isset($params['deliveryAvailability'])) { |
|
|
if (isset($params['deliveryAvailability'])) { |
|
|
$deliveryAvailability = $params['deliveryAvailability'] ; |
|
|
$deliveryAvailability = $params['deliveryAvailability'] ; |
|
|
|
|
|
|
|
|
$isDeliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? true : false; |
|
|
|
|
|
$isDeliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? true : false; |
|
|
|
|
|
|
|
|
$deliveryAvailabilityZone = ($deliveryAvailability instanceof DeliveryAvailabilityZone) ? $deliveryAvailability : false; |
|
|
|
|
|
$deliveryAvailabilityPointSale = ($deliveryAvailability instanceof DeliveryAvailabilityPointSale) ? $deliveryAvailability : false; |
|
|
|
|
|
|
|
|
if($isDeliveryAvailabilityZone) { |
|
|
|
|
|
$query->innerJoin('e.deliveryAvailabilityZone','deliveryAvailabilityZone') ; |
|
|
|
|
|
|
|
|
if($deliveryAvailabilityZone){ |
|
|
|
|
|
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone'); |
|
|
|
|
|
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($isDeliveryAvailabilityPointSale) { |
|
|
|
|
|
$query->innerJoin('e.deliveryAvailabilityPointSale','deliveryAvailabilityPointSale') ; |
|
|
|
|
|
|
|
|
if($deliveryAvailabilityPointSale) { |
|
|
|
|
|
$query->andWhere('e.deliveryAvailabilityZone = :deliveryAvailabilityZone'); |
|
|
|
|
|
$query->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityPointSale); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone'); |
|
|
|
|
|
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone'); |
|
|
|
|
|
|
|
|
|
|
|
$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale'); |
|
|
|
|
|
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (isset($params['orderBy'])) { |
|
|
if (isset($params['orderBy'])) { |
|
|
|
|
|
|
|
|
$query->orderBy('e.id', 'DESC'); |
|
|
$query->orderBy('e.id', 'DESC'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone'); |
|
|
|
|
|
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone'); |
|
|
|
|
|
|
|
|
|
|
|
$query->leftJoin('e.deliveryAvailabilityPointSale', 'deliveryAvailabilityPointSale'); |
|
|
|
|
|
$query->leftJoin('deliveryAvailabilityPointSale.deliverySlot', 'deliverySlotPointSale'); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($params['count']) && $params['count']) { |
|
|
if (isset($params['count']) && $params['count']) { |
|
|
return $query->getQuery()->getSingleScalarResult(); |
|
|
return $query->getQuery()->getSingleScalarResult(); |