Browse Source

test orderShop

packProduct
Charly 3 years ago
parent
commit
2194c1bae2
2 changed files with 17 additions and 17 deletions
  1. +9
    -9
      Repository/Order/OrderShopRepositoryQuery.php
  2. +8
    -8
      Repository/Order/OrderShopStore.php

+ 9
- 9
Repository/Order/OrderShopRepositoryQuery.php View File

public function selectCount(): self public function selectCount(): self
{ {
return $this return $this
->addSelect('count(r.id) as total');
->select('count(r.id) as total');
} }


public function filterByUser(UserInterface $user): self public function filterByUser(UserInterface $user): self
->setParameter('dateEnd', $dateEnd); ->setParameter('dateEnd', $dateEnd);
} }


public function filterByEstimatedDeliveryDateStart(DateTime $dateStart): self
public function filterByEstimatedDeliveryDateStart(string $dateStart): self
{ {
return $this return $this
->andWhere('.estimatedDeliveryDateTime >= :deliveryDateStart') ->andWhere('.estimatedDeliveryDateTime >= :deliveryDateStart')
->setParameter('deliveryDateStart', $dateStart); ->setParameter('deliveryDateStart', $dateStart);
} }


public function filterByEstimatedDeliveryDateEnd(DateTime $dateEnd): self
public function filterByEstimatedDeliveryDateEnd(string $dateEnd): self
{ {
return $this return $this
->andWhere('.estimatedDeliveryDateTime < :deliveryDateEnd') ->andWhere('.estimatedDeliveryDateTime < :deliveryDateEnd')
->setParameter('deliveryDateEnd', $dateEnd); ->setParameter('deliveryDateEnd', $dateEnd);
} }


public function filterByDeliveryDateStart(DateTime $dateStart): self
public function filterByDeliveryDateStart(string $dateStart): self
{ {
return $this return $this
->andWhere('.deliveryDate >= :deliveryDateStart') ->andWhere('.deliveryDate >= :deliveryDateStart')
->setParameter('deliveryDateStart', $dateStart); ->setParameter('deliveryDateStart', $dateStart);
} }


public function filterByDeliveryDateEnd(DateTime $dateEnd): self
public function filterByDeliveryDateEnd(string $dateEnd): self
{ {
return $this return $this
->andWhere('.deliveryDate < :deliveryDateEnd') ->andWhere('.deliveryDate < :deliveryDateEnd')
->setParameter('reductionCart', $reductionCart); ->setParameter('reductionCart', $reductionCart);
} }


public function filterByAvailabilityPointZone(DeliveryAvailabilityZone $deliveryAvailabilityZone): self
public function filterByAvailabilityPointZone(DeliveryAvailabilityPointSale $deliveryAvailabilityPointSale): self
{ {
return $this return $this
->andWhere('.deliveryAvailabilityZone = :deliveryAvailabilityZone')
->setParameter('deliveryAvailabilityZone', $deliveryAvailabilityZone);
->andWhere('.deliveryAvailabilityPointSale = :deliveryAvailabilityPointSale')
->setParameter('deliveryAvailabilityPointSale', $deliveryAvailabilityPointSale);
} }


public function filterByAvailabilityPointSale(DeliveryAvailabilityPointSale $deliveryAvailabilityPointSale): self public function filterByAvailabilityPointSale(DeliveryAvailabilityPointSale $deliveryAvailabilityPointSale): self


public function joinDeliverySlotPointSale(): self public function joinDeliverySlotPointSale(): self
{ {
$this->joinDeliveryAvailabilityZone();
$this->joinDeliveryAvailabilityPointSale();


if (!$this->isJoinDeliverySlotPointSale) { if (!$this->isJoinDeliverySlotPointSale) {
$this->isJoinDeliverySlotPointSale = true; $this->isJoinDeliverySlotPointSale = true;

+ 8
- 8
Repository/Order/OrderShopStore.php View File



namespace Lc\CaracoleBundle\Repository\Order; namespace Lc\CaracoleBundle\Repository\Order;


use App\Entity\Delivery\DeliveryAvailabilityPointSale;
use App\Entity\Delivery\DeliveryAvailabilityZone;
use App\Entity\Order\OrderStatus; use App\Entity\Order\OrderStatus;
use Lc\CaracoleBundle\Builder\File\DocumentBuilder; use Lc\CaracoleBundle\Builder\File\DocumentBuilder;
use Lc\CaracoleBundle\Factory\File\DocumentFactory; use Lc\CaracoleBundle\Factory\File\DocumentFactory;


if (isset($params['count']) && $params['count']) { if (isset($params['count']) && $params['count']) {
$query->selectCount(); $query->selectCount();
}
if (isset($params['select'])) {
$query->selectParam($params['select']);
} else {
if (isset($params['select'])) {
$query->selectParam($params['select']);
}
} }


if (isset($params['dateStart']) || isset($params['dateEnd'])) { if (isset($params['dateStart']) || isset($params['dateEnd'])) {
} }


if (isset($params['orderBy'])) { if (isset($params['orderBy'])) {
$query->orderBy(
$params['orderBy'],
isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC'
);
$sort = isset($params['orderByDirection']) ? $params['orderByDirection'] : 'DESC';
$query->orderBy($params['orderBy'], $sort);
} else { } else {
$query->orderBy('.id', 'DESC'); $query->orderBy('.id', 'DESC');
} }

Loading…
Cancel
Save