Browse Source

Utilisation de l'entité OrderStatus plutôt que de son modèle

feature/section_export
Fabien Normand 1 day ago
parent
commit
3c1ed683f2
4 changed files with 24 additions and 25 deletions
  1. +4
    -4
      Builder/Order/OrderShopBuilder.php
  2. +2
    -2
      Repository/Order/OrderProductStore.php
  3. +14
    -15
      Repository/Order/OrderShopStore.php
  4. +4
    -4
      Solver/Order/OrderShopSolver.php

+ 4
- 4
Builder/Order/OrderShopBuilder.php View File

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Builder\Order;

use App\Builder\Distribution\DistributionBuilder;
use App\Entity\Order\OrderStatus;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Builder\Credit\CreditHistoryBuilder;
use Lc\CaracoleBundle\Builder\File\DocumentBuilder;
@@ -27,7 +28,6 @@ use Lc\CaracoleBundle\Model\Order\OrderReductionCreditInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusHistoryModel;
use Lc\CaracoleBundle\Model\Order\OrderStatusInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
@@ -124,7 +124,7 @@ class OrderShopBuilder
): OrderShopInterface {
$orderShop = $this->orderShopFactory->create($section, $user, $visitor);

$this->setOrderStatus($orderShop, OrderStatusModel::ALIAS_CART);
$this->setOrderStatus($orderShop, OrderStatus::ALIAS_CART);

$this->entityManager->create($orderShop);
$this->entityManager->flush();
@@ -378,9 +378,9 @@ class OrderShopBuilder
}

if ($this->orderShopResolver->isPaid($orderShop)) {
$nextStatus = OrderStatusModel::ALIAS_PAID;
$nextStatus = OrderStatus::ALIAS_PAID;
} else {
$nextStatus = OrderStatusModel::ALIAS_PARTIAL_PAYMENT;
$nextStatus = OrderStatus::ALIAS_PARTIAL_PAYMENT;
}

if ($orderShop->getOrderStatus()->getAlias() != $nextStatus) {

+ 2
- 2
Repository/Order/OrderProductStore.php View File

@@ -2,8 +2,8 @@

namespace Lc\CaracoleBundle\Repository\Order;

use App\Entity\Order\OrderStatus;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Repository\AbstractStore;
@@ -43,7 +43,7 @@ class OrderProductStore extends AbstractStore
{
$query = $this->createDefaultQuery($query);
$query->filterByProduct($product);
$query->filterByOrderStatus(OrderStatusModel::$statusAliasAsCart);
$query->filterByOrderStatus(OrderStatus::$statusAliasAsCart);
return $query->find();
}
}

+ 14
- 15
Repository/Order/OrderShopStore.php View File

@@ -4,12 +4,11 @@ namespace Lc\CaracoleBundle\Repository\Order;

use App\Builder\Distribution\DistributionBuilder;
use App\Entity\Distribution\Distribution;
use App\Entity\User\User;
use App\Entity\Order\OrderStatus;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Builder\File\DocumentBuilder;
use Lc\CaracoleBundle\Model\Distribution\DistributionInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
@@ -272,7 +271,7 @@ class OrderShopStore extends AbstractStore
$query
->selectCount()
->filterByReductionCredit($reductionCredit)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->filterByStatus(OrderStatus::$statusAliasAsValid);

return $query->count();
}
@@ -288,7 +287,7 @@ class OrderShopStore extends AbstractStore
$query
->selectCount()
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->filterByStatus(OrderStatus::$statusAliasAsValid);

return $query->count();
}
@@ -306,7 +305,7 @@ class OrderShopStore extends AbstractStore
->selectCount()
->filterByUser($user)
->filterByReductionCart($reductionCart)
->filterByStatus(OrderStatusModel::$statusAliasAsValid);
->filterByStatus(OrderStatus::$statusAliasAsValid);

return $query->count();
}
@@ -343,7 +342,7 @@ class OrderShopStore extends AbstractStore

$query
->selectOrderReductionCarts()
->filterByStatus(OrderStatusModel::$statusAliasAsCart);
->filterByStatus(OrderStatus::$statusAliasAsCart);

return $query->findOne();
}
@@ -359,7 +358,7 @@ class OrderShopStore extends AbstractStore

$query
->filterByDistribution($distribution)
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterByStatus(OrderStatus::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.cycleId', 'DESC');

@@ -377,7 +376,7 @@ class OrderShopStore extends AbstractStore
$query
->filterByDistribution($distribution)
->filterByUser($user)
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterByStatus(OrderStatus::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.cycleId', 'DESC');

@@ -390,7 +389,7 @@ class OrderShopStore extends AbstractStore
$query = $this->createDefaultQuery($query);

$query
->filterByStatus(OrderStatusModel::$statusAliasAsValid)
->filterByStatus(OrderStatus::$statusAliasAsValid)
->filterIsNotComplementaryOrderShop()
->orderBy('.idValidOrder', 'DESC');

@@ -466,15 +465,15 @@ class OrderShopStore extends AbstractStore
}

if (isset($params['isCart'])) {
$query->filterByStatus(OrderStatusModel::$statusAliasAsCart);
$query->filterByStatus(OrderStatus::$statusAliasAsCart);
}

if (isset($params['isValid'])) {
$query->filterByStatus(OrderStatusModel::$statusAliasAsValid);
$query->filterByStatus(OrderStatus::$statusAliasAsValid);
}

if (isset($params['isWaitingDelivery'])) {
$query->filterByStatus(OrderStatusModel::$statusAliasWaitingDelivery);
$query->filterByStatus(OrderStatus::$statusAliasWaitingDelivery);
}

if (isset($params['orderStatus'])) {
@@ -656,7 +655,7 @@ class OrderShopStore extends AbstractStore
{
$query = $this->createDefaultQuery($query);
$query
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByAlias(OrderStatus::$statusAliasAsValid)
->filterByDistributions($distributions)
->filterByProducts($products)
->selectSum()
@@ -678,7 +677,7 @@ class OrderShopStore extends AbstractStore
$query = $this->createQuery($query);

$query
->filterByAlias(OrderStatusModel::$statusAliasAsValid)
->filterByAlias(OrderStatus::$statusAliasAsValid)
->filterByDistribution($distribution)
->filterByProduct($product)
->selectSumQuantityOrder()
@@ -730,7 +729,7 @@ class OrderShopStore extends AbstractStore

$query = $this->createQuery($query);

$query->filterByAlias(OrderStatusModel::$statusAliasAsCart);
$query->filterByAlias(OrderStatus::$statusAliasAsCart);
$query->filterByUserIsNull();
$query->filterByVisitorIsNull();


+ 4
- 4
Solver/Order/OrderShopSolver.php View File

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Solver\Order;

use App\Entity\Order\OrderShop;
use App\Entity\Order\OrderStatus;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManagerInterface;
@@ -12,7 +13,6 @@ use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopModel;
use Lc\CaracoleBundle\Model\Order\OrderStatusInterface;
use Lc\CaracoleBundle\Model\Order\OrderStatusModel;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
@@ -377,7 +377,7 @@ class OrderShopSolver
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsValid
OrderStatus::$statusAliasAsValid
) > 0) {
return true;
}
@@ -389,7 +389,7 @@ class OrderShopSolver
{
if ($orderShop->getOrderStatus() && in_array(
$orderShop->getOrderStatus()->getAlias(),
OrderStatusModel::$statusAliasAsCart
OrderStatus::$statusAliasAsCart
) > 0) {
return true;
}
@@ -399,7 +399,7 @@ class OrderShopSolver

public function isDone(OrderShopInterface $orderShop): bool
{
if ($orderShop->getOrderStatus() && $orderShop->getOrderStatus()->getAlias() == OrderStatusModel::ALIAS_DONE) {
if ($orderShop->getOrderStatus() && $orderShop->getOrderStatus()->getAlias() == OrderStatus::ALIAS_DONE) {
return true;
}
return false;

Loading…
Cancel
Save