|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function countValidOrderProductsOfWeekByProduct($weekNumber, $productId) |
|
|
|
|
|
{ |
|
|
|
|
|
$query = $this->findByMerchantQuery(); |
|
|
|
|
|
$query = $this->filterOrderValid($query); |
|
|
|
|
|
$query->andWhere('e.weekNumber = :weekNumber'); |
|
|
|
|
|
$query->setParameter('weekNumber', $weekNumber); |
|
|
|
|
|
$query->leftJoin('e.orderProducts', 'orderProduct'); |
|
|
|
|
|
$query->andWhere('orderProduct.product = :product'); |
|
|
|
|
|
$query->setParameter('product', $productId); |
|
|
|
|
|
$query->select('SUM(orderProduct.quantityOrder) as quantity'); |
|
|
|
|
|
|
|
|
|
|
|
$result = $query->getQuery()->getOneOrNullResult(); |
|
|
|
|
|
|
|
|
|
|
|
return $result['quantity']; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |