} | } | ||||
// saveCreditHistory | // saveCreditHistory | ||||
public function save(CreditHistoryInterface $creditHistory) | |||||
public function save(CreditHistoryInterface $creditHistory) :bool | |||||
{ | { | ||||
if ($creditHistory) { | if ($creditHistory) { | ||||
$userMerchant = $creditHistory->getUserMerchant(); | $userMerchant = $creditHistory->getUserMerchant(); |
$this->documentReferenceGenerator = $documentReferenceGenerator; | $this->documentReferenceGenerator = $documentReferenceGenerator; | ||||
} | } | ||||
public function initFromOrderShop(DocumentInterface $document, OrderShopInterface $orderShop) | |||||
public function initFromOrderShop(DocumentInterface $document, OrderShopInterface $orderShop) :DocumentInterface | |||||
{ | { | ||||
$merchantAddress = $orderShop->getMerchant()->getAddress(); | $merchantAddress = $orderShop->getMerchant()->getAddress(); | ||||
$buyerAddress = $orderShop->getInvoiceAddress(); | $buyerAddress = $orderShop->getInvoiceAddress(); |
$this->cookieComponent = $cookieComponent; | $this->cookieComponent = $cookieComponent; | ||||
} | } | ||||
public function setCookieMerchantCurrent($response, MerchantInterface $merchant) | |||||
public function setCookieMerchantCurrent($response, MerchantInterface $merchant) :void | |||||
{ | { | ||||
$response->headers->setCookie( | $response->headers->setCookie( | ||||
Cookie::create( | Cookie::create( |
use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | ||||
use Lc\CaracoleBundle\Resolver\Price\PriceResolver; | use Lc\CaracoleBundle\Resolver\Price\PriceResolver; | ||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | |||||
class OrderProductBuilder | class OrderProductBuilder | ||||
{ | { | ||||
protected EntityManagerInterface $entityManager; | protected EntityManagerInterface $entityManager; | ||||
protected PriceResolver $priceResolver; | |||||
protected PriceSolver $priceSolver; | |||||
protected OrderProductStore $orderProductStore; | protected OrderProductStore $orderProductStore; | ||||
public function __construct( | public function __construct( | ||||
EntityManagerInterface $entityManager, | EntityManagerInterface $entityManager, | ||||
PriceResolver $priceResolver, | |||||
PriceSolver $priceSolver, | |||||
OrderProductStore $orderProductStore | OrderProductStore $orderProductStore | ||||
) { | ) { | ||||
$this->entityManager = $entityManager; | $this->entityManager = $entityManager; | ||||
$this->priceResolver = $priceResolver; | |||||
$this->priceSolver = $priceSolver; | |||||
$this->orderProductStore = $orderProductStore; | $this->orderProductStore = $orderProductStore; | ||||
} | } | ||||
public function init(OrderProductInterface $orderProduct) | |||||
public function init(OrderProductInterface $orderProduct) :OrderProductInterface | |||||
{ | { | ||||
$orderProduct->setTitle($orderProduct->getTitleOrderShop()); | $orderProduct->setTitle($orderProduct->getTitleOrderShop()); | ||||
$orderProduct->setPrice($this->priceResolver->getPrice($orderProduct->getProduct())); | |||||
$orderProduct->setBuyingPrice($this->priceResolver->getBuyingPrice($orderProduct->getProduct())); | |||||
$orderProduct->setPrice($this->priceSolver->getPrice($orderProduct->getProduct())); | |||||
$orderProduct->setBuyingPrice($this->priceSolver->getBuyingPrice($orderProduct->getProduct())); | |||||
$orderProduct->setUnit($orderProduct->getProduct()->getUnitInherited()); | $orderProduct->setUnit($orderProduct->getProduct()->getUnitInherited()); | ||||
$orderProduct->setTaxRate($orderProduct->getProduct()->getTaxRateInherited()); | $orderProduct->setTaxRate($orderProduct->getProduct()->getTaxRateInherited()); | ||||
$orderProduct->setQuantityProduct($orderProduct->getProduct()->getQuantityInherited()); | $orderProduct->setQuantityProduct($orderProduct->getProduct()->getQuantityInherited()); |
use Lc\CaracoleBundle\Factory\Order\OrderReductionCreditFactory; | use Lc\CaracoleBundle\Factory\Order\OrderReductionCreditFactory; | ||||
use Lc\CaracoleBundle\Factory\Order\OrderShopFactory; | use Lc\CaracoleBundle\Factory\Order\OrderShopFactory; | ||||
use Lc\CaracoleBundle\Factory\Order\OrderStatusHistoryFactory; | use Lc\CaracoleBundle\Factory\Order\OrderStatusHistoryFactory; | ||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | |||||
use Lc\CaracoleBundle\Model\File\DocumentModel; | use Lc\CaracoleBundle\Model\File\DocumentModel; | ||||
use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderReductionCartInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderReductionCreditInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderStatusInterface; | use Lc\CaracoleBundle\Model\Order\OrderStatusInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderStatusStore; | use Lc\CaracoleBundle\Repository\Order\OrderStatusStore; | ||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; | use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; | ||||
use Lc\CaracoleBundle\Resolver\Price\PriceResolver; | use Lc\CaracoleBundle\Resolver\Price\PriceResolver; | ||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | |||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||||
protected EntityManagerInterface $entityManager; | protected EntityManagerInterface $entityManager; | ||||
protected OrderStatusStore $orderStatusStore; | protected OrderStatusStore $orderStatusStore; | ||||
protected OrderProductStore $orderProductStore; | protected OrderProductStore $orderProductStore; | ||||
protected OrderShopStore $orderShopStore; | |||||
protected ProductFamilyStore $productFamilyStore; | protected ProductFamilyStore $productFamilyStore; | ||||
protected PriceResolver $priceResolver; | |||||
protected PriceSolver $priceSolver; | |||||
protected OrderProductBuilder $orderProductBuilder; | protected OrderProductBuilder $orderProductBuilder; | ||||
protected DocumentBuilder $documentBuilder; | protected DocumentBuilder $documentBuilder; | ||||
protected EventDispatcherInterface $eventDispatcher; | protected EventDispatcherInterface $eventDispatcher; | ||||
ProductFamilyStore $productFamilyStore, | ProductFamilyStore $productFamilyStore, | ||||
OrderProductBuilder $orderProductBuilder, | OrderProductBuilder $orderProductBuilder, | ||||
DocumentBuilder $documentBuilder, | DocumentBuilder $documentBuilder, | ||||
PriceResolver $priceResolver, | |||||
PriceSolver $priceSolver, | |||||
EventDispatcherInterface $eventDispatcher, | EventDispatcherInterface $eventDispatcher, | ||||
FlashBagInterface $flashBag | FlashBagInterface $flashBag | ||||
) { | ) { | ||||
$this->productFamilyStore = $productFamilyStore; | $this->productFamilyStore = $productFamilyStore; | ||||
$this->orderProductBuilder = $orderProductBuilder; | $this->orderProductBuilder = $orderProductBuilder; | ||||
$this->documentBuilder = $documentBuilder; | $this->documentBuilder = $documentBuilder; | ||||
$this->priceResolver = $priceResolver; | |||||
$this->priceSolver = $priceSolver; | |||||
$this->eventDispatcher = $eventDispatcher; | $this->eventDispatcher = $eventDispatcher; | ||||
$this->flashBag = $flashBag; | $this->flashBag = $flashBag; | ||||
} | } | ||||
SectionInterface $section, | SectionInterface $section, | ||||
UserInterface $user = null, | UserInterface $user = null, | ||||
VisitorInterface $visitor = null | VisitorInterface $visitor = null | ||||
) { | |||||
): OrderShopInterface { | |||||
$orderShopFactory = new OrderShopFactory(); | $orderShopFactory = new OrderShopFactory(); | ||||
$orderShop = $orderShopFactory->create($section, $user, $visitor); | $orderShop = $orderShopFactory->create($section, $user, $visitor); | ||||
$this->changeOrderStatus($orderShop, OrderStatusModel::ALIAS_CART); | |||||
$this->setOrderStatus($orderShop, OrderStatusModel::ALIAS_CART); | |||||
//TODO flush ??? | |||||
return $orderShop; | return $orderShop; | ||||
} | } | ||||
SectionInterface $section, | SectionInterface $section, | ||||
UserInterface $user = null, | UserInterface $user = null, | ||||
VisitorInterface $visitor = null | VisitorInterface $visitor = null | ||||
) { | |||||
): OrderShopInterface { | |||||
$cart = $this->orderShopStore->getCartBy( | $cart = $this->orderShopStore->getCartBy( | ||||
[ | [ | ||||
'section' => $section, | 'section' => $section, | ||||
return $cart; | return $cart; | ||||
} | } | ||||
public function changeOrderStatus(OrderShopInterface $orderShop, string $alias, bool $forceByAdmin = false) | |||||
{ | |||||
public function setOrderStatus( | |||||
OrderShopInterface $orderShop, | |||||
string $alias, | |||||
bool $forceByAdmin = false | |||||
): OrderShopInterface { | |||||
$orderStatus = $this->orderStatusStore->getRepositoryQuery()->findOneByAlias($alias); | $orderStatus = $this->orderStatusStore->getRepositoryQuery()->findOneByAlias($alias); | ||||
if ($orderStatus) { | if ($orderStatus) { | ||||
if ($orderShop->getOrderStatus() === null | if ($orderShop->getOrderStatus() === null | ||||
|| $orderShop->getOrderStatus()->getNextStatusAllowed()->contains($orderStatus)) { | || $orderShop->getOrderStatus()->getNextStatusAllowed()->contains($orderStatus)) { | ||||
$this->applyChangeOrderStatus($orderShop, $orderStatus, $forceByAdmin); | $this->applyChangeOrderStatus($orderShop, $orderStatus, $forceByAdmin); | ||||
} | } | ||||
} else { | } else { | ||||
OrderShopInterface $orderShop, | OrderShopInterface $orderShop, | ||||
OrderStatusInterface $orderStatus, | OrderStatusInterface $orderStatus, | ||||
bool $forceByAdmin = false | bool $forceByAdmin = false | ||||
) { | |||||
): void { | |||||
$this->eventDispatcher->dispatch( | $this->eventDispatcher->dispatch( | ||||
new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), | new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), | ||||
OrderShopChangeStatusEvent::PRE_CHANGE_STATUS | OrderShopChangeStatusEvent::PRE_CHANGE_STATUS | ||||
OrderShopInterface $orderShop, | OrderShopInterface $orderShop, | ||||
OrderProductInterface $orderProductAdd, | OrderProductInterface $orderProductAdd, | ||||
bool $persist = true | bool $persist = true | ||||
) { | |||||
): bool { | |||||
$return = false; | $return = false; | ||||
if ($this->orderProductStore->isOrderProductAvailableAddCart($orderProductAdd, $orderShop)) { | if ($this->orderProductStore->isOrderProductAvailableAddCart($orderProductAdd, $orderShop)) { | ||||
if ($persist) { | if ($persist) { | ||||
if (isset($orderProductReductionCatalog)) { | if (isset($orderProductReductionCatalog)) { | ||||
$this->entityManager->persist($orderProductReductionCatalog); | |||||
$this->entityManager->create($orderProductReductionCatalog); | |||||
} | } | ||||
$this->entityManager->persist($orderProductAdd); | |||||
$this->entityManager->persist($orderShop); | |||||
//TODO est-ce un update ou un create ??? | |||||
$this->entityManager->update($orderProductAdd); | |||||
$this->entityManager->update($orderShop); | |||||
} | } | ||||
$return = true; | $return = true; | ||||
return $return; | return $return; | ||||
} | } | ||||
public function merge(OrderShopInterface $orderShop1, OrderShopInterface $orderShop2, $persist = true) | |||||
{ | |||||
public function merge( | |||||
OrderShopInterface $orderShop1, | |||||
OrderShopInterface $orderShop2, | |||||
$persist = true | |||||
): OrderShopInterface { | |||||
if ($orderShop1 && $orderShop2) { | if ($orderShop1 && $orderShop2) { | ||||
foreach ($orderShop2->getOrderProducts() as $orderProduct) { | foreach ($orderShop2->getOrderProducts() as $orderProduct) { | ||||
$orderProductAlreadyInCart = $orderShop1->hasOrderProductAlreadyInCart($orderProduct); | $orderProductAlreadyInCart = $orderShop1->hasOrderProductAlreadyInCart($orderProduct); | ||||
} | } | ||||
if ($persist) { | if ($persist) { | ||||
$this->entityManager->remove($orderProduct); | |||||
$this->entityManager->delete($orderProduct); | |||||
} | } | ||||
} | } | ||||
if ($persist) { | if ($persist) { | ||||
$this->entityManager->remove($orderShop2); | |||||
$this->entityManager->persist($orderShop1); | |||||
$this->entityManager->delete($orderShop2); | |||||
$this->entityManager->update($orderShop1); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public function addPayment(OrderShopInterface $orderShop, $meanPayment, $amount) | |||||
public function addPayment(OrderShopInterface $orderShop, string $meanPayment, float $amount): OrderShopInterface | |||||
{ | { | ||||
$orderPaymentFactory = new OrderPaymentFactory(); | $orderPaymentFactory = new OrderPaymentFactory(); | ||||
$orderPayment = $orderPaymentFactory->create($orderShop, $meanPayment, $amount); | $orderPayment = $orderPaymentFactory->create($orderShop, $meanPayment, $amount); | ||||
$orderShop = $this->changeOrderStatus($orderShop, $nextStatus); | $orderShop = $this->changeOrderStatus($orderShop, $nextStatus); | ||||
} | } | ||||
$this->entityManager->persist($orderPayment); | |||||
$this->entityManager->create($orderPayment); | |||||
$this->entityManager->update($orderShop); | $this->entityManager->update($orderShop); | ||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
return $orderShop; | return $orderShop; | ||||
} | } | ||||
public function createDocumentInvoice(OrderShopInterface $orderShop) | |||||
public function createDocumentInvoice(OrderShopInterface $orderShop): DocumentInterface | |||||
{ | { | ||||
$documentFactory = new DocumentFactory(); | $documentFactory = new DocumentFactory(); | ||||
$document = $documentFactory->create(DocumentModel::TYPE_INVOICE); | $document = $documentFactory->create(DocumentModel::TYPE_INVOICE); | ||||
$this->documentBuilder->initFromOrderShop($orderShop); | |||||
$this->documentBuilder->initFromOrderShop($document, $orderShop); | |||||
return $document; | return $document; | ||||
} | } | ||||
public function addReductionCart(OrderShopInterface $orderShop, ReductionCartInterface $reductionCart) | |||||
{ | |||||
public function addReductionCart( | |||||
OrderShopInterface $orderShop, | |||||
ReductionCartInterface $reductionCart | |||||
): ?OrderReductionCartInterface { | |||||
$orderReductionCartFactory = new OrderReductionCartFactory(); | $orderReductionCartFactory = new OrderReductionCartFactory(); | ||||
$orderReductionCart = $orderReductionCartFactory->create($orderShop, $reductionCart); | $orderReductionCart = $orderReductionCartFactory->create($orderShop, $reductionCart); | ||||
if ($this->orderShopStore->isPositiveAmount($orderShop) | if ($this->orderShopStore->isPositiveAmount($orderShop) | ||||
&& $this->isPositiveAmountRemainingToBePaid($orderShop)) { | && $this->isPositiveAmountRemainingToBePaid($orderShop)) { | ||||
$this->entityManager->persist($orderReductionCart); | |||||
$this->entityManager->create($orderReductionCart); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
return $orderReductionCart; | return $orderReductionCart; | ||||
} else { | } else { | ||||
//TODO vérifier ce case ! Avec le null en valeur de retour | |||||
$orderShop->removeOrderReductionCart($orderReductionCart); | $orderShop->removeOrderReductionCart($orderReductionCart); | ||||
return false; | |||||
return null; | |||||
} | } | ||||
} | } | ||||
// createOrderReductionCredit | // createOrderReductionCredit | ||||
public function addReductionCredit(OrderShopInterface $orderShop, ReductionCreditInterface $reductionCredit) | |||||
{ | |||||
public function addReductionCredit( | |||||
OrderShopInterface $orderShop, | |||||
ReductionCreditInterface $reductionCredit | |||||
): ?OrderReductionCreditInterface { | |||||
$orderReductionCreditFactory = new OrderReductionCreditFactory(); | $orderReductionCreditFactory = new OrderReductionCreditFactory(); | ||||
$orderReductionCredit = $orderReductionCreditFactory->create($orderShop, $reductionCredit); | $orderReductionCredit = $orderReductionCreditFactory->create($orderShop, $reductionCredit); | ||||
if ($this->isOrderShopPositiveAmount($orderShop) | if ($this->isOrderShopPositiveAmount($orderShop) | ||||
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { | && $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { | ||||
$this->entityManager->persist($orderReductionCredit); | |||||
$this->entityManager->create($orderReductionCredit); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
return $orderReductionCredit; | return $orderReductionCredit; | ||||
} else { | } else { | ||||
$orderShop->removeOrderReductionCredit($orderReductionCredit); | $orderShop->removeOrderReductionCredit($orderReductionCredit); | ||||
return false; | |||||
return null; | |||||
} | } | ||||
} | } | ||||
public function deductAvailabilityProduct(OrderShopInterface $orderShop) | |||||
public function deductAvailabilityProduct(OrderShopInterface $orderShop): void | |||||
{ | { | ||||
// @TODO : à refactorer en plaçant dans src tout ce qui est spécifique à PDL | |||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
//Si ce n'esrt pas une relivraison OU si c'est une relivraison + relivraison + ce n'est pas une erruer producteur | |||||
if (!$orderProduct->isRedelivery() || ($orderProduct->isRedelivery( | |||||
) && $orderProduct->isRedeliverySupplierOrder( | |||||
) && !$orderProduct->isRedeliverySupplierMistake())) { | |||||
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) { | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | |||||
$this->applyDeductAvailabilityProduct($orderShop, $orderProduct); | |||||
} | |||||
} | |||||
//Disponibilité par unité de référence | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder( | |||||
) * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit( | |||||
)->getCoefficient())); | |||||
public function applyDeductAvailabilityProduct( | |||||
OrderShopInterface $orderShop, | |||||
OrderProductInterface $orderProduct | |||||
): void { | |||||
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) { | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | |||||
$productFamily = $orderProduct->getProduct()->getProductFamily(); | |||||
$productFamily->setAvailableQuantity($newAvailability); | |||||
$productFamily->setUpdatedBy($orderShop->getUser()); | |||||
//Disponibilité par unité de référence | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder( | |||||
) * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient())); | |||||
$this->entityManager->persist($productFamily); | |||||
$productFamily = $orderProduct->getProduct()->getProductFamily(); | |||||
$productFamily->setAvailableQuantity($newAvailability); | |||||
$productFamily->setUpdatedBy($orderShop->getUser()); | |||||
break; | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : | |||||
$this->entityManager->update($productFamily); | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); | |||||
break; | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : | |||||
$productFamily = $orderProduct->getProduct()->getProductFamily(); | |||||
$productFamily->setAvailableQuantity($newAvailability); | |||||
$productFamily->setUpdatedBy($orderShop->getUser()); | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); | |||||
$this->entityManager->persist($productFamily); | |||||
$productFamily = $orderProduct->getProduct()->getProductFamily(); | |||||
$productFamily->setAvailableQuantity($newAvailability); | |||||
$productFamily->setUpdatedBy($orderShop->getUser()); | |||||
break; | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); | |||||
$this->entityManager->update($productFamily); | |||||
$product = $orderProduct->getProduct(); | |||||
$product->setAvailableQuantity($newAvailability); | |||||
$product->setUpdatedBy($orderShop->getUser()); | |||||
break; | |||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : | |||||
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited(); | |||||
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder(); | |||||
$this->entityManager->persist($product); | |||||
$product = $orderProduct->getProduct(); | |||||
$product->setAvailableQuantity($newAvailability); | |||||
$product->setUpdatedBy($orderShop->getUser()); | |||||
break; | |||||
} | |||||
$this->entityManager->update($product); | |||||
$this->entityManager->flush(); | |||||
} | |||||
break; | |||||
} | } | ||||
$this->entityManager->flush(); | |||||
} | } | ||||
} | } |
class UserBuilder extends SovUserBuilder | class UserBuilder extends SovUserBuilder | ||||
{ | { | ||||
public function linkToPointSale(UserInterface $user, PointSaleInterface $pointSale) | |||||
public function linkToPointSale(UserInterface $user, PointSaleInterface $pointSale):bool | |||||
{ | { | ||||
if (!$user->isLinkedToPointSale($pointSale)) { | if (!$user->isLinkedToPointSale($pointSale)) { | ||||
$userPointSaleFactory = new UserPointSaleFactory(); | $userPointSaleFactory = new UserPointSaleFactory(); | ||||
$userPointSale = $userPointSaleFactory->create($user, $pointSale); | $userPointSale = $userPointSaleFactory->create($user, $pointSale); | ||||
$this->entityManager->persist($userPointSale); | |||||
$this->entityManager->create($userPointSale); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
return true; | return true; |
if (!$userMerchant) { | if (!$userMerchant) { | ||||
$userMerchantFactory = new UserMerchantFactory(); | $userMerchantFactory = new UserMerchantFactory(); | ||||
$userMerchant = $userMerchantFactory | |||||
->setMerchant($merchant) | |||||
->create($user); | |||||
$userMerchant = $userMerchantFactory->create($user, $merchant); | |||||
} | } | ||||
return $userMerchant; | return $userMerchant; | ||||
} | } | ||||
public function init(UserInterface $user, MerchantInterface $merchant, bool $active = true, bool $creditActive = false, float $credit = null, bool $persist = true) | |||||
{ | |||||
public function init( | |||||
UserInterface $user, | |||||
MerchantInterface $merchant, | |||||
bool $active = true, | |||||
bool $creditActive = false, | |||||
float $credit = null, | |||||
bool $persist = true | |||||
): UserMerchantInterface { | |||||
$userMerchant = $this->createIfNotExist($user, $merchant); | $userMerchant = $this->createIfNotExist($user, $merchant); | ||||
$userMerchant->setActive($active); | $userMerchant->setActive($active); | ||||
$userMerchant->setCreditActive($creditActive) ; | |||||
$userMerchant->setCredit($credit) ; | |||||
$userMerchant->setCreditActive($creditActive); | |||||
$userMerchant->setCredit($credit); | |||||
if($persist) { | |||||
if ($persist) { | |||||
//TODO create ou update ??? | |||||
$this->entityManager->persist($userMerchant); | $this->entityManager->persist($userMerchant); | ||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
} | } | ||||
MerchantInterface $merchant, | MerchantInterface $merchant, | ||||
$creditActive = true | $creditActive = true | ||||
): UserMerchantInterface { | ): UserMerchantInterface { | ||||
$userMerchant = $this->createIfNotExist($user, $merchant); | $userMerchant = $this->createIfNotExist($user, $merchant); | ||||
$userMerchant->setCreditActive($creditActive); | $userMerchant->setCreditActive($creditActive); | ||||
//TODO create ou update ??? | |||||
$this->entityManager->persist($userMerchant); | $this->entityManager->persist($userMerchant); | ||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
): UserMerchantInterface { | ): UserMerchantInterface { | ||||
$userMerchant->setCredit($amount); | $userMerchant->setCredit($amount); | ||||
$this->entityManager->persist($creditHistory); | |||||
$this->entityManager->persist($userMerchant); | |||||
$this->entityManager->update($creditHistory); | |||||
$this->entityManager->update($userMerchant); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
return $userMerchant; | return $userMerchant; |
$visitorFactory = new VisitorFactory(); | $visitorFactory = new VisitorFactory(); | ||||
$visitor = $visitorFactory->create($cookie, $ip); | $visitor = $visitorFactory->create($cookie, $ip); | ||||
$this->entityManager->persist($visitor); | |||||
$this->entityManager->create($visitor); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
} | } | ||||
$visitor->setTotalVisit($totalVisit); | $visitor->setTotalVisit($totalVisit); | ||||
$visitor->setLastAccess(new \DateTime()); | $visitor->setLastAccess(new \DateTime()); | ||||
$this->entityManager->persist($visitor); | |||||
$this->entityManager->update($visitor); | |||||
$this->entityManager->flush(); | $this->entityManager->flush(); | ||||
} | } | ||||
// setCookieVisitor | // setCookieVisitor | ||||
public function setCookie($response, $cookie) | |||||
public function setCookie($response, $cookie): void | |||||
{ | { | ||||
$response->headers->setCookie( | $response->headers->setCookie( | ||||
Cookie::create( | Cookie::create( | ||||
} | } | ||||
// updateVisitorCookie | // updateVisitorCookie | ||||
public function updateCookie($response) | |||||
public function updateCookie($response): void | |||||
{ | { | ||||
$response->headers->setCookie( | $response->headers->setCookie( | ||||
Cookie::create( | Cookie::create( |
<?php | |||||
namespace Lc\CaracoleBundle\Checker; | |||||
use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | |||||
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | |||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | |||||
class OrderChecker | |||||
{ | |||||
protected PriceSolver $priceSolver; | |||||
protected OrderShopSolver $orderShopSolver; | |||||
public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver) | |||||
{ | |||||
$this->priceSolver = $priceSolver; | |||||
$this->orderShopSolver = $orderShopSolver; | |||||
} | |||||
public function hasOrderProductAlreadyInCart( | |||||
OrderShopInterface $orderShop, | |||||
OrderProductInterface $orderProductTest | |||||
): ?OrderProductInterface { | |||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | |||||
if ($orderProduct->getProduct() == $orderProductTest->getProduct()) { | |||||
return $orderProduct; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
public function isValid(OrderShopInterface $orderShop): bool | |||||
{ | |||||
if ($orderShop->getOrderStatus() && in_array( | |||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsValid | |||||
) > 0) { | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
public function isCart(OrderShopInterface $orderShop): bool | |||||
{ | |||||
if ($orderShop->getOrderStatus() && in_array( | |||||
$orderShop->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsCart | |||||
) > 0) { | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
// isOrderShopPositiveAmount | |||||
public function isPositiveAmount(OrderShopInterface $orderShop): bool | |||||
{ | |||||
return $this->priceSolver->getTotalWithTax($orderShop) >= 0; | |||||
} | |||||
public function isPaid(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): bool | |||||
{ | |||||
$totalOrderPayments = $this->orderShopSolver->getTotalOrderPayments($orderShop, $mergeComplementaryOrderShop); | |||||
$totalOrder = $this->priceSolver->getTotalWithTax($orderShop); | |||||
if ((abs($totalOrderPayments - $totalOrder) < 0.00001 | |||||
|| $totalOrderPayments >= $totalOrder) | |||||
&& $totalOrder > 0) { | |||||
return true; | |||||
} else { | |||||
return false; | |||||
} | |||||
} | |||||
// isOrderShopPositiveAmountRemainingToBePaid | |||||
public function isPositiveAmountRemainingToBePaid(OrderShopInterface $orderShop): bool | |||||
{ | |||||
return $this->orderShopSolver->getTotalRemainingToBePaid($orderShop) > 0; | |||||
} | |||||
public function isCartAllowToBeOrder(OrderShopInterface $orderShop): bool | |||||
{ | |||||
return true; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Address; | |||||
use Lc\CaracoleBundle\Factory\Address\AddressFactory; | |||||
use Lc\CaracoleBundle\Repository\Address\AddressRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Address\AddressStore; | |||||
class AddressContainer | |||||
{ | |||||
protected AddressFactory $factory; | |||||
protected AddressRepositoryQuery $repositoryQuery; | |||||
protected AddressStore $store; | |||||
public function __construct( | |||||
AddressFactory $factory, | |||||
AddressRepositoryQuery $repositoryQuery, | |||||
AddressStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): AddressFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): AddressRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): AddressStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Config; | |||||
use Lc\CaracoleBundle\Factory\Config\TaxRateFactory; | |||||
use Lc\CaracoleBundle\Repository\Config\TaxRateRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | |||||
class TaxRateContainer | |||||
{ | |||||
protected TaxRateFactory $factory; | |||||
protected TaxRateRepositoryQuery $repositoryQuery; | |||||
protected TaxRateStore $store; | |||||
public function __construct( | |||||
TaxRateFactory $factory, | |||||
TaxRateRepositoryQuery $repositoryQuery, | |||||
TaxRateStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): TaxRateFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): TaxRateRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): TaxRateStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Config; | |||||
use Lc\CaracoleBundle\Factory\Config\UnitFactory; | |||||
use Lc\CaracoleBundle\Repository\Config\UnitRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | |||||
class UnitContainer | |||||
{ | |||||
protected UnitFactory $factory; | |||||
protected UnitRepositoryQuery $repositoryQuery; | |||||
protected UnitStore $store; | |||||
public function __construct( | |||||
UnitFactory $factory, | |||||
UnitRepositoryQuery $repositoryQuery, | |||||
UnitStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): UnitFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): UnitRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): UnitStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Credit; | |||||
use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory; | |||||
use Lc\CaracoleBundle\Repository\Credit\CreditHistoryRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Credit\CreditHistoryStore; | |||||
class CreditHistoryContainer | |||||
{ | |||||
protected CreditHistoryFactory $factory; | |||||
protected CreditHistoryRepositoryQuery $repositoryQuery; | |||||
protected CreditHistoryStore $store; | |||||
public function __construct( | |||||
CreditHistoryFactory $factory, | |||||
CreditHistoryRepositoryQuery $repositoryQuery, | |||||
CreditHistoryStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): CreditHistoryFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): CreditHistoryRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): CreditHistoryStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\File; | |||||
use Lc\CaracoleBundle\Factory\File\DocumentFactory; | |||||
use Lc\CaracoleBundle\Repository\File\DocumentRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\File\DocumentStore; | |||||
class DocumentContainer | |||||
{ | |||||
protected DocumentFactory $factory; | |||||
protected DocumentRepositoryQuery $repositoryQuery; | |||||
protected DocumentStore $store; | |||||
public function __construct( | |||||
DocumentFactory $factory, | |||||
DocumentRepositoryQuery $repositoryQuery, | |||||
DocumentStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): DocumentFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): DocumentRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): DocumentStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Merchant; | |||||
use Lc\CaracoleBundle\Builder\Merchant\MerchantBuilder; | |||||
use Lc\CaracoleBundle\Factory\Merchant\MerchantFactory; | |||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; | |||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
class MerchantContainer | |||||
{ | |||||
protected MerchantFactory $factory; | |||||
protected MerchantBuilder $builder; | |||||
protected MerchantResolver $resolver; | |||||
protected MerchantRepositoryQuery $repositoryQuery; | |||||
protected MerchantStore $store; | |||||
public function __construct( | |||||
MerchantFactory $factory, | |||||
MerchantBuilder $builder, | |||||
MerchantResolver $resolver, | |||||
MerchantRepositoryQuery $repositoryQuery, | |||||
MerchantStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->builder = $builder; | |||||
$this->resolver = $resolver; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): MerchantFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getResolver(): MerchantResolver | |||||
{ | |||||
return $this->resolver; | |||||
} | |||||
public function getRepositoryQuery(): MerchantRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): MerchantStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container; | |||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
/** | |||||
* class MyContainer. | |||||
* | |||||
* @author Simon Vieille <simon@deblan.fr> | |||||
*/ | |||||
class MyContainer | |||||
{ | |||||
public MerchantResolver $merchantResolver; | |||||
public function __construct(MerchantResolver $merchantResolver) | |||||
{ | |||||
$this->merchantResolver = $merchantResolver; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderPaymentFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderPaymentRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderPaymentStore; | |||||
class OrderPaymentContainer | |||||
{ | |||||
protected OrderPaymentFactory $factory; | |||||
protected OrderPaymentRepositoryQuery $repositoryQuery; | |||||
protected OrderPaymentStore $store; | |||||
public function __construct( | |||||
OrderPaymentFactory $factory, | |||||
OrderPaymentRepositoryQuery $repositoryQuery, | |||||
OrderPaymentStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderPaymentFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderPaymentRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderPaymentStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Builder\Order\OrderProductBuilder; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | |||||
class OrderProductContainer | |||||
{ | |||||
protected OrderProductFactory $factory; | |||||
protected OrderProductBuilder $builder; | |||||
protected OrderProductRepositoryQuery $repositoryQuery; | |||||
protected OrderProductStore $store; | |||||
public function __construct( | |||||
OrderProductFactory $factory, | |||||
OrderProductBuilder $builder, | |||||
OrderProductRepositoryQuery $repositoryQuery, | |||||
OrderProductStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->builder = $builder; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderProductFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getBuilder(): OrderProductBuilder | |||||
{ | |||||
return $this->builder; | |||||
} | |||||
public function getRepositoryQuery(): OrderProductRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderProductStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderProductReductionCatalogFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductReductionCatalogRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductReductionCatalogStore; | |||||
use Lc\CaracoleBundle\Solver\Order\OrderProductReductionCatalogSolver; | |||||
class OrderProductReductionCatalogContainer | |||||
{ | |||||
protected OrderProductReductionCatalogFactory $factory; | |||||
protected OrderProductReductionCatalogSolver $solver; | |||||
protected OrderProductReductionCatalogRepositoryQuery $repositoryQuery; | |||||
protected OrderProductReductionCatalogStore $store; | |||||
public function __construct( | |||||
OrderProductReductionCatalogFactory $factory, | |||||
OrderProductReductionCatalogSolver $solver, | |||||
OrderProductReductionCatalogRepositoryQuery $repositoryQuery, | |||||
OrderProductReductionCatalogStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->solver = $solver; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderProductReductionCatalogFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getSolver(): OrderProductReductionCatalogSolver | |||||
{ | |||||
return $this->solver; | |||||
} | |||||
public function getRepositoryQuery(): OrderProductReductionCatalogRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderProductReductionCatalogStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderProductRefundFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductRefundRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderProductRefundStore; | |||||
class OrderProductRefundContainer | |||||
{ | |||||
protected OrderProductRefundFactory $factory; | |||||
protected OrderProductRefundRepositoryQuery $repositoryQuery; | |||||
protected OrderProductRefundStore $store; | |||||
public function __construct( | |||||
OrderProductRefundFactory $factory, | |||||
OrderProductRefundRepositoryQuery $repositoryQuery, | |||||
OrderProductRefundStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderProductRefundFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderProductRefundRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderProductRefundStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderReductionCartFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderReductionCartRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderReductionCartStore; | |||||
class OrderReductionCartContainer | |||||
{ | |||||
protected OrderReductionCartFactory $factory; | |||||
protected OrderReductionCartRepositoryQuery $repositoryQuery; | |||||
protected OrderReductionCartStore $store; | |||||
public function __construct( | |||||
OrderReductionCartFactory $factory, | |||||
OrderReductionCartRepositoryQuery $repositoryQuery, | |||||
OrderReductionCartStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderReductionCartFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderReductionCartRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderReductionCartStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderReductionCreditFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderReductionCreditRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderReductionCreditStore; | |||||
class OrderReductionCreditContainer | |||||
{ | |||||
protected OrderReductionCreditFactory $factory; | |||||
protected OrderReductionCreditRepositoryQuery $repositoryQuery; | |||||
protected OrderReductionCreditStore $store; | |||||
public function __construct( | |||||
OrderReductionCreditFactory $factory, | |||||
OrderReductionCreditRepositoryQuery $repositoryQuery, | |||||
OrderReductionCreditStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderReductionCreditFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderReductionCreditRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderReductionCreditStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderRefundFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderRefundRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderRefundStore; | |||||
class OrderRefundContainer | |||||
{ | |||||
protected OrderRefundFactory $factory; | |||||
protected OrderRefundRepositoryQuery $repositoryQuery; | |||||
protected OrderRefundStore $store; | |||||
public function __construct( | |||||
OrderRefundFactory $factory, | |||||
OrderRefundRepositoryQuery $repositoryQuery, | |||||
OrderRefundStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderRefundFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderRefundRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderRefundStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder; | |||||
use Lc\CaracoleBundle\Checker\OrderChecker; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderShopFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderShopRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | |||||
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | |||||
class OrderShopContainer | |||||
{ | |||||
protected OrderShopFactory $orderShopFactory; | |||||
protected OrderShopSolver $orderShopSolver; | |||||
protected OrderChecker $orderChecker; | |||||
protected OrderShopRepositoryQuery $orderShopRepositoryQuery; | |||||
protected OrderShopStore $orderShopStore; | |||||
protected OrderShopBuilder $orderShopBuilder; | |||||
public function __construct( | |||||
OrderShopFactory $orderShopFactory, | |||||
OrderShopSolver $orderShopSolver, | |||||
OrderChecker $orderChecker, | |||||
OrderShopRepositoryQuery $orderShopRepositoryQuery, | |||||
OrderShopStore $orderShopStore, | |||||
OrderShopBuilder $orderShopBuilder | |||||
) { | |||||
$this->orderShopFactory = $orderShopFactory; | |||||
$this->orderShopSolver = $orderShopSolver; | |||||
$this->orderChecker = $orderChecker; | |||||
$this->orderShopRepositoryQuery = $orderShopRepositoryQuery; | |||||
$this->orderShopStore = $orderShopStore; | |||||
$this->orderShopBuilder = $orderShopBuilder; | |||||
} | |||||
public function getFactory(): OrderShopFactory | |||||
{ | |||||
return $this->orderShopFactory; | |||||
} | |||||
public function getSolver(): OrderShopSolver | |||||
{ | |||||
return $this->orderShopSolver; | |||||
} | |||||
public function getChecker(): OrderChecker | |||||
{ | |||||
return $this->orderChecker; | |||||
} | |||||
public function getRepositoryQuery(): OrderShopRepositoryQuery | |||||
{ | |||||
return $this->orderShopRepositoryQuery; | |||||
} | |||||
public function getStore(): OrderShopStore | |||||
{ | |||||
return $this->orderShopStore; | |||||
} | |||||
public function getBuilder(): OrderShopBuilder | |||||
{ | |||||
return $this->orderShopBuilder; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderStatusFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderStatusRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderStatusStore; | |||||
class OrderStatusContainer | |||||
{ | |||||
protected OrderStatusFactory $factory; | |||||
protected OrderStatusRepositoryQuery $repositoryQuery; | |||||
protected OrderStatusStore $store; | |||||
public function __construct( | |||||
OrderStatusFactory $factory, | |||||
OrderStatusRepositoryQuery $repositoryQuery, | |||||
OrderStatusStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderStatusFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderStatusRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderStatusStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Order; | |||||
use Lc\CaracoleBundle\Factory\Order\OrderStatusHistoryFactory; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderStatusHistoryRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderStatusHistoryStore; | |||||
class OrderStatusHistoryContainer | |||||
{ | |||||
protected OrderStatusHistoryFactory $factory; | |||||
protected OrderStatusHistoryRepositoryQuery $repositoryQuery; | |||||
protected OrderStatusHistoryStore $store; | |||||
public function __construct( | |||||
OrderStatusHistoryFactory $factory, | |||||
OrderStatusHistoryRepositoryQuery $repositoryQuery, | |||||
OrderStatusHistoryStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OrderStatusHistoryFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): OrderStatusHistoryRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OrderStatusHistoryStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\PointSale; | |||||
use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory; | |||||
use Lc\CaracoleBundle\Repository\PointSale\PointSaleRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\PointSale\PointSaleStore; | |||||
class PointSaleContainer | |||||
{ | |||||
protected PointSaleFactory $factory; | |||||
protected PointSaleRepositoryQuery $repositoryQuery; | |||||
protected PointSaleStore $store; | |||||
public function __construct( | |||||
PointSaleFactory $factory, | |||||
PointSaleRepositoryQuery $repositoryQuery, | |||||
PointSaleStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): PointSaleFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): PointSaleRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): PointSaleStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Product; | |||||
use Lc\CaracoleBundle\Factory\Product\ProductCategoryFactory; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductCategoryRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore; | |||||
class ProductCategoryContainer | |||||
{ | |||||
protected ProductCategoryFactory $factory; | |||||
protected ProductCategoryRepositoryQuery $repositoryQuery; | |||||
protected ProductCategoryStore $store; | |||||
public function __construct( | |||||
ProductCategoryFactory $factory, | |||||
ProductCategoryRepositoryQuery $repositoryQuery, | |||||
ProductCategoryStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ProductCategoryFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ProductCategoryRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ProductCategoryStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Product; | |||||
use Lc\CaracoleBundle\Factory\Product\ProductFactory; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductStore; | |||||
class ProductContainer | |||||
{ | |||||
protected ProductFactory $factory; | |||||
protected ProductRepositoryQuery $repositoryQuery; | |||||
protected ProductStore $store; | |||||
public function __construct( | |||||
ProductFactory $factory, | |||||
ProductRepositoryQuery $repositoryQuery, | |||||
ProductStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ProductFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ProductRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ProductStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Product; | |||||
use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; | |||||
class ProductFamilyContainer | |||||
{ | |||||
protected ProductFamilyFactory $factory; | |||||
protected ProductFamilyRepositoryQuery $repositoryQuery; | |||||
protected ProductFamilyStore $store; | |||||
public function __construct( | |||||
ProductFamilyFactory $factory, | |||||
ProductFamilyRepositoryQuery $repositoryQuery, | |||||
ProductFamilyStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ProductFamilyFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ProductFamilyRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ProductFamilyStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Reduction; | |||||
use Lc\CaracoleBundle\Factory\Reduction\ReductionCartFactory; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore; | |||||
class ReductionCartContainer | |||||
{ | |||||
protected ReductionCartFactory $factory; | |||||
protected ReductionCartRepositoryQuery $repositoryQuery; | |||||
protected ReductionCartStore $store; | |||||
public function __construct( | |||||
ReductionCartFactory $factory, | |||||
ReductionCartRepositoryQuery $repositoryQuery, | |||||
ReductionCartStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ReductionCartFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ReductionCartRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ReductionCartStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Reduction; | |||||
use Lc\CaracoleBundle\Factory\Reduction\ReductionCatalogFactory; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogStore; | |||||
class ReductionCatalogContainer | |||||
{ | |||||
protected ReductionCatalogFactory $factory; | |||||
protected ReductionCatalogRepositoryQuery $repositoryQuery; | |||||
protected ReductionCatalogStore $store; | |||||
public function __construct( | |||||
ReductionCatalogFactory $factory, | |||||
ReductionCatalogRepositoryQuery $repositoryQuery, | |||||
ReductionCatalogStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ReductionCatalogFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ReductionCatalogRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ReductionCatalogStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Reduction; | |||||
use Lc\CaracoleBundle\Factory\Reduction\ReductionCreditFactory; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | |||||
class ReductionCreditContainer | |||||
{ | |||||
protected ReductionCreditFactory $factory; | |||||
protected ReductionCreditRepositoryQuery $repositoryQuery; | |||||
protected ReductionCreditStore $store; | |||||
public function __construct( | |||||
ReductionCreditFactory $factory, | |||||
ReductionCreditRepositoryQuery $repositoryQuery, | |||||
ReductionCreditStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): ReductionCreditFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): ReductionCreditRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): ReductionCreditStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Section; | |||||
use Lc\CaracoleBundle\Factory\Section\OpeningFactory; | |||||
use Lc\CaracoleBundle\Repository\Section\OpeningRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Section\OpeningStore; | |||||
use Lc\CaracoleBundle\Resolver\OpeningResolver; | |||||
class OpeningContainer | |||||
{ | |||||
protected OpeningFactory $factory; | |||||
protected OpeningResolver $resolver; | |||||
protected OpeningRepositoryQuery $repositoryQuery; | |||||
protected OpeningStore $store; | |||||
public function __construct( | |||||
OpeningFactory $factory, | |||||
OpeningResolver $resolver, | |||||
OpeningRepositoryQuery $repositoryQuery, | |||||
OpeningStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->resolver = $resolver; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): OpeningFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getResolver(): OpeningResolver | |||||
{ | |||||
return $this->resolver; | |||||
} | |||||
public function getRepositoryQuery(): OpeningRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): OpeningStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Section; | |||||
use Lc\CaracoleBundle\Factory\Section\SectionFactory; | |||||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Section\SectionStore; | |||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||||
class SectionContainer | |||||
{ | |||||
protected SectionFactory $factory; | |||||
protected SectionResolver $resolver; | |||||
protected SectionRepositoryQuery $repositoryQuery; | |||||
protected SectionStore $store; | |||||
public function __construct( | |||||
SectionFactory $factory, | |||||
SectionResolver $resolver, | |||||
SectionRepositoryQuery $repositoryQuery, | |||||
SectionStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->resolver = $resolver; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): SectionFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getResolver(): SectionResolver | |||||
{ | |||||
return $this->resolver; | |||||
} | |||||
public function getRepositoryQuery(): SectionRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): SectionStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Setting; | |||||
use Lc\CaracoleBundle\Definition\MerchantSettingDefinition; | |||||
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory; | |||||
use Lc\CaracoleBundle\Repository\Setting\MerchantSettingRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Setting\MerchantSettingStore; | |||||
class MerchantSettingContainer | |||||
{ | |||||
protected MerchantSettingFactory $factory; | |||||
protected MerchantSettingDefinition $definition; | |||||
protected MerchantSettingRepositoryQuery $repositoryQuery; | |||||
protected MerchantSettingStore $store; | |||||
public function __construct( | |||||
MerchantSettingFactory $factory, | |||||
MerchantSettingDefinition $definition, | |||||
MerchantSettingRepositoryQuery $repositoryQuery, | |||||
MerchantSettingStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): MerchantSettingFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getDefinition(): MerchantSettingDefinition | |||||
{ | |||||
return $this->definition; | |||||
} | |||||
public function getRepositoryQuery(): MerchantSettingRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): MerchantSettingStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\Setting; | |||||
use Lc\CaracoleBundle\Definition\SectionSettingDefinition; | |||||
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory; | |||||
use Lc\CaracoleBundle\Repository\Setting\SectionSettingRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Setting\SectionSettingStore; | |||||
class SectionSettingContainer | |||||
{ | |||||
protected SectionSettingFactory $factory; | |||||
protected SectionSettingDefinition $definition; | |||||
protected SectionSettingRepositoryQuery $repositoryQuery; | |||||
protected SectionSettingStore $store; | |||||
public function __construct( | |||||
SectionSettingFactory $factory, | |||||
SectionSettingDefinition $definition, | |||||
SectionSettingRepositoryQuery $repositoryQuery, | |||||
SectionSettingStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->definition = $definition; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): SectionSettingFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getDefinition(): SectionSettingDefinition | |||||
{ | |||||
return $this->definition; | |||||
} | |||||
public function getRepositoryQuery(): SectionSettingRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): SectionSettingStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\User; | |||||
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | |||||
use Lc\CaracoleBundle\Repository\User\UserMerchantRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\User\UserMerchantStore; | |||||
class UserMerchantContainer | |||||
{ | |||||
protected UserMerchantFactory $factory; | |||||
protected UserMerchantRepositoryQuery $repositoryQuery; | |||||
protected UserMerchantStore $store; | |||||
public function __construct( | |||||
UserMerchantFactory $factory, | |||||
UserMerchantRepositoryQuery $repositoryQuery, | |||||
UserMerchantStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): UserMerchantFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): UserMerchantRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): UserMerchantStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\User; | |||||
use Lc\CaracoleBundle\Factory\User\UserPointSaleFactory; | |||||
use Lc\CaracoleBundle\Repository\User\UserPointSaleRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\User\UserPointSaleStore; | |||||
class UserPointSaleContainer | |||||
{ | |||||
protected UserPointSaleFactory $factory; | |||||
protected UserPointSaleRepositoryQuery $repositoryQuery; | |||||
protected UserPointSaleStore $store; | |||||
public function __construct( | |||||
UserPointSaleFactory $factory, | |||||
UserPointSaleRepositoryQuery $repositoryQuery, | |||||
UserPointSaleStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): UserPointSaleFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): UserPointSaleRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): UserPointSaleStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\User; | |||||
use Lc\CaracoleBundle\Factory\User\VisitorFactory; | |||||
use Lc\CaracoleBundle\Repository\User\VisitorRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\User\VisitorStore; | |||||
class VisitorContainer | |||||
{ | |||||
protected VisitorFactory $factory; | |||||
protected VisitorRepositoryQuery $repositoryQuery; | |||||
protected VisitorStore $store; | |||||
public function __construct( | |||||
VisitorFactory $factory, | |||||
VisitorRepositoryQuery $repositoryQuery, | |||||
VisitorStore $store | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
} | |||||
public function getFactory(): VisitorFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): VisitorRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): VisitorStore | |||||
{ | |||||
return $this->store; | |||||
} | |||||
} |
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException; | use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; | use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; | ||||
use Lc\CaracoleBundle\Container\Address\AddressContainer; | |||||
use Lc\CaracoleBundle\Container\Config\TaxRateContainer; | |||||
use Lc\CaracoleBundle\Container\Config\UnitContainer; | |||||
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer; | |||||
use Lc\CaracoleBundle\Container\File\DocumentContainer; | |||||
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderProductContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderProductReductionCatalogContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderProductRefundContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderReductionCartContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderReductionCreditContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderRefundContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderStatusContainer; | |||||
use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer; | |||||
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer; | |||||
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | |||||
use Lc\CaracoleBundle\Container\Product\ProductContainer; | |||||
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | |||||
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer; | |||||
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer; | |||||
use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer; | |||||
use Lc\CaracoleBundle\Container\Section\OpeningContainer; | |||||
use Lc\CaracoleBundle\Container\Section\SectionContainer; | |||||
use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer; | |||||
use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer; | |||||
use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | |||||
use Lc\CaracoleBundle\Container\User\UserPointSaleContainer; | |||||
use Lc\CaracoleBundle\Container\User\VisitorContainer; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto; | use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto; | ||||
use Lc\SovBundle\Component\EntityComponent; | use Lc\SovBundle\Component\EntityComponent; | ||||
use Lc\SovBundle\Container\File\FileContainer; | |||||
use Lc\SovBundle\Container\Newsletter\NewsletterContainer; | |||||
use Lc\SovBundle\Container\Reminder\ReminderContainer; | |||||
use Lc\SovBundle\Container\Setting\SiteSettingContainer; | |||||
use Lc\SovBundle\Container\Site\NewsContainer; | |||||
use Lc\SovBundle\Container\Site\PageContainer; | |||||
use Lc\SovBundle\Container\Site\SiteContainer; | |||||
use Lc\SovBundle\Container\Ticket\TicketContainer; | |||||
use Lc\SovBundle\Container\Ticket\TicketMessageContainer; | |||||
use Lc\SovBundle\Container\User\GroupUserContainer; | |||||
use Lc\SovBundle\Container\User\UserContainer; | |||||
use Lc\SovBundle\Factory\User\UserFactory; | use Lc\SovBundle\Factory\User\UserFactory; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use Symfony\Component\HttpFoundation\Response; | use Symfony\Component\HttpFoundation\Response; | ||||
return array_merge( | return array_merge( | ||||
parent::getSubscribedServices(), | parent::getSubscribedServices(), | ||||
[ | [ | ||||
'merchant_resolver' => MerchantResolver::class, | |||||
'section_resolver' => SectionResolver::class, | |||||
'user_factory' => UserFactory::class, | |||||
'user_merchant_factory' => UserMerchantFactory::class, | |||||
ReductionCatalogStore::class => ReductionCatalogStore::class, | |||||
MerchantResolver::class => MerchantResolver::class, | |||||
SectionResolver::class=> SectionResolver::class, | |||||
AddressContainer::class => AddressContainer::class, | |||||
TaxRateContainer::class => TaxRateContainer::class, | |||||
UnitContainer::class => UnitContainer::class, | |||||
CreditHistoryContainer::class => CreditHistoryContainer::class, | |||||
DocumentContainer::class => DocumentContainer::class, | |||||
MerchantContainer::class => MerchantContainer::class, | |||||
OrderPaymentContainer::class => OrderPaymentContainer::class, | |||||
OrderProductContainer::class => OrderProductContainer::class, | |||||
OrderProductReductionCatalogContainer::class => OrderProductReductionCatalogContainer::class, | |||||
OrderProductRefundContainer::class => OrderProductRefundContainer::class, | |||||
OrderReductionCartContainer::class => OrderReductionCartContainer::class, | |||||
OrderReductionCreditContainer::class => OrderReductionCreditContainer::class, | |||||
OrderRefundContainer::class => OrderRefundContainer::class, | |||||
OrderShopContainer::class => OrderShopContainer::class, | |||||
OrderStatusContainer::class => OrderStatusContainer::class, | |||||
OrderStatusHistoryContainer::class => OrderStatusHistoryContainer::class, | |||||
PointSaleContainer::class => PointSaleContainer::class, | |||||
ProductCategoryContainer::class => ProductCategoryContainer::class, | |||||
ProductContainer::class => ProductContainer::class, | |||||
ProductFamilyContainer::class => ProductFamilyContainer::class, | |||||
ReductionCartContainer::class => ReductionCartContainer::class, | |||||
ReductionCatalogContainer::class => ReductionCatalogContainer::class, | |||||
ReductionCreditContainer::class => ReductionCreditContainer::class, | |||||
OpeningContainer::class => OpeningContainer::class, | |||||
SectionContainer::class => SectionContainer::class, | |||||
MerchantSettingContainer::class => MerchantSettingContainer::class, | |||||
SectionSettingContainer::class => SectionSettingContainer::class, | |||||
UserMerchantContainer::class => UserMerchantContainer::class, | |||||
UserPointSaleContainer::class => UserPointSaleContainer::class, | |||||
VisitorContainer::class => VisitorContainer::class | |||||
] | ] | ||||
); | ); | ||||
} | } | ||||
'entityClass' => $context->getEntity()->getFqcn(), | 'entityClass' => $context->getEntity()->getFqcn(), | ||||
'entityId' => $context->getEntity()->getInstance()->getId(), | 'entityId' => $context->getEntity()->getInstance()->getId(), | ||||
'action' => $context->getRequest()->getUri(), | 'action' => $context->getRequest()->getUri(), | ||||
'attr' => ['id'=> 'duplicate-other-merchant-form'], | |||||
'attr' => ['id' => 'duplicate-other-merchant-form'], | |||||
) | ) | ||||
); | ); | ||||
); | ); | ||||
return new Response(json_encode($response)); | return new Response(json_encode($response)); | ||||
}else{ | |||||
} else { | |||||
throw new \ErrorException('La requête doit être effectué en ajax'); | throw new \ErrorException('La requête doit être effectué en ajax'); | ||||
} | } | ||||
} | } | ||||
'entityClass' => $context->getEntity()->getFqcn(), | 'entityClass' => $context->getEntity()->getFqcn(), | ||||
'entityId' => $context->getEntity()->getInstance()->getId(), | 'entityId' => $context->getEntity()->getInstance()->getId(), | ||||
'action' => $context->getRequest()->getUri(), | 'action' => $context->getRequest()->getUri(), | ||||
'attr' => ['id'=> 'duplicate-other-section-form'], | |||||
'attr' => ['id' => 'duplicate-other-section-form'], | |||||
) | ) | ||||
); | ); | ||||
); | ); | ||||
return new Response(json_encode($response)); | return new Response(json_encode($response)); | ||||
}else{ | |||||
} else { | |||||
throw new \ErrorException('La requête doit être effectué en ajax'); | throw new \ErrorException('La requête doit être effectué en ajax'); | ||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Controller\Config; | namespace Lc\CaracoleBundle\Controller\Config; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\Config\TaxRateContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Config\TaxRateFactory; | use Lc\CaracoleBundle\Factory\Config\TaxRateFactory; | ||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new TaxRateFactory(); | |||||
return $factory->create(); | |||||
return $this->get(TaxRateContainer::class)->getFactory()->create(); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\Config\UnitContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Config\UnitFactory; | use Lc\CaracoleBundle\Factory\Config\UnitFactory; | ||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new UnitFactory(); | |||||
return $factory->create(); | |||||
return $this->get(UnitContainer::class)->getFactory()->create(); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; | use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | ||||
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer; | |||||
use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory; | use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory; | ||||
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | ||||
abstract class CreditHistoryAdminController extends AbstractAdminController | abstract class CreditHistoryAdminController extends AbstractAdminController | ||||
{ | { | ||||
use AdminControllerTrait; | use AdminControllerTrait; | ||||
public function overrideGlobalActions(?ActionCollection $actions): void | public function overrideGlobalActions(?ActionCollection $actions): void | ||||
{ | { | ||||
parent::overrideGlobalActions($actions); | parent::overrideGlobalActions($actions); | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new CreditHistoryFactory(); | |||||
return $factory->create(); | |||||
return $this->get(CreditHistoryContainer::class)->getFactory()->create(); | |||||
} | } | ||||
public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | ||||
protected function getUserMerchant(): UserMerchantInterface | protected function getUserMerchant(): UserMerchantInterface | ||||
{ | { | ||||
$request = $this->get(AdminContextProvider::class)->getContext()->getRequest(); | $request = $this->get(AdminContextProvider::class)->getContext()->getRequest(); | ||||
$userMerchant = $this->get('em')->getRepository(UserMerchantInterface::class)->find( | |||||
return $this->get(UserMerchantContainer::class)->getStore()->getOneById( | |||||
$request->get('userMerchantId') | $request->get('userMerchantId') | ||||
); | ); | ||||
return $userMerchant; | |||||
} | } | ||||
public function configureActions(Actions $actions): Actions | public function configureActions(Actions $actions): Actions | ||||
$translatorAdmin = $this->get('translator_admin'); | $translatorAdmin = $this->get('translator_admin'); | ||||
return [ | return [ | ||||
IdField::new('id')->hideOnForm(), | IdField::new('id')->hideOnForm(), | ||||
// @TODO : transChoices | |||||
ChoiceField::new('type')->setChoices( | ChoiceField::new('type')->setChoices( | ||||
array( | array( | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'typeOptions.'.CreditHistoryModel::TYPE_CREDIT, | |||||
'typeOptions.' . CreditHistoryModel::TYPE_CREDIT, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::TYPE_CREDIT, | ) => CreditHistoryModel::TYPE_CREDIT, | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'typeOptions.'.CreditHistoryModel::TYPE_DEBIT, | |||||
'typeOptions.' . CreditHistoryModel::TYPE_DEBIT, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::TYPE_DEBIT, | ) => CreditHistoryModel::TYPE_DEBIT, | ||||
) | ) | ||||
), | ), | ||||
MoneyField::new('amount')->setCurrency('EUR'), | MoneyField::new('amount')->setCurrency('EUR'), | ||||
DateField::new('paidAt'), | DateField::new('paidAt'), | ||||
// @TODO : transChoices | |||||
ChoiceField::new('meanPayment')->setChoices( | ChoiceField::new('meanPayment')->setChoices( | ||||
array( | array( | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH, | |||||
'meanPaymentOptions.' . CreditHistoryModel::MEAN_PAYMENT_CASH, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CASH, | ) => CreditHistoryModel::MEAN_PAYMENT_CASH, | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | |||||
'meanPaymentOptions.' . CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | ) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT, | |||||
'meanPaymentOptions.' . CreditHistoryModel::MEAN_PAYMENT_CREDIT, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, | ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | |||||
'meanPaymentOptions.' . CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | ||||
$translatorAdmin->transField( | $translatorAdmin->transField( | ||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | |||||
'meanPaymentOptions.' . CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | |||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | ) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | ||||
) | ) | ||||
FieldCollection $fields, | FieldCollection $fields, | ||||
FilterCollection $filters | FilterCollection $filters | ||||
): QueryBuilder { | ): QueryBuilder { | ||||
$queryBuilder = parent::createIndexQueryBuilder( | $queryBuilder = parent::createIndexQueryBuilder( | ||||
$searchDto, | $searchDto, | ||||
$entityDto, | $entityDto, |
/** | /** | ||||
* @Route("/merchant/favorite", name="carac_merchant_favorite") | * @Route("/merchant/favorite", name="carac_merchant_favorite") | ||||
*/ | */ | ||||
public function favoriteMerchant(Request $request, Security $security, EntityManagerInterface $em) | |||||
public function favoriteMerchant(Request $request, Security $security, EntityManagerInterface $entityManager) | |||||
{ | { | ||||
$user = $security->getUser() ; | $user = $security->getUser() ; | ||||
if ($merchant) { | if ($merchant) { | ||||
$user->setFavoriteMerchant($merchant) ; | $user->setFavoriteMerchant($merchant) ; | ||||
$em->update($user) ; | |||||
$em->flush() ; | |||||
$entityManager->update($user) ; | |||||
$entityManager->flush() ; | |||||
// @TODO : à fignoler, hein gamin ? | |||||
$url = $merchant->getSettingValue(MerchantSettingDefinition::SETTING_URL).'admin'; | $url = $merchant->getSettingValue(MerchantSettingDefinition::SETTING_URL).'admin'; | ||||
if ($url) { | if ($url) { |
namespace Lc\CaracoleBundle\Controller\Merchant; | namespace Lc\CaracoleBundle\Controller\Merchant; | ||||
use App\Entity\Merchant\Merchant; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Merchant\MerchantFactory; | use Lc\CaracoleBundle\Factory\Merchant\MerchantFactory; | ||||
use Lc\CaracoleBundle\Field\Address\AddressField; | use Lc\CaracoleBundle\Field\Address\AddressField; | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new MerchantFactory(); | |||||
return $factory->create(); | |||||
return $this->get(MerchantContainer::class)->getFactory()->create(); | |||||
} | } | ||||
} | } |
/** | /** | ||||
* @Route("/merchant/switch", name="carac_merchant_switch") | * @Route("/merchant/switch", name="carac_merchant_switch") | ||||
*/ | */ | ||||
public function switchMerchant(Request $request, MerchantRepository $merchantRepository) | |||||
public function switchMerchant(Request $request) | |||||
{ | { | ||||
$form = $this->createForm(SwitchMerchantFormType::class); | $form = $this->createForm(SwitchMerchantFormType::class); | ||||
$form->handleRequest($request); | $form->handleRequest($request); | ||||
} | } | ||||
} | } | ||||
public function visitMerchant() | |||||
{ | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Newsletter\NewsletterFactory; | use Lc\CaracoleBundle\Factory\Newsletter\NewsletterFactory; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Container\Newsletter\NewsletterContainer; | |||||
use Lc\SovBundle\Controller\Newsletter\NewsletterAdminController as SovNewsletterAdminController; | use Lc\SovBundle\Controller\Newsletter\NewsletterAdminController as SovNewsletterAdminController; | ||||
abstract class NewsletterAdminController extends SovNewsletterAdminController | abstract class NewsletterAdminController extends SovNewsletterAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new NewsletterFactory(); | |||||
$factory->setMerchant($this->get('merchant_resolver')->getCurrent()); | |||||
return $factory->create(); | |||||
return $this->get(NewsletterContainer::class) | |||||
->getFactory() | |||||
->setMerchant($this->get(MerchantResolver::class)->getCurrent()) | |||||
->create(); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory; | use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory; | ||||
use Lc\CaracoleBundle\Field\Address\AddressField; | use Lc\CaracoleBundle\Field\Address\AddressField; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
use Lc\SovBundle\Field\BooleanField; | use Lc\SovBundle\Field\BooleanField; | ||||
use Lc\SovBundle\Field\StatusField; | use Lc\SovBundle\Field\StatusField; | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new PointSaleFactory(); | |||||
$currentMerchant = $this->get('merchant_resolver')->getCurrent(); | |||||
return $factory->create($currentMerchant); | |||||
return $this->get(PointSaleContainer::class) | |||||
->getFactory() | |||||
->create($this->get(MerchantResolver::class)->getCurrent()); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Field\Address\AddressField; | use Lc\CaracoleBundle\Field\Address\AddressField; | ||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogStore; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
use Lc\SovBundle\Field\BooleanField; | use Lc\SovBundle\Field\BooleanField; | ||||
use Lc\SovBundle\Field\CKEditorField; | use Lc\SovBundle\Field\CKEditorField; | ||||
use Lc\SovBundle\Field\StatusField; | use Lc\SovBundle\Field\StatusField; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
abstract class ProductCategoryAdminController extends AbstractAdminController | abstract class ProductCategoryAdminController extends AbstractAdminController | ||||
{ | { |
{ | { | ||||
use AdminControllerTrait; | use AdminControllerTrait; | ||||
} | } |
namespace Lc\CaracoleBundle\Controller\Reminder; | namespace Lc\CaracoleBundle\Controller\Reminder; | ||||
use App\Entity\Reminder\Reminder; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Reminder\ReminderFactory; | use Lc\CaracoleBundle\Factory\Reminder\ReminderFactory; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||||
use Lc\SovBundle\Container\Reminder\ReminderContainer; | |||||
use Lc\SovBundle\Controller\Reminder\ReminderAdminController as SovReminderAdminController; | use Lc\SovBundle\Controller\Reminder\ReminderAdminController as SovReminderAdminController; | ||||
class ReminderAdminController extends SovReminderAdminController | class ReminderAdminController extends SovReminderAdminController | ||||
public function createEntity(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null) | public function createEntity(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null) | ||||
{ | { | ||||
$factory = new ReminderFactory(); | |||||
return $factory | |||||
->setMerchant($this->get('merchant_resolver')->getCurrent()) | |||||
->setSection($this->get('section_resolver')->getCurrent()) | |||||
return $this->get(ReminderContainer::class) | |||||
->getFactory() | |||||
->setMerchant($this->get(MerchantResolver::class)->getCurrent()) | |||||
->setSection($this->get(SectionResolver::class)->getCurrent()) | |||||
->create($crudAction, $crudControllerFqcn, $entityId); | ->create($crudAction, $crudControllerFqcn, $entityId); | ||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TimeField; | ||||
use Lc\CaracoleBundle\Container\Section\OpeningContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Section\OpeningFactory; | use Lc\CaracoleBundle\Factory\Section\OpeningFactory; | ||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
abstract class OpeningAdminController extends AbstractAdminController | abstract class OpeningAdminController extends AbstractAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new OpeningFactory(); | |||||
$currentSection = $this->get('section_resolver')->getCurrent(); | |||||
return $factory->create($currentSection); | |||||
return $this->get(OpeningContainer::class) | |||||
->getFactory() | |||||
->create($this->get(SectionResolver::class)->getCurrent()); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\CaracoleBundle\Container\Section\SectionContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Section\SectionFactory; | use Lc\CaracoleBundle\Factory\Section\SectionFactory; | ||||
use Lc\CaracoleBundle\Form\Section\OpeningsFormType; | use Lc\CaracoleBundle\Form\Section\OpeningsFormType; | ||||
use Lc\CaracoleBundle\Model\Section\SectionModel; | use Lc\CaracoleBundle\Model\Section\SectionModel; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
use Lc\SovBundle\Field\BooleanField; | use Lc\SovBundle\Field\BooleanField; | ||||
use Lc\SovBundle\Field\CKEditorField; | use Lc\SovBundle\Field\CKEditorField; | ||||
use Lc\SovBundle\Field\StatusField; | use Lc\SovBundle\Field\StatusField; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\HttpFoundation\Session\SessionFactory; | |||||
use Symfony\Component\Routing\Annotation\Route; | use Symfony\Component\Routing\Annotation\Route; | ||||
abstract class SectionAdminController extends AbstractAdminController | abstract class SectionAdminController extends AbstractAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new SectionFactory(); | |||||
$currentMerchant = $this->get('merchant_resolver')->getCurrent(); | |||||
return $factory->create($currentMerchant); | |||||
return $this->get(SectionContainer::class) | |||||
->getFactory() | |||||
->create($this->get(MerchantResolver::class)->getCurrent()); | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Controller\Section; | namespace Lc\CaracoleBundle\Controller\Section; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\CaracoleBundle\Container\Section\SectionContainer; | |||||
use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType; | use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | use Lc\CaracoleBundle\Repository\Section\SectionRepository; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
*/ | */ | ||||
public function switchSection( | public function switchSection( | ||||
Request $request, | Request $request, | ||||
EntityManagerInterface $em, | |||||
EntityManagerInterface $entityManager, | |||||
MerchantResolver $merchantResolver, | MerchantResolver $merchantResolver, | ||||
SectionRepository $sectionRepository | |||||
SectionContainer $sectionContainer | |||||
) { | ) { | ||||
$form = $this->createForm(SwitchSectionFormType::class); | $form = $this->createForm(SwitchSectionFormType::class); | ||||
$form->handleRequest($request); | $form->handleRequest($request); | ||||
if ($form->isSubmitted() && $form->isValid()) { | if ($form->isSubmitted() && $form->isValid()) { | ||||
$idSection = $form->get('id_section')->getData(); | $idSection = $form->get('id_section')->getData(); | ||||
$section = $sectionRepository->find($idSection); | |||||
$section = $sectionContainer->getStore()->getOneById($idSection); | |||||
$userMerchant = $merchantResolver->getUserMerchant(); | $userMerchant = $merchantResolver->getUserMerchant(); | ||||
if ($section && $userMerchant) { | if ($section && $userMerchant) { | ||||
$userMerchant->setCurrentAdminSection($section); | $userMerchant->setCurrentAdminSection($section); | ||||
$em->update($section); | |||||
$em->flush(); | |||||
$entityManager->update($section); | |||||
$entityManager->flush(); | |||||
} | } | ||||
} | } | ||||
namespace Lc\CaracoleBundle\Controller\Setting; | namespace Lc\CaracoleBundle\Controller\Setting; | ||||
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | |||||
use Lc\CaracoleBundle\Container\Section\SectionContainer; | |||||
use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer; | |||||
use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer; | |||||
use Lc\SovBundle\Container\Setting\SiteSettingContainer; | |||||
use Lc\SovBundle\Container\Site\SiteContainer; | |||||
use Lc\SovBundle\Controller\Setting\SettingAdminController as SovSettingController; | use Lc\SovBundle\Controller\Setting\SettingAdminController as SovSettingController; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface; | use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface; | ||||
class SettingAdminController extends SovSettingController | class SettingAdminController extends SovSettingController | ||||
{ | { | ||||
protected $em; | |||||
protected $translatorAdmin; | |||||
protected $merchantResolver; | |||||
protected $merchantSettingDefinition; | |||||
protected $sectionResolver; | |||||
protected $sectionSettingDefinition; | |||||
protected $siteSettingDefinition; | |||||
protected $siteRepository; | |||||
public function __construct( | |||||
EntityManagerInterface $em, | |||||
TranslatorAdmin $translatorAdmin, | |||||
MerchantResolver $merchantResolver, | |||||
SectionResolver $sectionResolver, | |||||
MerchantSettingDefinitionInterface $merchantSettingDefinition, | |||||
SectionSettingDefinitionInterface $sectionSettingDefinition, | |||||
SiteSettingDefinition $siteSettingDefinition, | |||||
SiteRepository $siteRepository | |||||
) { | |||||
$this->em = $em; | |||||
$this->translatorAdmin = $translatorAdmin; | |||||
$this->merchantResolver = $merchantResolver; | |||||
$this->sectionResolver = $sectionResolver; | |||||
$this->merchantSettingDefinition = $merchantSettingDefinition; | |||||
$this->sectionSettingDefinition = $sectionSettingDefinition; | |||||
$this->siteSettingDefinition = $siteSettingDefinition; | |||||
$this->siteRepository = $siteRepository; | |||||
} | |||||
/** | /** | ||||
* @Route("/admin/setting/merchant", name="carac_admin_setting_merchant") | * @Route("/admin/setting/merchant", name="carac_admin_setting_merchant") | ||||
*/ | */ | ||||
public function manageMerchant(Request $request) | |||||
{ | |||||
public function manageMerchant( | |||||
Request $request | |||||
) { | |||||
return $this->manage($request, 'merchant'); | return $this->manage($request, 'merchant'); | ||||
} | } | ||||
/** | /** | ||||
* @Route("/admin/setting/section", name="carac_admin_setting_section") | * @Route("/admin/setting/section", name="carac_admin_setting_section") | ||||
*/ | */ | ||||
public function manageSection(Request $request) | |||||
{ | |||||
public function manageSection( | |||||
Request $request | |||||
) { | |||||
return $this->manage($request, 'section'); | return $this->manage($request, 'section'); | ||||
} | } | ||||
public function manage(Request $request, $type) | |||||
{ | |||||
public function manage( | |||||
Request $request, | |||||
$type | |||||
) { | |||||
$entity = null; | $entity = null; | ||||
$entityManager = $this->get(EntityManagerInterface::class); | |||||
if ($type == 'merchant') { | if ($type == 'merchant') { | ||||
$resolver = $this->merchantResolver; | |||||
$resolver = $this->get(MerchantContainer::class)->getResolver(); | |||||
$formClass = MerchantSettingsFormType::class; | $formClass = MerchantSettingsFormType::class; | ||||
$settingDefinition = $this->merchantSettingDefinition; | |||||
$settingDefinition = $this->get(MerchantSettingContainer::class)->getDefinition(); | |||||
} elseif ($type == 'section') { | } elseif ($type == 'section') { | ||||
$resolver = $this->sectionResolver; | |||||
$resolver = $this->get(SectionContainer::class)->getResolver(); | |||||
$formClass = SectionSettingsFormType::class; | $formClass = SectionSettingsFormType::class; | ||||
$settingDefinition = $this->sectionSettingDefinition; | |||||
$settingDefinition = $this->get(SectionSettingContainer::class)->getDefinition(); | |||||
} | } | ||||
$entity = $resolver->getCurrent(); | $entity = $resolver->getCurrent(); | ||||
$form->handleRequest($request); | $form->handleRequest($request); | ||||
if ($form->isSubmitted() && $form->isValid()) { | if ($form->isSubmitted() && $form->isValid()) { | ||||
$this->em->update($entity); | |||||
$this->em->flush(); | |||||
$entityManager->update($entity); | |||||
$entityManager->flush(); | |||||
$this->addFlash('success', $this->translatorAdmin->transFlashMessage('settings_saved')); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->transFlashMessage('settings_saved')); | |||||
} | } | ||||
return $this->render( | return $this->render( | ||||
/** | /** | ||||
* @Route("/admin/setting/site2", name="carac_admin_setting_site") | * @Route("/admin/setting/site2", name="carac_admin_setting_site") | ||||
*/ | */ | ||||
public function manageGlobal(Request $request) | |||||
public function manageGlobal(Request $request, EntityManagerInterface $entityManager) | |||||
{ | { | ||||
$site = $this->siteRepository->findOneByDevAlias('default'); | |||||
$site = $this->get(SiteContainer::class)->getStore()->getOneByDevAlias('default'); | |||||
$form = $this->createForm(SiteSettingsFormType::class, $site); | $form = $this->createForm(SiteSettingsFormType::class, $site); | ||||
$form->handleRequest($request); | $form->handleRequest($request); | ||||
if ($form->isSubmitted() && $form->isValid()) { | if ($form->isSubmitted() && $form->isValid()) { | ||||
$this->em->update($site); | |||||
$this->em->flush(); | |||||
$entityManager->update($site); | |||||
$entityManager->flush(); | |||||
$this->addFlash('success', $this->translatorAdmin->transFlashMessage('settings_saved')); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->transFlashMessage('settings_saved')); | |||||
} | } | ||||
return $this->render( | return $this->render( |
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Site\NewsFactory; | use Lc\CaracoleBundle\Factory\Site\NewsFactory; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Container\Site\NewsContainer; | |||||
use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController; | use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController; | ||||
abstract class NewsAdminController extends SovNewsAdminController | abstract class NewsAdminController extends SovNewsAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new NewsFactory(); | |||||
$currentMerchant = $this->get('merchant_resolver')->getCurrent(); | |||||
$factory->setMerchant($currentMerchant); | |||||
return $factory->create(); | |||||
return $this->get(NewsContainer::class) | |||||
->getFactory() | |||||
->setMerchant($this->get(MerchantResolver::class)->getCurrent()) | |||||
->create(); | |||||
} | } | ||||
} | } |
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\Site\PageFactory; | use Lc\CaracoleBundle\Factory\Site\PageFactory; | ||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||||
use Lc\SovBundle\Container\Site\PageContainer; | |||||
use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController; | use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController; | ||||
abstract class PageAdminController extends SovPageAdminController | abstract class PageAdminController extends SovPageAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new PageFactory(); | |||||
$currentSection = $this->get('section_resolver')->getCurrent(); | |||||
$factory->setSection($currentSection); | |||||
return $factory->create(); | |||||
return $this->get(PageContainer::class) | |||||
->getFactory() | |||||
->setSection($this->get(SectionResolver::class)->getCurrent()) | |||||
->create(); | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Controller\Ticket; | namespace Lc\CaracoleBundle\Controller\Ticket; | ||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Container\Ticket\TicketContainer; | |||||
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController; | use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController; | ||||
use Lc\CaracoleBundle\Factory\Ticket\TicketFactory; | use Lc\CaracoleBundle\Factory\Ticket\TicketFactory; | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$merchantResolver = $this->get('merchant_resolver'); | |||||
$factory = new TicketFactory(); | |||||
$factory->setMerchant($merchantResolver->getCurrent()); | |||||
return $factory->create(); | |||||
return $this->get(TicketContainer::class) | |||||
->getFactory() | |||||
->setMerchant($this->get(MerchantResolver::class)->getCurrent()) | |||||
->create(); | |||||
} | } | ||||
} | } |
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\User\GroupUserFactory; | use Lc\CaracoleBundle\Factory\User\GroupUserFactory; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Container\User\GroupUserContainer; | |||||
use Lc\SovBundle\Controller\User\GroupUserAdminController as SovGroupUserAdminController; | use Lc\SovBundle\Controller\User\GroupUserAdminController as SovGroupUserAdminController; | ||||
abstract class GroupUserAdminController extends SovGroupUserAdminController | abstract class GroupUserAdminController extends SovGroupUserAdminController | ||||
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new GroupUserFactory(); | |||||
$currentMerchant = $this->get('merchant_resolver')->getCurrent(); | |||||
$factory->setMerchant($currentMerchant); | |||||
return $factory->create(); | |||||
return $this->get(GroupUserContainer::class) | |||||
->getFactory() | |||||
->setMerchant($this->get(MerchantResolver::class)->getCurrent()) | |||||
->create(); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; | use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; | use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; | ||||
use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\CaracoleBundle\Factory\User\UserFactory; | |||||
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory; | |||||
use Lc\CaracoleBundle\Form\Credit\CreditHistoryFormType; | use Lc\CaracoleBundle\Form\Credit\CreditHistoryFormType; | ||||
use Lc\CaracoleBundle\Form\User\UserMerchantFormType; | use Lc\CaracoleBundle\Form\User\UserMerchantFormType; | ||||
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Container\User\UserContainer; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
use Lc\SovBundle\Field\BooleanField; | use Lc\SovBundle\Field\BooleanField; | ||||
use Lc\SovBundle\Field\ToggleField; | use Lc\SovBundle\Field\ToggleField; | ||||
{ | { | ||||
use AdminControllerTrait; | use AdminControllerTrait; | ||||
protected $em; | |||||
protected $translatorAdmin; | |||||
public function __construct(EntityManagerInterface $entityManager, TranslatorAdmin $translatorAdmin) | |||||
{ | |||||
$this->em = $entityManager; | |||||
$this->translatorAdmin = $translatorAdmin; | |||||
} | |||||
public function overrideEntitiesActions(?EntityCollection $entities): void | public function overrideEntitiesActions(?EntityCollection $entities): void | ||||
{ | { | ||||
$adminUrlGenerator = $this->get(AdminUrlGenerator::class); | $adminUrlGenerator = $this->get(AdminUrlGenerator::class); | ||||
$creditControllerFqcn = $context->getCrudControllers()->findCrudFqcnByEntityFqcn( | $creditControllerFqcn = $context->getCrudControllers()->findCrudFqcnByEntityFqcn( | ||||
$this->em->getEntityName(CreditHistoryInterface::class) | |||||
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class) | |||||
); | ); | ||||
if ($entities) { | if ($entities) { | ||||
foreach ($entities as $entity) { | foreach ($entities as $entity) { | ||||
foreach ($entity->getActions() as $action) { | foreach ($entity->getActions() as $action) { | ||||
if ($action->getName() == 'credit_history') { | if ($action->getName() == 'credit_history') { | ||||
$url = $adminUrlGenerator | $url = $adminUrlGenerator | ||||
->setController($creditControllerFqcn) | ->setController($creditControllerFqcn) | ||||
->setHtmlAttributes( | ->setHtmlAttributes( | ||||
array( | array( | ||||
'data-toggle' => 'tooltip', | 'data-toggle' => 'tooltip', | ||||
'title' => $this->translatorAdmin->transAction('credit'), | |||||
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'), | |||||
) | ) | ||||
) | ) | ||||
->setCssClass('btn btn-sm btn-success'); | ->setCssClass('btn btn-sm btn-success'); | ||||
public function configureFilters(Filters $filters): Filters | public function configureFilters(Filters $filters): Filters | ||||
{ | { | ||||
return $filters | return $filters | ||||
->add(BooleanFilter::new('active')) | |||||
; | |||||
->add(BooleanFilter::new('active')); | |||||
} | } | ||||
public function new(AdminContext $context): Response | public function new(AdminContext $context): Response | ||||
{ | { | ||||
$entityManager = $this->get('em'); | |||||
$userFactory = $this->get('user_factory'); | |||||
$userMerchantFactory = $this->get('user_merchant_factory'); | |||||
$userRepository = $entityManager->getRepository(UserInterface::class); | |||||
$merchantResolver = $this->get('merchant_resolver'); | |||||
$userMerchant = $userMerchantFactory->create(); | |||||
$entityManager = $this->get(EntityManagerInterface::class); | |||||
$merchantResolver = $this->get(MerchantResolver::class); | |||||
$userMerchant = $this->get(UserMerchantContainer::class) | |||||
->getFactory() | |||||
->create($merchantResolver->getCurrent()); | |||||
$form = $this->createForm(UserMerchantFormType::class, $userMerchant); | $form = $this->createForm(UserMerchantFormType::class, $userMerchant); | ||||
if ($form->isSubmitted() && $form->isValid()) { | if ($form->isSubmitted() && $form->isValid()) { | ||||
$userMerchant = $form->getData(); | $userMerchant = $form->getData(); | ||||
$existingUser = $userRepository->findOneByEmail($form->get('email')->getData()); | |||||
$existingUser = $this->get(UserContainer::class)->getStore()->getOneByEmail($form->get('email')->getData()); | |||||
//Le user n'existe pas, on le créer | //Le user n'existe pas, on le créer | ||||
if ($existingUser == null) { | if ($existingUser == null) { | ||||
$param['email'] = $form->get('email')->getData(); | $param['email'] = $form->get('email')->getData(); | ||||
$param['lastname'] = $form->get('firstname')->getData(); | $param['lastname'] = $form->get('firstname')->getData(); | ||||
$param['roles'] = array(); | $param['roles'] = array(); | ||||
// @TODO : à adapter l'array de valeur passer au factory | |||||
$userFactory = new UserFactory(); | |||||
$user = $userFactory->create($param); | $user = $userFactory->create($param); | ||||
$entityManager->create($user); | $entityManager->create($user); | ||||
$userMerchant->setUser($user); | $userMerchant->setUser($user); | ||||
$entityManager->create($userMerchant); | $entityManager->create($userMerchant); | ||||
$entityManager->flush(); | $entityManager->flush(); | ||||
$this->addFlash('success', $this->get('translator_admin')->trans('form.user_merchant.create')); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.create')); | |||||
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | $url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | ||||
return $this->redirect($url); | return $this->redirect($url); | ||||
$entityManager->create($userMerchant); | $entityManager->create($userMerchant); | ||||
$entityManager->flush(); | $entityManager->flush(); | ||||
$this->addFlash('success', $this->get('translator_admin')->trans('form.user_merchant.linked')); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.linked')); | |||||
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | $url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | ||||
return $this->redirect($url); | return $this->redirect($url); | ||||
} else { | } else { | ||||
$this->addFlash('error', $this->get('translator_admin')->trans('form.user_merchant.already_exist')); | |||||
$this->addFlash('error', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.already_exist')); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public function edit(AdminContext $context): Response | public function edit(AdminContext $context): Response | ||||
{ | { | ||||
$entityManager = $this->get('em'); | |||||
$userRepository = $entityManager->getRepository(UserInterface::class); | |||||
$merchantResolver = $this->get('merchant_resolver'); | |||||
$entityManager = $this->get(EntityManagerInterface::class); | |||||
$userMerchant = $context->getEntity()->getInstance(); | $userMerchant = $context->getEntity()->getInstance(); | ||||
$entityManager->update($userMerchant); | $entityManager->update($userMerchant); | ||||
$entityManager->update($userMerchant->getUser()); | $entityManager->update($userMerchant->getUser()); | ||||
$entityManager->flush(); | $entityManager->flush(); | ||||
$this->addFlash('success', $this->get('translator_admin')->trans('form.user_merchant.update')); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.update')); | |||||
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | $url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(); | ||||
return $this->redirect($url); | return $this->redirect($url); |
*/ | */ | ||||
protected $comment; | protected $comment; | ||||
public function setMeanPayment(?string $meanPayment): self | public function setMeanPayment(?string $meanPayment): self | ||||
{ | { | ||||
$this->meanPayment = $meanPayment; | $this->meanPayment = $meanPayment; | ||||
return $this->meanPayment; | return $this->meanPayment; | ||||
} | } | ||||
public function getReference(): ?string | public function getReference(): ?string | ||||
{ | { | ||||
return $this->reference; | return $this->reference; |
*/ | */ | ||||
protected $taxRate; | protected $taxRate; | ||||
/** | /** | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
*/ | */ | ||||
protected $buyingPrice; | protected $buyingPrice; | ||||
public function getPriceInherited(): ?float | public function getPriceInherited(): ?float | ||||
{ | { | ||||
return $this->getPrice(); | return $this->getPrice(); |
return $this; | return $this; | ||||
} | } | ||||
public function getQuantity(): ?float | public function getQuantity(): ?float | ||||
{ | { | ||||
return $this->quantity; | return $this->quantity; |
trait ReductionTrait | trait ReductionTrait | ||||
{ | { | ||||
/** | /** | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $behaviorTaxRate; | protected $behaviorTaxRate; | ||||
public function getValue(): ?float | public function getValue(): ?float | ||||
{ | { | ||||
return $this->value; | return $this->value; |
namespace Lc\CaracoleBundle\Factory\Address; | namespace Lc\CaracoleBundle\Factory\Address; | ||||
use App\Entity\Address\Address; | use App\Entity\Address\Address; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
class AddressFactory extends AbstractFactory | class AddressFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant = null): AddressInterface | |||||
public function create(MerchantInterface $merchant): AddressInterface | |||||
{ | { | ||||
$address = new Address(); | $address = new Address(); | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | use Lc\CaracoleBundle\Model\File\DocumentInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
class DocumentFactory extends AbstractFactory | class DocumentFactory extends AbstractFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
public function create(string $type): DocumentInterface | |||||
public function create(SectionInterface $section, string $type): DocumentInterface | |||||
{ | { | ||||
$document = new Document(); | $document = new Document(); | ||||
$document->setMerchant($this->merchant); | |||||
$document->setSection($section); | |||||
$document->setType($type); | $document->setType($type); | ||||
$document->setTitle(''); | $document->setTitle(''); | ||||
$document->setStatus(1); | $document->setStatus(1); | ||||
return $document; | return $document; | ||||
} | } | ||||
} | |||||
} |
trait MerchantFactoryTrait | trait MerchantFactoryTrait | ||||
{ | { | ||||
public ?MerchantInterface $merchant = null; | |||||
protected MerchantInterface $merchant; | |||||
public function setMerchant(MerchantInterface $merchant) | public function setMerchant(MerchantInterface $merchant) | ||||
{ | { | ||||
return $this; | return $this; | ||||
} | } | ||||
} | } |
use App\Entity\Order\OrderShop; | use App\Entity\Order\OrderShop; | ||||
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; | use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | ||||
class OrderShopFactory extends AbstractFactory | class OrderShopFactory extends AbstractFactory | ||||
{ | { | ||||
protected EventDispatcherInterface $eventDispatcher; | |||||
protected OrderStatusHistoryFactory $orderStatusHistoryFactory; | |||||
public function __construct( | |||||
EventDispatcherInterface $eventDispatcher, | |||||
OrderStatusHistoryFactory $orderStatusHistoryFactory | |||||
) { | |||||
$this->eventDispatcher = $eventDispatcher; | |||||
$this->orderStatusHistoryFactory = $orderStatusHistoryFactory; | |||||
} | |||||
public function create( | public function create( | ||||
SectionInterface $section, | SectionInterface $section, |
namespace Lc\CaracoleBundle\Factory\PointSale; | namespace Lc\CaracoleBundle\Factory\PointSale; | ||||
use App\Entity\PointSale\PointSale; | use App\Entity\PointSale\PointSale; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
namespace Lc\CaracoleBundle\Factory\Product; | namespace Lc\CaracoleBundle\Factory\Product; | ||||
use App\Entity\Product\ProductCategory; | use App\Entity\Product\ProductCategory; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
class ProductCategoryFactory extends AbstractFactory | class ProductCategoryFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant, SectionInterface $section): ProductCategoryInterface | |||||
public function create(SectionInterface $section): ProductCategoryInterface | |||||
{ | { | ||||
$productCategory = new ProductCategory(); | $productCategory = new ProductCategory(); | ||||
$productCategory->setMerchant($merchant); | |||||
$productCategory->setSection($section); | $productCategory->setSection($section); | ||||
return $productCategory; | return $productCategory; |
class ProductFamilyFactory extends AbstractFactory | class ProductFamilyFactory extends AbstractFactory | ||||
{ | { | ||||
use SectionFactoryTrait; | |||||
public function create(SectionInterface $section = null): ProductFamilyInterface | |||||
public function create(SectionInterface $section): ProductFamilyInterface | |||||
{ | { | ||||
$productFamily = new ProductFamily(); | $productFamily = new ProductFamily(); | ||||
if(is_null($section)) { | |||||
$productFamily->setSection($this->section); | |||||
}else{ | |||||
$productFamily->setSection($section); | |||||
} | |||||
$productFamily->setSection($section); | |||||
return $productFamily; | return $productFamily; | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCart; | use App\Entity\Reduction\ReductionCart; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
class ReductionCartFactory extends AbstractFactory | class ReductionCartFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant): ReductionCartInterface | |||||
public function create(SectionInterface $section): ReductionCartInterface | |||||
{ | { | ||||
$reductionCart = new ReductionCart(); | $reductionCart = new ReductionCart(); | ||||
$reductionCart->setMerchant($merchant); | |||||
$reductionCart->setSection($section); | |||||
return $reductionCart; | return $reductionCart; | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCatalog; | use App\Entity\Reduction\ReductionCatalog; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
class ReductionCatalogFactory extends AbstractFactory | class ReductionCatalogFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant): ReductionCatalogInterface | |||||
public function create(SectionInterface $section): ReductionCatalogInterface | |||||
{ | { | ||||
$reductionCatalog = new ReductionCatalog(); | $reductionCatalog = new ReductionCatalog(); | ||||
$reductionCatalog->setMerchant($merchant); | |||||
$reductionCatalog->setSection($section); | |||||
return $reductionCatalog; | return $reductionCatalog; | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Reduction; | namespace Lc\CaracoleBundle\Factory\Reduction; | ||||
use App\Entity\Reduction\ReductionCredit; | use App\Entity\Reduction\ReductionCredit; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
class ReductionCreditFactory extends AbstractFactory | class ReductionCreditFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant): ReductionCreditInterface | |||||
public function create(SectionInterface $section): ReductionCreditInterface | |||||
{ | { | ||||
$reductionCredit = new ReductionCredit(); | $reductionCredit = new ReductionCredit(); | ||||
$reductionCredit->setMerchant($merchant); | |||||
$reductionCredit->setSection($section); | |||||
return $reductionCredit; | return $reductionCredit; | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Reminder; | namespace Lc\CaracoleBundle\Factory\Reminder; | ||||
use App\Entity\Merchant\Merchant; | |||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\Reminder\ReminderFactory as SovReminderFactory; | use Lc\SovBundle\Factory\Reminder\ReminderFactory as SovReminderFactory; | ||||
use Lc\SovBundle\Model\Reminder\ReminderInterface; | use Lc\SovBundle\Model\Reminder\ReminderInterface; | ||||
use MerchantFactoryTrait; | use MerchantFactoryTrait; | ||||
use SectionFactoryTrait; | use SectionFactoryTrait; | ||||
public function create(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null): ReminderInterface | |||||
{ | |||||
public function create( | |||||
string $crudAction = null, | |||||
string $crudControllerFqcn = null, | |||||
int $entityId = null | |||||
): ReminderInterface { | |||||
$reminder = parent::create($crudAction, $crudControllerFqcn, $entityId); | $reminder = parent::create($crudAction, $crudControllerFqcn, $entityId); | ||||
$reminder->setMerchant($this->merchant) ; | |||||
$reminder->setSection($this->section) ; | |||||
$reminder->setMerchant($this->merchant); | |||||
$reminder->setSection($this->section); | |||||
return $reminder; | return $reminder; | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Section; | namespace Lc\CaracoleBundle\Factory\Section; | ||||
use App\Entity\Section\Opening; | use App\Entity\Section\Opening; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; | ||||
use Lc\SovBundle\Model\User\GroupUserInterface; | use Lc\SovBundle\Model\User\GroupUserInterface; | ||||
public function create( | public function create( | ||||
SectionInterface $section, | SectionInterface $section, | ||||
int $day, | |||||
int $day = null, | |||||
\DateTime $timeStart = null, | \DateTime $timeStart = null, | ||||
\DateTime $timeEnd = null, | \DateTime $timeEnd = null, | ||||
GroupUserInterface $groupUser = null | GroupUserInterface $groupUser = null |
namespace Lc\CaracoleBundle\Factory\Section; | namespace Lc\CaracoleBundle\Factory\Section; | ||||
use App\Entity\Section\Section; | use App\Entity\Section\Section; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Factory\AbstractFactory; | use Lc\SovBundle\Factory\AbstractFactory; |
trait SectionFactoryTrait | trait SectionFactoryTrait | ||||
{ | { | ||||
public ?SectionInterface $section = null; | |||||
protected SectionInterface $section; | |||||
public function setSection(SectionInterface $section) | public function setSection(SectionInterface $section) | ||||
{ | { | ||||
return $this; | return $this; | ||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Factory\Site; | namespace Lc\CaracoleBundle\Factory\Site; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\SovBundle\Factory\Site\NewsFactory as SovNewsFactory; | use Lc\SovBundle\Factory\Site\NewsFactory as SovNewsFactory; | ||||
use Lc\SovBundle\Model\Site\NewsInterface; | use Lc\SovBundle\Model\Site\NewsInterface; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\Site\PageFactory as SovPageFactory; | use Lc\SovBundle\Factory\Site\PageFactory as SovPageFactory; | ||||
use Lc\SovBundle\Model\Site\PageInterface; | use Lc\SovBundle\Model\Site\PageInterface; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\SovBundle\Factory\Ticket\TicketFactory as SovTicketFactory; | use Lc\SovBundle\Factory\Ticket\TicketFactory as SovTicketFactory; | ||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | use Lc\SovBundle\Model\Ticket\TicketInterface; | ||||
namespace Lc\CaracoleBundle\Factory\User; | namespace Lc\CaracoleBundle\Factory\User; | ||||
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | use Lc\CaracoleBundle\Factory\MerchantFactoryTrait; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\SovBundle\Model\User\GroupUserInterface; | use Lc\SovBundle\Model\User\GroupUserInterface; | ||||
use Lc\SovBundle\Factory\User\GroupUserFactory as SovGroupUserFactory; | use Lc\SovBundle\Factory\User\GroupUserFactory as SovGroupUserFactory; | ||||
class UserMerchantFactory extends AbstractFactory | class UserMerchantFactory extends AbstractFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
// createUserMerchant | // createUserMerchant | ||||
public function create(UserInterface $user): UserMerchantInterface | |||||
public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface | |||||
{ | { | ||||
$userMerchant = new UserMerchant(); | $userMerchant = new UserMerchant(); | ||||
$userMerchant->setMerchant($this->merchant); | |||||
$userMerchant->setMerchant($merchant); | |||||
$userMerchant->setUser($user); | $userMerchant->setUser($user); | ||||
return $userMerchant; | return $userMerchant; |
class VisitorFactory extends AbstractFactory | class VisitorFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(string $cookie, string $ip): VisitorInterface | |||||
public static function create(string $cookie, string $ip): VisitorInterface | |||||
{ | { | ||||
$visitor = new Visitor(); | $visitor = new Visitor(); | ||||
*/ | */ | ||||
protected $phone; | protected $phone; | ||||
/** | |||||
* @ORM\Column(type="string", length=32, nullable=true) | |||||
*/ | |||||
protected $latitude; | |||||
/** | |||||
* @ORM\Column(type="string", length=32, nullable=true) | |||||
*/ | |||||
protected $longitude; | |||||
/** | |||||
* @ORM\Column(type="string", length=32, nullable=true) | |||||
*/ | |||||
protected $latitudeOverride; | |||||
/** | |||||
* @ORM\Column(type="string", length=32, nullable=true) | |||||
*/ | |||||
protected $longitudeOverride; | |||||
/** | /** | ||||
* @ORM\Column(type="text", nullable=true) | * @ORM\Column(type="text", nullable=true) | ||||
*/ | */ | ||||
return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity(); | return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity(); | ||||
} | } | ||||
// getAddressSummary | |||||
public function getSummaryShort() | |||||
{ | |||||
return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity(); | |||||
} | |||||
public function getSummary($withTitle = true) | |||||
{ | |||||
$html = ''; | |||||
if ($this->getTitle() && $withTitle) { | |||||
$html .= $this->getTitle() . '<br />'; | |||||
} | |||||
if ($this->getLastname() || $this->getFirstname()) { | |||||
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />'; | |||||
} | |||||
if ($this->getAddress()) { | |||||
$html .= $this->getAddress() . '<br />'; | |||||
} | |||||
if ($this->getZip() || $this->getCity()) { | |||||
$html .= $this->getZip() . ' ' . $this->getCity() . '<br />'; | |||||
} | |||||
if ($this->getPhone()) { | |||||
foreach ($this->getPhone() as $phone) { | |||||
$html .= 'Tél. ' . $phone . '<br />'; | |||||
} | |||||
} | |||||
return $html; | |||||
} | |||||
public function getUser(): ?UserInterface | public function getUser(): ?UserInterface | ||||
{ | { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getLatitude(): ?string | |||||
{ | |||||
return $this->latitude; | |||||
} | |||||
public function setLatitude(?string $latitude): self | |||||
{ | |||||
$this->latitude = $latitude; | |||||
return $this; | |||||
} | |||||
public function getLongitude(): ?string | |||||
{ | |||||
return $this->longitude; | |||||
} | |||||
public function setLongitude(?string $longitude): self | |||||
{ | |||||
$this->longitude = $longitude; | |||||
return $this; | |||||
} | |||||
public function getLatitudeOverride(): ?string | |||||
{ | |||||
return $this->latitudeOverride; | |||||
} | |||||
public function setLatitudeOverride(?string $latitudeOverride): self | |||||
{ | |||||
$this->latitudeOverride = $latitudeOverride; | |||||
return $this; | |||||
} | |||||
public function getLongitudeOverride(): ?string | |||||
{ | |||||
return $this->longitudeOverride; | |||||
} | |||||
public function setLongitudeOverride(?string $longitudeOverride): self | |||||
{ | |||||
$this->longitudeOverride = $longitudeOverride; | |||||
return $this; | |||||
} | |||||
public function getCompany(): ?string | public function getCompany(): ?string | ||||
{ | { | ||||
return $this->company; | return $this->company; |
use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface; | use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface; | ||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | ||||
/** | /** | ||||
abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffInterface | abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffInterface | ||||
{ | { | ||||
use PayoffTrait; | use PayoffTrait; | ||||
use BlameableNullableTrait; | |||||
const TYPE_CREDIT = 'credit'; | const TYPE_CREDIT = 'credit'; | ||||
const TYPE_DEBIT = 'debit'; | const TYPE_DEBIT = 'debit'; | ||||
const MEAN_PAYMENT_CREDIT_CARD = 'cb'; | const MEAN_PAYMENT_CREDIT_CARD = 'cb'; | ||||
const MEAN_PAYMENT_CHEQUE = 'cheque'; | const MEAN_PAYMENT_CHEQUE = 'cheque'; | ||||
const MEAN_PAYMENT_CREDIT = 'credit'; | const MEAN_PAYMENT_CREDIT = 'credit'; | ||||
const MEAN_PAYMENT_TRANSFER = 'transfer'; | const MEAN_PAYMENT_TRANSFER = 'transfer'; | ||||
const MEAN_PAYMENT_CASH = 'cash'; | const MEAN_PAYMENT_CASH = 'cash'; | ||||
/**$merchant | /**$merchant | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $orderRefund; | protected $orderRefund; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
public function __toString(){ | public function __toString(){ | ||||
//Todo a écrire | //Todo a écrire | ||||
return $this->getType(); | return $this->getType(); |
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderRefundInterface; | use Lc\CaracoleBundle\Model\Order\OrderRefundInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | ||||
/** | /** | ||||
*/ | */ | ||||
abstract class DocumentModel extends AbstractFullEntity implements FilterMerchantInterface | abstract class DocumentModel extends AbstractFullEntity implements FilterMerchantInterface | ||||
{ | { | ||||
use BlameableNullableTrait; | |||||
const TYPE_INVOICE = 'invoice'; | const TYPE_INVOICE = 'invoice'; | ||||
const TYPE_QUOTATION = 'quotation'; | const TYPE_QUOTATION = 'quotation'; | ||||
const TYPE_PURCHASE_ORDER = 'purchase-order'; | const TYPE_PURCHASE_ORDER = 'purchase-order'; | ||||
const TYPE_DELIVERY_NOTE = 'delivery-note'; | const TYPE_DELIVERY_NOTE = 'delivery-note'; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface") | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | |||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $merchant; | |||||
protected $section; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=64) | * @ORM\Column(type="string", length=64) | ||||
*/ | */ | ||||
protected $orderShops; | protected $orderShops; | ||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"}) | * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"}) | ||||
*/ | */ | ||||
protected $orderRefund; | protected $orderRefund; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderShops = new ArrayCollection(); | $this->orderShops = new ArrayCollection(); | ||||
return $this->getReference(); | return $this->getReference(); | ||||
} | } | ||||
public function getMerchant(): ?MerchantInterface | |||||
public function getSection(): ?SectionInterface | |||||
{ | { | ||||
return $this->merchant; | |||||
return $this->section; | |||||
} | } | ||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
public function setSection(?SectionInterface $section): self | |||||
{ | { | ||||
$this->merchant = $merchant; | |||||
$this->section = $section; | |||||
return $this; | return $this; | ||||
} | } |
*/ | */ | ||||
protected $pointSales; | protected $pointSales; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface", mappedBy="merchant") | |||||
*/ | |||||
protected $productFamilies; | |||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", inversedBy="merchant", cascade={"persist", "remove"}) | * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", inversedBy="merchant", cascade={"persist", "remove"}) | ||||
* @ORM\JoinColumn(nullable=true) | * @ORM\JoinColumn(nullable=true) | ||||
*/ | */ | ||||
protected $address; | protected $address; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", mappedBy="merchant", orphanRemoval=true) | |||||
*/ | |||||
protected $productCategories; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Site\NewsInterface", mappedBy="merchant", orphanRemoval=true) | |||||
*/ | |||||
protected $news; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Site\PageInterface", mappedBy="merchant", orphanRemoval=true) | |||||
*/ | |||||
protected $pages; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", mappedBy="merchant") | |||||
*/ | |||||
protected $newsletters; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\User\GroupUserInterface", mappedBy="merchant") | * @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\User\GroupUserInterface", mappedBy="merchant") | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $settings; | protected $settings; | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->pointSales = new ArrayCollection(); | $this->pointSales = new ArrayCollection(); | ||||
$this->productFamilies = new ArrayCollection(); | |||||
$this->productCategories = new ArrayCollection(); | |||||
$this->news = new ArrayCollection(); | |||||
$this->groupUsers = new ArrayCollection(); | $this->groupUsers = new ArrayCollection(); | ||||
$this->newsletters = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|ProductFamilyInterface[] | |||||
*/ | |||||
public function getProductFamilies(): Collection | |||||
{ | |||||
return $this->productFamilies; | |||||
} | |||||
public function addProductFamily(ProductFamilyInterface $productFamily): self | |||||
{ | |||||
if (!$this->productFamilies->contains($productFamily)) { | |||||
$this->productFamilies[] = $productFamily; | |||||
$productFamily->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProductFamily(ProductFamilyInterface $productFamily): self | |||||
{ | |||||
if ($this->productFamilies->contains($productFamily)) { | |||||
$this->productFamilies->removeElement($productFamily); | |||||
// set the owning side to null (unless already changed) | |||||
if ($productFamily->getMerchant() === $this) { | |||||
$productFamily->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | /** | ||||
* @return Collection|MerchantSettingInterface[] | * @return Collection|MerchantSettingInterface[] | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|ProductCategoryInterface[] | |||||
*/ | |||||
public function getProductCategories(): Collection | |||||
{ | |||||
return $this->productCategories; | |||||
} | |||||
public function addProductCategory(ProductCategoryInterface $productCategory): self | |||||
{ | |||||
if (!$this->productCategories->contains($productCategory)) { | |||||
$this->productCategories[] = $productCategory; | |||||
$productCategory->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProductCategory(ProductCategoryInterface $productCategory): self | |||||
{ | |||||
if ($this->productCategories->contains($productCategory)) { | |||||
$this->productCategories->removeElement($productCategory); | |||||
// set the owning side to null (unless already changed) | |||||
if ($productCategory->getMerchant() === $this) { | |||||
$productCategory->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|NewsInterface[] | |||||
*/ | |||||
public function getNews(): Collection | |||||
{ | |||||
return $this->news; | |||||
} | |||||
public function addNews(NewsInterface $news): self | |||||
{ | |||||
if (!$this->news->contains($news)) { | |||||
$this->news[] = $news; | |||||
$news->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeNews(NewsInterface $news): self | |||||
{ | |||||
if ($this->news->contains($news)) { | |||||
$this->news->removeElement($news); | |||||
// set the owning side to null (unless already changed) | |||||
if ($news->getMerchant() === $this) { | |||||
$news->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|PageInterface[] | |||||
*/ | |||||
public function getPages(): Collection | |||||
{ | |||||
return $this->pages; | |||||
} | |||||
public function addPage(PageInterface $page): self | |||||
{ | |||||
if (!$this->pages->contains($page)) { | |||||
$this->pages[] = $page; | |||||
$page->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removePage(PageInterface $page): self | |||||
{ | |||||
if ($this->pages->contains($page)) { | |||||
$this->pages->removeElement($page); | |||||
// set the owning side to null (unless already changed) | |||||
if ($page->getMerchant() === $this) { | |||||
$page->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|NewsletterInterface[] | |||||
*/ | |||||
public function getNewsletters(): Collection | |||||
{ | |||||
return $this->newsletters; | |||||
} | |||||
public function addNewsletter(NewsletterInterface $newsletter): self | |||||
{ | |||||
if (!$this->newsletters->contains($newsletter)) { | |||||
$this->newsletters[] = $newsletter; | |||||
$newsletter->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeNewsletter(NewsletterInterface $newsletter): self | |||||
{ | |||||
if ($this->newsletters->contains($newsletter)) { | |||||
$this->newsletters->removeElement($newsletter); | |||||
// set the owning side to null (unless already changed) | |||||
if ($newsletter->getMerchant() === $this) { | |||||
$newsletter->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function getNewsletter() | |||||
{ | |||||
$newsletters = $this->getNewsletters(); | |||||
foreach ($newsletters as $newsletter) { | |||||
if ($newsletter->getIsMain()) { | |||||
return $newsletter; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
/** | /** | ||||
* @return Collection|GroupUserInterface[] | * @return Collection|GroupUserInterface[] | ||||
*/ | */ |
*/ | */ | ||||
protected $section; | protected $section; | ||||
public function getSection(): ?SectionInterface | public function getSection(): ?SectionInterface | ||||
{ | { | ||||
return $this->section; | return $this->section; |
return $this; | return $this; | ||||
} | } | ||||
// getSummaryOrderProductReductionCatalog | |||||
public function getSummary() | |||||
{ | |||||
$text = ''; | |||||
if ($this->getUnit() == 'amount') { | |||||
$text .= '- ' . $this->getValue() . ' €'; | |||||
} | |||||
if ($this->getUnit() == 'percent') { | |||||
$text .= '- ' . $this->getValue() . ' %'; | |||||
} | |||||
return $text; | |||||
} | |||||
// compareOrderProductReductionCatalog | |||||
public function compare($orderProductReductionCatalog) | |||||
{ | |||||
return $orderProductReductionCatalog | |||||
&& $this->getUnit() == $orderProductReductionCatalog->getUnit() | |||||
&& (string)$this->getValue() == (string)$orderProductReductionCatalog->getValue() | |||||
&& $this->getBehaviorTaxRate() == $orderProductReductionCatalog->getBehaviorTaxRate(); | |||||
} | |||||
} | } |
*/ | */ | ||||
protected $orderShop; | protected $orderShop; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $reductionCart; | protected $reductionCart; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $codeUsed; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->title; | return $this->title; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCodeUsed(): ?string | |||||
{ | |||||
return $this->codeUsed; | |||||
} | |||||
public function setCodeUsed(?string $codeUsed): self | |||||
{ | |||||
$this->codeUsed = $codeUsed; | |||||
return $this; | |||||
} | |||||
} | } |
*/ | */ | ||||
protected $title; | protected $title; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderReductionCredits") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderReductionCredits") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $reductionCredit; | protected $reductionCredit; | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) | ||||
*/ | */ | ||||
protected $type; | protected $type; | ||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->title; | return $this->title; |
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | |||||
use Lc\CaracoleBundle\Model\Config\TaxRateInterface; | |||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | use Lc\CaracoleBundle\Model\File\DocumentInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentModel; | |||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
use Lc\CaracoleBundle\Model\Product\ProductInterface; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | use Lc\SovBundle\Model\Ticket\TicketInterface; | ||||
use Lc\CaracoleBundle\Model\User\VisitorInterface; | use Lc\CaracoleBundle\Model\User\VisitorInterface; | ||||
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | ||||
*/ | */ | ||||
abstract class OrderShopModel extends AbstractLightEntity implements FilterSectionInterface | abstract class OrderShopModel extends AbstractLightEntity implements FilterSectionInterface | ||||
{ | { | ||||
use BlameableNullableTrait; | |||||
const DELIVERY_TYPE_HOME = 'home'; | |||||
const DELIVERY_TYPE_POINTSALE = 'point-sale'; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orders", fetch="EAGER") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | |||||
*/ | */ | ||||
protected $user; | protected $user; | ||||
*/ | */ | ||||
protected $comment; | protected $comment; | ||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $autoPayment; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=31, nullable=true) | * @ORM\Column(type="string", length=31, nullable=true) | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $documents; | protected $documents; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketInterface", mappedBy="orderShop") | * @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketInterface", mappedBy="orderShop") | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $cycleId; | protected $cycleId; | ||||
public function __construct() | |||||
{ | |||||
$this->orderStatusHistories = new ArrayCollection(); | |||||
$this->orderPayments = new ArrayCollection(); | |||||
$this->orderProducts = new ArrayCollection(); | |||||
$this->creditHistories = new ArrayCollection(); | |||||
$this->orderReductionCarts = new ArrayCollection(); | |||||
$this->orderReductionCredits = new ArrayCollection(); | |||||
$this->documents = new ArrayCollection(); | |||||
} | |||||
/** | |||||
* @ORM\Column(type="integer", nullable=true) | |||||
*/ | |||||
protected $cycleNumber; | |||||
public function __toString() | |||||
{ | |||||
if ($this->getValidationDate()) { | |||||
return 'Commande du ' . $this->getValidationDate()->format('d/m/Y'); | |||||
} else { | |||||
return 'Commande #' . $this->getId(); | |||||
} | |||||
} | |||||
/** | |||||
* @ORM\Column(type="datetime", nullable=true) | |||||
*/ | |||||
protected $orderShopCreatedAt; | |||||
public function countQuantities() | |||||
{ | |||||
return self::countQuantitiesByOrderProducts($this->getOrderProducts()); | |||||
} | |||||
/** | |||||
* @ORM\Column(type="integer", nullable=true) | |||||
*/ | |||||
protected $idValidOrder; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="App\Entity\Address\Address") | |||||
*/ | |||||
protected $deliveryAddress; | |||||
public static function countQuantitiesByOrderProducts($orderProducts = []) | |||||
{ | |||||
$count = 0; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="App\Entity\PointSale\PointSale") | |||||
*/ | |||||
protected $deliveryPointSale; | |||||
foreach ($orderProducts as $orderProduct) { | |||||
$count += $orderProduct->getQuantityOrder(); | |||||
} | |||||
/** | |||||
* @ORM\Column(type="text", nullable=true) | |||||
*/ | |||||
protected $deliveryAddressText; | |||||
return $count; | |||||
} | |||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $deliveryType; | |||||
public function getOrderProductsByParentCategory() | |||||
{ | |||||
$categoriesArray = []; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $deliveryPrice; | |||||
foreach ($this->getOrderProducts() as $orderProduct) { | |||||
$productCategories = $orderProduct->getProduct()->getProductFamily()->getProductCategories(); | |||||
$category = $productCategories[0]->getParentCategory(); | |||||
$labelCategory = $category->getTitle(); | |||||
if (!isset($categoriesArray[$labelCategory])) { | |||||
$categoriesArray[$labelCategory] = []; | |||||
} | |||||
$categoriesArray[$labelCategory][] = $orderProduct; | |||||
} | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="App\Entity\Config\TaxRate") | |||||
*/ | |||||
protected $deliveryTaxRate; | |||||
return $categoriesArray; | |||||
} | |||||
/** | |||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
*/ | |||||
protected $reference; | |||||
public function hasOrderProductAlreadyInCart($orderProductTest) | |||||
{ | |||||
foreach ($this->getOrderProducts() as $orderProduct) { | |||||
if ($orderProduct->getProduct() == $orderProductTest->getProduct()) { | |||||
return $orderProduct; | |||||
} | |||||
} | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="App\Entity\Order\OrderShop", inversedBy="complementaryOrderShops") | |||||
*/ | |||||
protected $mainOrderShop; | |||||
return false; | |||||
} | |||||
/** | |||||
* @ORM\OneToMany(targetEntity="App\Entity\Order\OrderShop", mappedBy="mainOrderShop") | |||||
*/ | |||||
protected $complementaryOrderShops; | |||||
public function getOrderProductsByProductFamily($productFamily) | |||||
{ | |||||
$arrayOrderProducts = []; | |||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $declineComplementaryOrderShop; | |||||
foreach ($this->getOrderProducts() as $orderProduct) { | |||||
if ($orderProduct->getProduct()->getProductFamily() == $productFamily) { | |||||
$arrayOrderProducts[] = $orderProduct; | |||||
} | |||||
} | |||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $orderAllowByAdmin; | |||||
return $arrayOrderProducts; | |||||
} | |||||
/** | |||||
* @ORM\Column(type="integer", nullable=true) | |||||
*/ | |||||
protected $hasReach; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statTotal; | |||||
public function getQuantityOrderByProduct(ProductInterface $product, $byWeight = false) | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statTotalWithTax; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statTotalOrderProductsWithReductions; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statTotalOrderProductsWithTaxAndReductions; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statMarginOrderProductsWithReductions; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statDeliveryPriceWithReduction; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $statDeliveryPriceWithTaxAndReduction; | |||||
public function __construct() | |||||
{ | { | ||||
$quantity = 0; | |||||
$productFamily = $product->getProductFamily(); | |||||
$behaviorCountStock = $productFamily->getBehaviorCountStock(); | |||||
$this->orderStatusHistories = new ArrayCollection(); | |||||
$this->orderPayments = new ArrayCollection(); | |||||
$this->orderProducts = new ArrayCollection(); | |||||
$this->orderReductionCarts = new ArrayCollection(); | |||||
$this->orderReductionCredits = new ArrayCollection(); | |||||
$this->documents = new ArrayCollection(); | |||||
$this->complementaryOrderShops = new ArrayCollection(); | |||||
$this->tickets = new ArrayCollection(); | |||||
} | |||||
foreach ($this->getOrderProducts() as $orderProduct) { | |||||
if ($orderProduct->getProduct()->getId() == $product->getId() | |||||
|| (($behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY || $behaviorCountStock == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE) | |||||
&& $orderProduct->getProduct()->getProductFamily()->getId() == $productFamily->getId())) { | |||||
if ($byWeight) { | |||||
$quantity += $orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct( | |||||
) / $orderProduct->getProduct()->getUnitInherited()->getCoefficient()); | |||||
} else { | |||||
$quantity += $orderProduct->getQuantityOrder(); | |||||
} | |||||
} | |||||
public function __toString() | |||||
{ | |||||
if ($this->getValidationDate()) { | |||||
return 'Commande du ' . $this->getValidationDate()->format('d/m/Y'); | |||||
} else { | |||||
return 'Commande #' . $this->getId(); | |||||
} | } | ||||
return $quantity; | |||||
} | } | ||||
public function getValidationDate(): ?\DateTimeInterface | public function getValidationDate(): ?\DateTimeInterface | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDateCreated() | |||||
{ | |||||
$orderStatusHistory = $this->getOrderStatusHistory(OrderStatusModel::ALIAS_WAITING_DELIVERY); | |||||
if ($orderStatusHistory) { | |||||
return $orderStatusHistory->getCreatedAt(); | |||||
} | |||||
return null; | |||||
} | |||||
public function getOrderStatusHistory($status) | |||||
{ | |||||
$orderStatusHistories = $this->getOrderStatusHistories(); | |||||
if (count($orderStatusHistories) > 0) { | |||||
foreach ($orderStatusHistories as $orderStatusHistory) { | |||||
if ($orderStatusHistory->getOrderStatus() == $status) { | |||||
return $orderStatusHistory; | |||||
} | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
public function getUser(): ?UserInterface | public function getUser(): ?UserInterface | ||||
{ | { | ||||
return $this->user; | return $this->user; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAutoPayment(): ?bool | |||||
{ | |||||
return $this->autoPayment; | |||||
} | |||||
public function setAutoPayment(bool $autoPayment): self | |||||
{ | |||||
$this->autoPayment = $autoPayment; | |||||
return $this; | |||||
} | |||||
public function getMeanPayment(): ?string | public function getMeanPayment(): ?string | ||||
{ | { | ||||
return $this->meanPayment; | return $this->meanPayment; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|CreditHistoryInterface[] | |||||
*/ | |||||
public function getCreditHistories(): Collection | |||||
{ | |||||
return $this->creditHistories; | |||||
} | |||||
public function addCreditHistory(CreditHistoryInterface $creditHistory): self | |||||
{ | |||||
if (!$this->creditHistories->contains($creditHistory)) { | |||||
$this->creditHistories[] = $creditHistory; | |||||
$creditHistory->setOrderShop($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeCreditHistory(CreditHistoryInterface $creditHistory): self | |||||
{ | |||||
if ($this->creditHistories->contains($creditHistory)) { | |||||
$this->creditHistories->removeElement($creditHistory); | |||||
// set the owning side to null (unless already changed) | |||||
if ($creditHistory->getOrderShop() === $this) { | |||||
$creditHistory->setOrderShop(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function getVisitor(): ?VisitorInterface | public function getVisitor(): ?VisitorInterface | ||||
{ | { | ||||
return $this->visitor; | return $this->visitor; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|OrderReductionCartInterface[] | * @return Collection|OrderReductionCartInterface[] | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDocumentInvoice(): DocumentInterface | |||||
{ | |||||
foreach ($this->getDocuments() as $document) { | |||||
if ($document->getType() == DocumentModel::TYPE_INVOICE) { | |||||
return $document; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
/** | /** | ||||
* @return Collection|TicketInterface[] | * @return Collection|TicketInterface[] | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function isValid() | |||||
public function getSection(): ?SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(?SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
public function getCycleId(): ?int | |||||
{ | |||||
return $this->cycleId; | |||||
} | |||||
public function setCycleId(?int $cycleId): self | |||||
{ | |||||
$this->cycleId = $cycleId; | |||||
return $this; | |||||
} | |||||
public function getCycleNumber(): ?int | |||||
{ | |||||
return $this->cycleNumber; | |||||
} | |||||
public function setCycleNumber(?int $cycleNumber): self | |||||
{ | |||||
$this->cycleNumber = $cycleNumber; | |||||
return $this; | |||||
} | |||||
public function getOrderShopCreatedAt(): ?\DateTimeInterface | |||||
{ | |||||
return $this->orderShopCreatedAt; | |||||
} | |||||
public function setOrderShopCreatedAt(?\DateTimeInterface $orderShopCreatedAt): self | |||||
{ | |||||
$this->orderShopCreatedAt = $orderShopCreatedAt; | |||||
return $this; | |||||
} | |||||
public function getIdValidOrder(): ?int | |||||
{ | |||||
return $this->idValidOrder; | |||||
} | |||||
public function setIdValidOrder(?int $idValidOrder): self | |||||
{ | |||||
$this->idValidOrder = $idValidOrder; | |||||
return $this; | |||||
} | |||||
public function getDeliveryAddress(): ?AddressInterface | |||||
{ | { | ||||
if ($this->getOrderStatus() && in_array( | |||||
$this->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsValid | |||||
) > 0) { | |||||
return true; | |||||
return $this->deliveryAddress; | |||||
} | |||||
public function setDeliveryAddress(?AddressInterface $deliveryAddress): self | |||||
{ | |||||
$this->deliveryAddress = $deliveryAddress; | |||||
return $this; | |||||
} | |||||
public function getDeliveryAddressText(): ?string | |||||
{ | |||||
return $this->deliveryAddressText; | |||||
} | |||||
public function setDeliveryAddressText(string $deliveryAddressText): self | |||||
{ | |||||
$this->deliveryAddressText = $deliveryAddressText; | |||||
return $this; | |||||
} | |||||
public function getDeliveryPointSale(): ?PointSaleInterface | |||||
{ | |||||
return $this->deliveryPointSale; | |||||
} | |||||
public function setDeliveryPointSale(?PointSaleInterface $deliveryPointSale): self | |||||
{ | |||||
$this->deliveryPointSale = $deliveryPointSale; | |||||
return $this; | |||||
} | |||||
public function getDeliveryType(): ?string | |||||
{ | |||||
return $this->deliveryType; | |||||
} | |||||
public function setDeliveryType(?string $deliveryType): self | |||||
{ | |||||
$this->deliveryType = $deliveryType; | |||||
return $this; | |||||
} | |||||
public function getDeliveryPrice(): ?float | |||||
{ | |||||
return $this->deliveryPrice; | |||||
} | |||||
public function setDeliveryPrice(?float $deliveryPrice): self | |||||
{ | |||||
$this->deliveryPrice = $deliveryPrice; | |||||
return $this; | |||||
} | |||||
public function getDeliveryTaxRate(): ?TaxRateInterface | |||||
{ | |||||
return $this->deliveryTaxRate; | |||||
} | |||||
public function setDeliveryTaxRate(?TaxRateInterface $deliveryTaxRate): self | |||||
{ | |||||
$this->deliveryTaxRate = $deliveryTaxRate; | |||||
return $this; | |||||
} | |||||
public function getReference(): ?string | |||||
{ | |||||
return $this->reference; | |||||
} | |||||
public function setReference(?string $reference): self | |||||
{ | |||||
$this->reference = $reference; | |||||
return $this; | |||||
} | |||||
public function getMainOrderShop(): ?self | |||||
{ | |||||
return $this->mainOrderShop; | |||||
} | |||||
public function setMainOrderShop(?self $mainOrderShop): self | |||||
{ | |||||
$this->mainOrderShop = $mainOrderShop; | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|OrderShopInterface[] | |||||
*/ | |||||
public function getComplementaryOrderShops(): Collection | |||||
{ | |||||
$arrayComplementaryOrderShops = new ArrayCollection(); | |||||
foreach ($this->complementaryOrderShops as $complementaryOrderShop) { | |||||
if ($complementaryOrderShop->isValid()) { | |||||
$arrayComplementaryOrderShops[] = $complementaryOrderShop; | |||||
} | |||||
} | } | ||||
return $arrayComplementaryOrderShops; | |||||
} | |||||
return false; | |||||
public function addComplementaryOrderShop(self $complementaryOrderShop): self | |||||
{ | |||||
if (!$this->complementaryOrderShops->contains($complementaryOrderShop)) { | |||||
$this->complementaryOrderShops[] = $complementaryOrderShop; | |||||
$complementaryOrderShop->setMainOrderShop($this); | |||||
} | |||||
return $this; | |||||
} | } | ||||
public function isCart() | |||||
public function removeComplementaryOrderShop(self $complementaryOrderShop): self | |||||
{ | { | ||||
if ($this->getOrderStatus() && in_array( | |||||
$this->getOrderStatus()->getAlias(), | |||||
OrderStatusModel::$statusAliasAsCart | |||||
) > 0) { | |||||
return true; | |||||
if ($this->complementaryOrderShops->contains($complementaryOrderShop)) { | |||||
$this->complementaryOrderShops->removeElement($complementaryOrderShop); | |||||
// set the owning side to null (unless already changed) | |||||
if ($complementaryOrderShop->getMainOrderShop() === $this) { | |||||
$complementaryOrderShop->setMainOrderShop(null); | |||||
} | |||||
} | } | ||||
return false; | |||||
return $this; | |||||
} | } | ||||
public function getSection(): ?SectionInterface | |||||
public function getDeclineComplementaryOrderShop(): ?bool | |||||
{ | { | ||||
return $this->section; | |||||
return $this->declineComplementaryOrderShop; | |||||
} | } | ||||
public function setSection(?SectionInterface $section): self | |||||
public function setDeclineComplementaryOrderShop(?bool $declineComplementaryOrderShop): self | |||||
{ | { | ||||
$this->section = $section; | |||||
$this->declineComplementaryOrderShop = $declineComplementaryOrderShop; | |||||
return $this; | return $this; | ||||
} | } | ||||
public function getCycleId(): ?int | |||||
public function getOrderAllowByAdmin(): ?bool | |||||
{ | { | ||||
return $this->cycleId; | |||||
return $this->orderAllowByAdmin; | |||||
} | } | ||||
public function setCycleId(?int $cycleId): self | |||||
public function setOrderAllowByAdmin(?bool $orderAllowByAdmin): self | |||||
{ | { | ||||
$this->cycleId = $cycleId; | |||||
$this->orderAllowByAdmin = $orderAllowByAdmin; | |||||
return $this; | |||||
} | |||||
public function getHasReach(): ?int | |||||
{ | |||||
return $this->hasReach; | |||||
} | |||||
public function setHasReach(?int $hasReach): self | |||||
{ | |||||
$this->hasReach = $hasReach; | |||||
return $this; | |||||
} | |||||
public function getStatTotal(): ?float | |||||
{ | |||||
return $this->statTotal; | |||||
} | |||||
public function setStatTotal(?float $statTotal): self | |||||
{ | |||||
$this->statTotal = $statTotal; | |||||
return $this; | |||||
} | |||||
public function getStatTotalWithTax(): ?float | |||||
{ | |||||
return $this->statTotalWithTax; | |||||
} | |||||
public function setStatTotalWithTax(?float $statTotalWithTax): self | |||||
{ | |||||
$this->statTotalWithTax = $statTotalWithTax; | |||||
return $this; | return $this; | ||||
} | } | ||||
public function getStatTotalOrderProductsWithReductions(): ?float | |||||
{ | |||||
return $this->statTotalOrderProductsWithReductions; | |||||
} | |||||
public function setStatTotalOrderProductsWithReductions(?float $statTotalOrderProductsWithReductions): self | |||||
{ | |||||
$this->statTotalOrderProductsWithReductions = $statTotalOrderProductsWithReductions; | |||||
return $this; | |||||
} | |||||
public function getStatTotalOrderProductsWithTaxAndReductions(): ?float | |||||
{ | |||||
return $this->statTotalOrderProductsWithTaxAndReductions; | |||||
} | |||||
public function setStatTotalOrderProductsWithTaxAndReductions(?float $statTotalOrderProductsWithTaxAndReductions): self | |||||
{ | |||||
$this->statTotalOrderProductsWithTaxAndReductions = $statTotalOrderProductsWithTaxAndReductions; | |||||
return $this; | |||||
} | |||||
public function getStatMarginOrderProductsWithReductions(): ?float | |||||
{ | |||||
return $this->statMarginOrderProductsWithReductions; | |||||
} | |||||
public function setStatMarginOrderProductsWithReductions(?float $statMarginOrderProductsWithReductions): self | |||||
{ | |||||
$this->statMarginOrderProductsWithReductions = $statMarginOrderProductsWithReductions; | |||||
return $this; | |||||
} | |||||
public function getStatDeliveryPriceWithReduction(): ?float | |||||
{ | |||||
return $this->statDeliveryPriceWithReduction; | |||||
} | |||||
public function setStatDeliveryPriceWithReduction(?float $statDeliveryPriceWithReduction): self | |||||
{ | |||||
$this->statDeliveryPriceWithReduction = $statDeliveryPriceWithReduction; | |||||
return $this; | |||||
} | |||||
public function getStatDeliveryPriceWithTaxAndReduction(): ?float | |||||
{ | |||||
return $this->statDeliveryPriceWithTaxAndReduction; | |||||
} | |||||
public function setStatDeliveryPriceWithTaxAndReduction(?float $statDeliveryPriceWithTaxAndReduction): self | |||||
{ | |||||
$this->statDeliveryPriceWithTaxAndReduction = $statDeliveryPriceWithTaxAndReduction; | |||||
return $this; | |||||
} | |||||
} | } |
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | ||||
*/ | */ | ||||
abstract class OrderStatusHistoryModel extends AbstractLightEntity | abstract class OrderStatusHistoryModel extends AbstractLightEntity | ||||
{ | { | ||||
use BlameableNullableTrait; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $origin; | protected $origin; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->getOrderStatus()->getAlias() . ' le : ' . $this->getCreatedAt()->format( | return $this->getOrderStatus()->getAlias() . ' le : ' . $this->getCreatedAt()->format( |
const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund'; | const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund'; | ||||
const ALIAS_REFUND = 'refund'; | const ALIAS_REFUND = 'refund'; | ||||
//TODO : AJOUTER un champ valid ds orderSTATUS | //TODO : AJOUTER un champ valid ds orderSTATUS | ||||
static $statusAliasAsValid = [ | static $statusAliasAsValid = [ | ||||
self::ALIAS_PAID, | self::ALIAS_PAID, | ||||
*/ | */ | ||||
protected $alias; | protected $alias; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $color; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->title . ' [' . $this->alias . ']'; | return $this->title . ' [' . $this->alias . ']'; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getColor(): ?string | |||||
{ | |||||
return $this->color; | |||||
} | |||||
public function setColor(?string $color): self | |||||
{ | |||||
$this->color = $color; | |||||
return $this; | |||||
} | |||||
} | } |
*/ | */ | ||||
protected $code; | protected $code; | ||||
/** | |||||
* @ORM\Column(type="float") | |||||
*/ | |||||
protected $deliveryPrice; | |||||
/** | |||||
* @ORM\Column(type="boolean") | |||||
*/ | |||||
protected $isPublic; | |||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"}) | * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"}) | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
return $this->getTitle(); | return $this->getTitle(); | ||||
} | } | ||||
public function labelAdminChoice() | |||||
{ | |||||
return $this->getTitle(); | |||||
} | |||||
/** | /** | ||||
* @return Collection|MerchantInterface[] | * @return Collection|MerchantInterface[] | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDeliveryPrice(): ?float | |||||
{ | |||||
return $this->deliveryPrice; | |||||
} | |||||
public function setDeliveryPrice(float $deliveryPrice): self | |||||
{ | |||||
$this->deliveryPrice = $deliveryPrice; | |||||
return $this; | |||||
} | |||||
public function getIsPublic(): ?bool | |||||
{ | |||||
return $this->isPublic; | |||||
} | |||||
public function setIsPublic(bool $isPublic): self | |||||
{ | |||||
$this->isPublic = $isPublic; | |||||
return $this; | |||||
} | |||||
public function getAddress(): ?AddressInterface | public function getAddress(): ?AddressInterface | ||||
{ | { | ||||
return $this->address; | return $this->address; |
*/ | */ | ||||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterSectionInterface | abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterSectionInterface | ||||
{ | { | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $saleStatus; | protected $saleStatus; | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->childrens = new ArrayCollection(); | $this->childrens = new ArrayCollection(); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getParent(): ?self | public function getParent(): ?self | ||||
{ | { | ||||
return $this->parent; | return $this->parent; | ||||
*/ | */ | ||||
public function getChildrens(): Collection | public function getChildrens(): Collection | ||||
{ | { | ||||
//TODO les lignes ci-dessous ne devraient pas exister, sert à résoudre le problème d'ordre dans le menu | |||||
// @TODO : les lignes ci-dessous ne devraient pas exister, sert à résoudre le problème d'ordre dans le menu | |||||
$iterator = $this->childrens->getIterator(); | $iterator = $this->childrens->getIterator(); | ||||
$iterator->uasort( | $iterator->uasort( | ||||
function ($a, $b) { | function ($a, $b) { | ||||
return ($a->getPosition() < $b->getPosition()) ? -1 : 1; | return ($a->getPosition() < $b->getPosition()) ? -1 : 1; | ||||
} | } | ||||
); | ); | ||||
return new ArrayCollection(iterator_to_array($iterator)); | return new ArrayCollection(iterator_to_array($iterator)); | ||||
} | } | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | ||||
use Lc\SovBundle\Model\File\FileInterface; | |||||
/** | /** | ||||
abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | ||||
FilterSectionInterface | FilterSectionInterface | ||||
{ | { | ||||
use ProductPropertyTrait; | use ProductPropertyTrait; | ||||
use BlameableNullableTrait; | |||||
const BEHAVIOR_COUNT_STOCK_UNLIMITED = 'unlimited'; | const BEHAVIOR_COUNT_STOCK_UNLIMITED = 'unlimited'; | ||||
const BEHAVIOR_COUNT_STOCK_BY_MEASURE = 'by-measure'; | const BEHAVIOR_COUNT_STOCK_BY_MEASURE = 'by-measure'; | ||||
]; | ]; | ||||
} | } | ||||
const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure'; | const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure'; | ||||
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; | const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; | ||||
]; | ]; | ||||
} | } | ||||
const BEHAVIOR_STOCK_CYCLE_RENEWABLE = 'renewable'; | |||||
const BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION = 'renewable-with-validation'; | |||||
const BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE = 'non-renewable'; | |||||
const BEHAVIOR_STOCK_WEEK_RENEWABLE = 'renewable'; | |||||
const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation'; | |||||
const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable'; | |||||
public function getBehaviorStockWeekChoices(): array | |||||
public function getBehaviorStockCycleChoices(): array | |||||
{ | { | ||||
return [ | return [ | ||||
self::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION, | |||||
self::BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_CYCLE_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION, | |||||
]; | ]; | ||||
} | } | ||||
const WARNING_MESSAGE_TYPE_SUCCESS = 'success'; | const WARNING_MESSAGE_TYPE_SUCCESS = 'success'; | ||||
const WARNING_MESSAGE_TYPE_ERROR = 'error'; | const WARNING_MESSAGE_TYPE_ERROR = 'error'; | ||||
const WARNING_MESSAGE_TYPE_WARNING = 'warning'; | const WARNING_MESSAGE_TYPE_WARNING = 'warning'; | ||||
self::WARNING_MESSAGE_TYPE_WARNING, | self::WARNING_MESSAGE_TYPE_WARNING, | ||||
]; | ]; | ||||
} | } | ||||
const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple'; | const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple'; | ||||
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; | const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; | ||||
self::BEHAVIOR_ADD_TO_CART_SIMPLE, | self::BEHAVIOR_ADD_TO_CART_SIMPLE, | ||||
]; | ]; | ||||
} | } | ||||
const BEHAVIOR_PRICE_BY_PIECE = 'by-piece'; | const BEHAVIOR_PRICE_BY_PIECE = 'by-piece'; | ||||
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; | const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; | ||||
self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT, | self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT, | ||||
]; | ]; | ||||
} | } | ||||
const PROPERTY_ORGANIC_LABEL_AB = 'ab'; | const PROPERTY_ORGANIC_LABEL_AB = 'ab'; | ||||
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; | const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; | ||||
const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; | const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; | ||||
]; | ]; | ||||
} | } | ||||
const TYPE_EXPIRATION_DATE_DLC = 'dlc'; | const TYPE_EXPIRATION_DATE_DLC = 'dlc'; | ||||
const TYPE_EXPIRATION_DATE_DDM = 'ddm'; | const TYPE_EXPIRATION_DATE_DDM = 'ddm'; | ||||
const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; | const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; | ||||
]; | ]; | ||||
} | } | ||||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family'; | const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family'; | ||||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; | const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; | ||||
public function getBehaviorExpirationDateChoices():array{ | |||||
public function getBehaviorExpirationDateChoices(): array | |||||
{ | |||||
return [ | return [ | ||||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | ||||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | ||||
]; | ]; | ||||
} | } | ||||
//Champ hydraté par ProductFamilyUtils | |||||
// @TODO : Champ hydraté par ProductFamilyBuilder ? | |||||
protected $reductionCatalog; | protected $reductionCatalog; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="productFamilies") | * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="productFamilies") | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $behaviorCountStock; | protected $behaviorCountStock; | ||||
/** | |||||
* @ORM\Column(type="string", length=255) | |||||
*/ | |||||
protected $behaviorStockWeek; | |||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $availabilityRenewedThisWeek; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) | ||||
*/ | */ | ||||
protected $behaviorDisplaySale; | protected $behaviorDisplaySale; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $exportTitle; | |||||
/** | |||||
* @ORM\Column(type="text", nullable=true) | |||||
*/ | |||||
protected $exportNote; | |||||
/** | /** | ||||
* @ORM\Column(type="date", nullable=true) | * @ORM\Column(type="date", nullable=true) | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $saleStatus; | protected $saleStatus; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | ||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $section; | protected $section; | ||||
/** | |||||
* @ORM\ManyToOne((targetEntity="Lc\SovBundle\Model\File\FileInterface", cascade={"persist", "remove"}) | |||||
*/ | |||||
protected $image; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->productCategories = new ArrayCollection(); | $this->productCategories = new ArrayCollection(); | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function getAvailableQuantityInherited() | public function getAvailableQuantityInherited() | ||||
{ | { | ||||
$availableQuantity = 0; | $availableQuantity = 0; | ||||
return $availableQuantity; | return $availableQuantity; | ||||
} | } | ||||
//TODO move | |||||
public function getTaxRateInherited() | public function getTaxRateInherited() | ||||
{ | { | ||||
if ($this->getTaxRate()) { | if ($this->getTaxRate()) { | ||||
return $this->getSection()->getMerchant()->getTaxRate(); | return $this->getSection()->getMerchant()->getTaxRate(); | ||||
} | } | ||||
} | } | ||||
public function getActiveProducts(): ?bool | public function getActiveProducts(): ?bool | ||||
{ | { | ||||
return $this->activeProducts; | return $this->activeProducts; | ||||
return $this->products; | return $this->products; | ||||
} | } | ||||
//TODO move | |||||
public function getProductsOnline(): Collection | public function getProductsOnline(): Collection | ||||
{ | { | ||||
$products = $this->getProducts(); | $products = $this->getProducts(); | ||||
return $this->reductionCatalog; | return $this->reductionCatalog; | ||||
} | } | ||||
//TODO move | |||||
public function getReductionCatalogInherited(): ?ReductionCatalogInterface | public function getReductionCatalogInherited(): ?ReductionCatalogInterface | ||||
{ | { | ||||
return $this->getReductionCatalog(); | return $this->getReductionCatalog(); | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function getProductCategoryParent() | public function getProductCategoryParent() | ||||
{ | { | ||||
$productCategories = $this->getProductCategories(); | $productCategories = $this->getProductCategories(); | ||||
return false; | return false; | ||||
} | } | ||||
//TODO move | |||||
public function getProductCategoryChild() | public function getProductCategoryChild() | ||||
{ | { | ||||
$productCategories = $this->getProductCategories(); | $productCategories = $this->getProductCategories(); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getExportTitle(): ?string | |||||
{ | |||||
return $this->exportTitle; | |||||
} | |||||
public function setExportTitle(?string $exportTitle): self | |||||
{ | |||||
$this->exportTitle = $exportTitle; | |||||
return $this; | |||||
} | |||||
public function getExportNote(): ?string | |||||
{ | |||||
return $this->exportNote; | |||||
} | |||||
public function setExportNote(?string $exportNote): self | |||||
{ | |||||
$this->exportNote = $exportNote; | |||||
return $this; | |||||
} | |||||
public function getBehaviorStockWeek(): ?string | |||||
{ | |||||
return $this->behaviorStockWeek; | |||||
} | |||||
public function setBehaviorStockWeek(string $behaviorStockWeek): self | |||||
{ | |||||
$this->behaviorStockWeek = $behaviorStockWeek; | |||||
return $this; | |||||
} | |||||
public function getAvailabilityRenewedThisWeek(): ?bool | |||||
{ | |||||
return $this->availabilityRenewedThisWeek; | |||||
} | |||||
public function setAvailabilityRenewedThisWeek(?bool $availabilityRenewedThisWeek): self | |||||
{ | |||||
$this->availabilityRenewedThisWeek = $availabilityRenewedThisWeek; | |||||
return $this; | |||||
} | |||||
public function getBehaviorDisplaySale(): ?string | public function getBehaviorDisplaySale(): ?string | ||||
{ | { | ||||
return $this->behaviorDisplaySale; | return $this->behaviorDisplaySale; | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function isPropertyNoveltyOnline(): ?bool | public function isPropertyNoveltyOnline(): ?bool | ||||
{ | { | ||||
if ($this->getPropertyNoveltyExpirationDate()) { | if ($this->getPropertyNoveltyExpirationDate()) { | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function countProperties(): bool | public function countProperties(): bool | ||||
{ | { | ||||
$count = 0; | $count = 0; | ||||
return $this->behaviorPrice; | return $this->behaviorPrice; | ||||
} | } | ||||
//TODO move | |||||
public function getBehaviorPriceInherited() | public function getBehaviorPriceInherited() | ||||
{ | { | ||||
return $this->getBehaviorPrice(); | return $this->getBehaviorPrice(); | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function hasProductsWithVariousWeight() | public function hasProductsWithVariousWeight() | ||||
{ | { | ||||
if ($this->getActiveProducts()) { | if ($this->getActiveProducts()) { | ||||
return false; | return false; | ||||
} | } | ||||
//TODO move | |||||
public function getProductsGroupByTitle() | public function getProductsGroupByTitle() | ||||
{ | { | ||||
$arrayProductsGroupByTitle = []; | $arrayProductsGroupByTitle = []; | ||||
return $arrayProductsGroupByTitle; | return $arrayProductsGroupByTitle; | ||||
} | } | ||||
//TODO move | |||||
public function getOriginProduct() | public function getOriginProduct() | ||||
{ | { | ||||
$products = $this->getProducts(); | $products = $this->getProducts(); | ||||
} | } | ||||
} | } | ||||
//TODO move | |||||
public function getOriginProductOnline() | public function getOriginProductOnline() | ||||
{ | { | ||||
$originProduct = $this->getOriginProduct(); | $originProduct = $this->getOriginProduct(); | ||||
} | } | ||||
} | } | ||||
//TODO move | |||||
public function hasOneProductOnline() | public function hasOneProductOnline() | ||||
{ | { | ||||
if (($this->getActiveProducts() && count($this->getProductsOnline()) > 0) | if (($this->getActiveProducts() && count($this->getProductsOnline()) > 0) | ||||
return $this; | return $this; | ||||
} | } | ||||
//TODO move | |||||
public function getFieldBuyingPrice() | public function getFieldBuyingPrice() | ||||
{ | { | ||||
if ($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | if ($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | ||||
} | } | ||||
} | } | ||||
//TODO move | |||||
public function getFieldPrice() | public function getFieldPrice() | ||||
{ | { | ||||
if ($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | if ($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) { | ||||
return 'priceByRefUnit'; | return 'priceByRefUnit'; | ||||
} | } | ||||
} | } | ||||
public function getImage(): ?FileInterface | |||||
{ | |||||
return $this->image; | |||||
} | |||||
public function setImage(?FileInterface $image): self | |||||
{ | |||||
$this->image = $image; | |||||
return $this; | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait; | |||||
use Lc\SovBundle\Doctrine\Extension\SortableInterface; | use Lc\SovBundle\Doctrine\Extension\SortableInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\SortableTrait; | use Lc\SovBundle\Doctrine\Extension\SortableTrait; | ||||
use Lc\SovBundle\Doctrine\Extension\StatusTrait; | use Lc\SovBundle\Doctrine\Extension\StatusTrait; | ||||
use SortableTrait; | use SortableTrait; | ||||
use ProductPropertyTrait; | use ProductPropertyTrait; | ||||
use StatusTrait; | use StatusTrait; | ||||
/** | |||||
* @Gedmo\Blameable(on="create") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $createdBy; | |||||
/** | |||||
* @Gedmo\Blameable(on="update") | |||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | |||||
* @ORM\JoinColumn(nullable=true) | |||||
*/ | |||||
protected $updatedBy; | |||||
use BlameableNullableTrait; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface", inversedBy="products", cascade={"persist"}) | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface", inversedBy="products", cascade={"persist"}) | ||||
*/ | */ | ||||
protected $originProduct; | protected $originProduct; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $exportTitle; | |||||
/** | |||||
* @ORM\Column(type="text", nullable=true) | |||||
*/ | |||||
protected $exportNote; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderProducts = new ArrayCollection(); | $this->orderProducts = new ArrayCollection(); | ||||
return $title; | return $title; | ||||
} | } | ||||
public function isProductSaleStatusOn() | |||||
{ | |||||
if ($this->getProductFamily()->getSaleStatus() != 1) { | |||||
return false; | |||||
} | |||||
$allCategoriesSalesOff = true; | |||||
$unavailableSpecificDay = false; | |||||
foreach ($this->getProductFamily()->getProductCategories() as $category) { | |||||
if ($category->getParent()) { | |||||
if ($category->getSaleStatus() && $category->getParent()->getSaleStatus()) { | |||||
$allCategoriesSalesOff = false; | |||||
} | |||||
} else { | |||||
if ($category->getSaleStatus()) { | |||||
$allCategoriesSalesOff = false; | |||||
} | |||||
} | |||||
// specific day | |||||
// @TODO : spécifique pdl ? | |||||
$displaySpecificDay = $category->getDisplaySpecificDay(); | |||||
if ($displaySpecificDay && $displaySpecificDay != date('N')) { | |||||
$unavailableSpecificDay = true; | |||||
} | |||||
} | |||||
if ($allCategoriesSalesOff) { | |||||
return false; | |||||
} | |||||
if ($unavailableSpecificDay) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
// isProductAvailable | |||||
public function isAvailable($quantityOrder = 0, $checkCart = false, $orderShop = null) | |||||
{ | |||||
if ($this->getStatus() != 1 || $this->getProductFamily()->getStatus() != 1 || !$this->isProductSaleStatusOn()) { | |||||
return false; | |||||
} | |||||
// @TODO : orderShop à définir où est appelé isProductAvailable | |||||
if ($checkCart && !$orderShop) { | |||||
throw new \Exception("Attention jeune padawan : définir le orderShop à l'endroit où est appelé isProductAvailable"); | |||||
} | |||||
$productFamily = $this->getProductFamily(); | |||||
$quantityAsked = $quantityOrder; | |||||
if ($productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE) { | |||||
if (!$quantityOrder) { | |||||
$quantityAsked = $orderShop->getQuantityOrderByProduct($this, true); | |||||
} else { | |||||
$quantityAsked = ($this->getQuantityInherited() / $this->getUnitInherited()->getCoefficient()) * $quantityOrder; | |||||
} | |||||
if ($checkCart) { | |||||
$quantityAsked += $orderShop->getQuantityOrderByProduct($this, true); | |||||
} | |||||
} | |||||
if (($productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY | |||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT)) { | |||||
if (!$quantityOrder) { | |||||
$quantityAsked = $orderShop->getQuantityOrderByProduct($this); | |||||
} | |||||
if ($checkCart) { | |||||
$quantityAsked += $orderShop->getQuantityOrderByProduct($this); | |||||
} | |||||
} | |||||
if ($this->getAvailableQuantityInherited() >= $quantityAsked | |||||
|| $productFamily->getBehaviorCountStock() == ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED) { | |||||
return true; | |||||
} else { | |||||
return false; | |||||
} | |||||
} | |||||
// @TODO : move | |||||
// getProductQuantityMaxAddCart | // getProductQuantityMaxAddCart | ||||
public function getQuantityMaxAddCart(OrderShopInterface $orderShop) | public function getQuantityMaxAddCart(OrderShopInterface $orderShop) | ||||
{ | { | ||||
return $this->getAvailableQuantityInherited() - $orderShop->getQuantityOrderByProduct($this, $byWeight); | return $this->getAvailableQuantityInherited() - $orderShop->getQuantityOrderByProduct($this, $byWeight); | ||||
} | } | ||||
// @TODO : move | |||||
// getProductQuantity | // getProductQuantity | ||||
public function getProductQuantity() | public function getProductQuantity() | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getBuyingPriceInherited() | public function getBuyingPriceInherited() | ||||
{ | { | ||||
if ($this->getBuyingPrice()) { | if ($this->getBuyingPrice()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getBuyingPriceByRefUnitInherited() | public function getBuyingPriceByRefUnitInherited() | ||||
{ | { | ||||
if ($this->getBuyingPriceByRefUnit()) { | if ($this->getBuyingPriceByRefUnit()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getPriceInherited() | public function getPriceInherited() | ||||
{ | { | ||||
if ($this->getPrice()) { | if ($this->getPrice()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getPriceByRefUnitInherited() | public function getPriceByRefUnitInherited() | ||||
{ | { | ||||
if ($this->getPriceByRefUnit()) { | if ($this->getPriceByRefUnit()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getBehaviorPriceInherited() | public function getBehaviorPriceInherited() | ||||
{ | { | ||||
return $this->getProductFamily()->getBehaviorPrice(); | return $this->getProductFamily()->getBehaviorPrice(); | ||||
} | } | ||||
// @TODO : move | |||||
public function getReductionCatalogInherited() | public function getReductionCatalogInherited() | ||||
{ | { | ||||
return $this->getProductFamily()->getReductionCatalog(); | return $this->getProductFamily()->getReductionCatalog(); | ||||
} | } | ||||
// @TODO : move | |||||
public function getUnitInherited() | public function getUnitInherited() | ||||
{ | { | ||||
if ($this->getUnit()) { | if ($this->getUnit()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getTitleInherited() | public function getTitleInherited() | ||||
{ | { | ||||
if ($this->getTitle()) { | if ($this->getTitle()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getQuantityInherited() | public function getQuantityInherited() | ||||
{ | { | ||||
if ($this->getQuantity()) { | if ($this->getQuantity()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getQuantityLabelInherited() | public function getQuantityLabelInherited() | ||||
{ | { | ||||
$quantity = $this->getQuantityInherited(); | $quantity = $this->getQuantityInherited(); | ||||
return $quantity . $unit->getWordingShort(); | return $quantity . $unit->getWordingShort(); | ||||
} | } | ||||
// @TODO : move | |||||
public function getQuantityTitle($productFamily) | public function getQuantityTitle($productFamily) | ||||
{ | { | ||||
$title = $this->getQuantityLabelInherited(); | $title = $this->getQuantityLabelInherited(); | ||||
return $title; | return $title; | ||||
} | } | ||||
// @TODO : move | |||||
public function getAvailableQuantityInherited() | public function getAvailableQuantityInherited() | ||||
{ | { | ||||
switch ($this->getProductFamily()->getBehaviorCountStock()) { | switch ($this->getProductFamily()->getBehaviorCountStock()) { | ||||
} | } | ||||
} | } | ||||
// @TODO : move | |||||
public function getTaxRateInherited() | public function getTaxRateInherited() | ||||
{ | { | ||||
return $this->getProductFamily()->getTaxRateInherited(); | return $this->getProductFamily()->getTaxRateInherited(); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getExportTitle(): ?string | |||||
{ | |||||
return $this->exportTitle; | |||||
} | |||||
//TODO move | |||||
public function getExportTitleInherited(): ?string | |||||
{ | |||||
$exportTitle = $this->getExportTitle(); | |||||
if ($exportTitle && strlen($exportTitle)) { | |||||
return $exportTitle; | |||||
} else { | |||||
$productFamily = $this->getProductFamily(); | |||||
if ($productFamily) { | |||||
return $productFamily->getExportTitle(); | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
public function setExportTitle(?string $exportTitle): self | |||||
{ | |||||
$this->exportTitle = $exportTitle; | |||||
return $this; | |||||
} | |||||
public function getExportNote(): ?string | |||||
{ | |||||
return $this->exportNote; | |||||
} | |||||
//TODO move | |||||
public function getExportNoteInherited(): ?string | |||||
{ | |||||
$exportNote = $this->getExportNote(); | |||||
if ($exportNote && strlen($exportNote)) { | |||||
return $exportNote; | |||||
} else { | |||||
$productFamily = $this->getProductFamily(); | |||||
if ($productFamily) { | |||||
return $productFamily->getExportNote(); | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
public function setExportNote(?string $exportNote): self | |||||
{ | |||||
$this->exportNote = $exportNote; | |||||
return $this; | |||||
} | |||||
} | } |