|
|
|
|
|
|
|
|
$persist = true |
|
|
$persist = true |
|
|
): OrderShopInterface { |
|
|
): OrderShopInterface { |
|
|
|
|
|
|
|
|
|
|
|
// @TODO : intégrer la gestion des OrderPackProduct dans cette méthode |
|
|
|
|
|
|
|
|
// TODO essayer de comprendre pourquoi on doit faire un refresh ici |
|
|
// TODO essayer de comprendre pourquoi on doit faire un refresh ici |
|
|
$this->entityManager->refresh($orderShop1); |
|
|
$this->entityManager->refresh($orderShop1); |
|
|
$this->entityManager->refresh($orderShop2); |
|
|
$this->entityManager->refresh($orderShop2); |
|
|
|
|
|
|
|
|
return $productsSalesStatistic->getAsArray(); |
|
|
return $productsSalesStatistic->getAsArray(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function delete(OrderShopInterface $orderShop) |
|
|
|
|
|
{ |
|
|
|
|
|
// delete OrderProduct |
|
|
|
|
|
foreach($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
|
|
$this->entityManager->delete($orderProduct); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderPackProduct |
|
|
|
|
|
foreach($orderShop->getOrderPackProducts() as $orderPackProduct) { |
|
|
|
|
|
$this->entityManager->delete($orderPackProduct); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderPayment |
|
|
|
|
|
foreach($orderShop->getOrderPayments() as $orderPayment) { |
|
|
|
|
|
$this->entityManager->delete($orderPayment); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderReductionCarts |
|
|
|
|
|
foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
|
|
$this->entityManager->delete($orderReductionCart); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderReductionCredits |
|
|
|
|
|
foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) { |
|
|
|
|
|
$this->entityManager->delete($orderReductionCredit); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderStatusHistory |
|
|
|
|
|
foreach($orderShop->getOrderStatusHistories() as $orderStatusHistory) { |
|
|
|
|
|
$this->entityManager->delete($orderStatusHistory); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// delete OrderShop |
|
|
|
|
|
$this->entityManager->delete($orderShop); |
|
|
|
|
|
|
|
|
|
|
|
$this->entityManager->flush(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |