namespace Lc\CaracoleBundle\Model\Address; | namespace Lc\CaracoleBundle\Model\Address; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface AddressInterface | interface AddressInterface | ||||
{ | { | ||||
public function getUser(): ?UserInterface; | |||||
public function setUser(?UserInterface $user): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getTitle(): ?string; | |||||
public function setTitle(string $title): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getType(): ?string; | |||||
public function setType(string $type): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getCivility(): ?bool; | |||||
public function setCivility(?bool $civility): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getLastname(): ?string; | |||||
public function setLastname(?string $lastname): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getFirstname(): ?string; | |||||
public function setFirstname(?string $firstname): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getAddress(): ?string; | |||||
public function setAddress(string $address): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getZip(): ?string; | |||||
public function setZip(string $zip): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getCity(): ?string; | |||||
public function setCity(string $city): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getCountry(): ?string; | |||||
public function setCountry(string $country): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getLatitude(): ?string; | |||||
public function setLatitude(?string $latitude): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getLongitude(): ?string; | |||||
public function setLongitude(?string $longitude): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getLatitudeOverride(): ?string; | |||||
public function setLatitudeOverride(?string $latitudeOverride): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getLongitudeOverride(): ?string; | |||||
public function setLongitudeOverride(?string $longitudeOverride): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getCompany(): ?string; | |||||
public function setCompany(?string $company): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getSiret(): ?string; | |||||
public function setSiret(?string $siret): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getTva(): ?string; | |||||
public function setTva(?string $tva): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getPhone(): ?array; | |||||
public function setPhone(?array $phone): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getComment(): ?string; | |||||
public function setComment(?string $comment): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getPointSale(): ?PointSaleInterface; | |||||
public function setPointSale(PointSaleInterface $pointSale): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getMerchant(): ?MerchantInterface; | |||||
public function setMerchant(MerchantInterface $merchant): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
public function getDeliveryInfos(): ?string; | |||||
} | |||||
public function setDeliveryInfos(?string $deliveryInfos): \Lc\CaracoleBundle\Model\Address\AddressModel; | |||||
} |
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class AddressModel extends AbstractLightEntity implements StatusInterface | |||||
abstract class AddressModel extends AbstractLightEntity implements StatusInterface, AddressInterface | |||||
{ | { | ||||
use StatusTrait; | use StatusTrait; | ||||
namespace Lc\CaracoleBundle\Model\Config; | namespace Lc\CaracoleBundle\Model\Config; | ||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface TaxRateInterface | interface TaxRateInterface | ||||
{ | { | ||||
public function getBehaviorTaxRateChoices(): array; | |||||
public function getTitle(): ?string; | |||||
public function setTitle(string $title): \Lc\CaracoleBundle\Model\Config\TaxRateModel; | |||||
public function getValue(): ?float; | |||||
} | |||||
public function setValue(float $value): \Lc\CaracoleBundle\Model\Config\TaxRateModel; | |||||
} |
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class TaxRateModel extends AbstractLightEntity | |||||
abstract class TaxRateModel extends AbstractLightEntity implements TaxRateInterface | |||||
{ | { | ||||
const BEHAVIOR_TAX_RATE_INCLUDED = 'tax-included'; | const BEHAVIOR_TAX_RATE_INCLUDED = 'tax-included'; |
<?php | <?php | ||||
namespace Lc\CaracoleBundle\Model\Config ; | |||||
namespace Lc\CaracoleBundle\Model\Config; | |||||
/** | |||||
* @ORM\MappedSuperclass | |||||
*/ | |||||
interface UnitInterface | interface UnitInterface | ||||
{ | { | ||||
public function getUnitAmountChoices(): array; | |||||
public function getUnit(): ?string; | |||||
public function setUnit(string $unit): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
public function getWording(): ?string; | |||||
public function setWording(string $wording): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
public function getWordingUnit(): ?string; | |||||
public function setWordingUnit(string $wordingUnit): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
public function getWordingShort(): ?string; | |||||
public function setWordingShort(string $wordingShort): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
public function getCoefficient(): ?int; | |||||
public function setCoefficient(int $coefficient): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
public function getUnitReference(): ?self; | |||||
} | |||||
public function setUnitReference(?self $unitReference): \Lc\CaracoleBundle\Model\Config\UnitModel; | |||||
} |
/** | /** | ||||
* @ORM\MappedSuperclass | * @ORM\MappedSuperclass | ||||
*/ | */ | ||||
abstract class UnitModel extends AbstractLightEntity | |||||
abstract class UnitModel extends AbstractLightEntity implements UnitInterface | |||||
{ | { | ||||
const UNIT_PERCENT = 'percent'; | const UNIT_PERCENT = 'percent'; |
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||||
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\CaracoleBundle\Model\Order\OrderRefundInterface; | use Lc\CaracoleBundle\Model\Order\OrderRefundInterface; | ||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class DocumentModel extends AbstractFullEntity implements FilterMerchantInterface | |||||
abstract class DocumentModel extends AbstractFullEntity implements FilterSectionInterface | |||||
{ | { | ||||
use BlameableNullableTrait; | use BlameableNullableTrait; | ||||
namespace Lc\CaracoleBundle\Model\Newsletter; | namespace Lc\CaracoleBundle\Model\Newsletter; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Model\Newsletter\NewsletterModel as SovNewsletterModel; | use Lc\SovBundle\Model\Newsletter\NewsletterModel as SovNewsletterModel; | ||||
namespace Lc\CaracoleBundle\Model\Order; | namespace Lc\CaracoleBundle\Model\Order; | ||||
use Doctrine\Common\Collections\Collection; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | |||||
use Lc\CaracoleBundle\Model\Config\TaxRateInterface; | |||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\CaracoleBundle\Model\User\VisitorInterface; | |||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface OrderShopInterface | interface OrderShopInterface | ||||
{ | { | ||||
public function getValidationDate(): ?\DateTimeInterface; | |||||
public function setValidationDate(\DateTimeInterface $validationDate | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getUser(): ?UserInterface; | |||||
public function setUser(?UserInterface $user): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getInvoiceAddress(): ?AddressInterface; | |||||
public function setInvoiceAddress(?AddressInterface $invoiceAddress): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getInvoiceAddressText(): ?string; | |||||
public function setInvoiceAddressText(string $invoiceAddressText): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getComment(): ?string; | |||||
public function setComment(?string $comment): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getMeanPayment(): ?string; | |||||
public function setMeanPayment(string $meanPayment): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderStatusHistoryInterface[] | |||||
*/ | |||||
public function getOrderStatusHistories(): Collection; | |||||
public function addOrderStatusHistory(OrderStatusHistoryInterface $orderStatusHistory | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeOrderStatusHistory(OrderStatusHistoryInterface $orderStatusHistory | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderPaymentInterface[] | |||||
*/ | |||||
public function getOrderPayments($meanPayment = null): Collection; | |||||
public function addOrderPayment(OrderPaymentInterface $orderPayment): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeOrderPayment(OrderPaymentInterface $orderPayment | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderProductInterface[] | |||||
*/ | |||||
public function getOrderProducts(): Collection; | |||||
public function addOrderProduct(OrderProductInterface $orderProduct): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeOrderProduct(OrderProductInterface $orderProduct | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getVisitor(): ?VisitorInterface; | |||||
public function setVisitor(?VisitorInterface $visitor): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryInfos(): ?string; | |||||
public function setDeliveryInfos(?string $deliveryInfos): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getOrderStatus(): ?OrderStatusInterface; | |||||
public function setOrderStatusProtected(?OrderStatusInterface $orderStatus | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderReductionCartInterface[] | |||||
*/ | |||||
public function getOrderReductionCarts(): Collection; | |||||
public function addOrderReductionCart(OrderReductionCartInterface $orderReductionCart | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeOrderReductionCart(OrderReductionCartInterface $orderReductionCart | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderReductionCreditInterface[] | |||||
*/ | |||||
public function getOrderReductionCredits(): Collection; | |||||
public function addOrderReductionCredit(OrderReductionCreditInterface $orderReductionCredit | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeOrderReductionCredit(OrderReductionCreditInterface $orderReductionCredit | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|DocumentInterface[] | |||||
*/ | |||||
public function getDocuments(): Collection; | |||||
public function addDocument(DocumentInterface $document): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeDocument(DocumentInterface $document): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|TicketInterface[] | |||||
*/ | |||||
public function getTickets(): Collection; | |||||
public function addTicket(TicketInterface $ticket): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeTicket(TicketInterface $ticket): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getSection(): ?SectionInterface; | |||||
public function setSection(?SectionInterface $section): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getCycleId(): ?int; | |||||
public function setCycleId(?int $cycleId): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getCycleNumber(): ?int; | |||||
public function setCycleNumber(?int $cycleNumber): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getOrderShopCreatedAt(): ?\DateTimeInterface; | |||||
public function setOrderShopCreatedAt(?\DateTimeInterface $orderShopCreatedAt | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getIdValidOrder(): ?int; | |||||
public function setIdValidOrder(?int $idValidOrder): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryAddress(): ?AddressInterface; | |||||
public function setDeliveryAddress(?AddressInterface $deliveryAddress | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryAddressText(): ?string; | |||||
public function setDeliveryAddressText(string $deliveryAddressText): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryPointSale(): ?PointSaleInterface; | |||||
public function setDeliveryPointSale(?PointSaleInterface $deliveryPointSale | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryType(): ?string; | |||||
public function setDeliveryType(?string $deliveryType): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryPrice(): ?float; | |||||
public function setDeliveryPrice(?float $deliveryPrice): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeliveryTaxRate(): ?TaxRateInterface; | |||||
public function setDeliveryTaxRate(?TaxRateInterface $deliveryTaxRate | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getReference(): ?string; | |||||
public function setReference(?string $reference): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getMainOrderShop(): ?self; | |||||
public function setMainOrderShop(?self $mainOrderShop): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
/** | |||||
* @return Collection|OrderShopInterface[] | |||||
*/ | |||||
public function getComplementaryOrderShops(): Collection; | |||||
public function addComplementaryOrderShop(self $complementaryOrderShop | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function removeComplementaryOrderShop(self $complementaryOrderShop | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getDeclineComplementaryOrderShop(): ?bool; | |||||
public function setDeclineComplementaryOrderShop(?bool $declineComplementaryOrderShop | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getOrderAllowByAdmin(): ?bool; | |||||
public function setOrderAllowByAdmin(?bool $orderAllowByAdmin): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getHasReach(): ?int; | |||||
public function setHasReach(?int $hasReach): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatTotal(): ?float; | |||||
public function setStatTotal(?float $statTotal): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatTotalWithTax(): ?float; | |||||
public function setStatTotalWithTax(?float $statTotalWithTax): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatTotalOrderProductsWithReductions(): ?float; | |||||
public function setStatTotalOrderProductsWithReductions(?float $statTotalOrderProductsWithReductions | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatTotalOrderProductsWithTaxAndReductions(): ?float; | |||||
public function setStatTotalOrderProductsWithTaxAndReductions(?float $statTotalOrderProductsWithTaxAndReductions | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatMarginOrderProductsWithReductions(): ?float; | |||||
public function setStatMarginOrderProductsWithReductions(?float $statMarginOrderProductsWithReductions | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatDeliveryPriceWithReduction(): ?float; | |||||
public function setStatDeliveryPriceWithReduction(?float $statDeliveryPriceWithReduction | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
public function getStatDeliveryPriceWithTaxAndReduction(): ?float; | |||||
} | |||||
public function setStatDeliveryPriceWithTaxAndReduction(?float $statDeliveryPriceWithTaxAndReduction | |||||
): \Lc\CaracoleBundle\Model\Order\OrderShopModel; | |||||
} |
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class OrderShopModel extends AbstractLightEntity implements FilterSectionInterface | |||||
abstract class OrderShopModel extends AbstractLightEntity implements FilterSectionInterface, OrderShopInterface | |||||
{ | { | ||||
use BlameableNullableTrait; | use BlameableNullableTrait; | ||||
namespace Lc\CaracoleBundle\Model\Product; | namespace Lc\CaracoleBundle\Model\Product; | ||||
use Doctrine\Common\Collections\Collection; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface ProductCategoryInterface | interface ProductCategoryInterface | ||||
{ | { | ||||
public function getSection(): SectionInterface; | |||||
public function setSection(SectionInterface $section): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
public function getParent(): ?self; | |||||
public function setParent(?self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
public function getParentCategory(); | |||||
/** | |||||
* @return Collection|self[] | |||||
*/ | |||||
public function getChildrens(): Collection; | |||||
public function addChildren(self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
public function removeChildren(self $productCategory): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
/** | |||||
* @return Collection|ProductFamilyInterface[] | |||||
*/ | |||||
public function getProductFamilies(): Collection; | |||||
public function addProductFamily(ProductFamilyInterface $productFamily | |||||
): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
public function removeProductFamily(ProductFamilyInterface $productFamily | |||||
): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
public function countProductFamilies($status = null); | |||||
public function getSaleStatus(): ?bool; | |||||
} | |||||
public function setSaleStatus(bool $saleStatus): \Lc\CaracoleBundle\Model\Product\ProductCategoryModel; | |||||
} |
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterSectionInterface | |||||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterSectionInterface, ProductCategoryInterface | |||||
{ | { | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") |
namespace Lc\CaracoleBundle\Model\Product; | namespace Lc\CaracoleBundle\Model\Product; | ||||
use Doctrine\Common\Collections\Collection; | |||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Model\File\FileInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface ProductFamilyInterface | interface ProductFamilyInterface | ||||
{ | { | ||||
public function getBehaviorCountStockChoices(): array; | |||||
public function getBehaviorDisplaySaleChoices(): array; | |||||
public function getBehaviorStockCycleChoices(): array; | |||||
public function getWaringMessageTypeChoices(): array; | |||||
public function getBehaviorAddToCartChoices(): array; | |||||
public function getBehaviorPriceChoices(): array; | |||||
public function getPropertyOrganicLabelChoices(): array; | |||||
public function getTypeExpirationDateChoices(): array; | |||||
public function getBehaviorExpirationDateChoices(): array; | |||||
public function getSection(): SectionInterface; | |||||
public function setSection(SectionInterface $section): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getAvailableQuantityInherited(); | |||||
public function getTaxRateInherited(); | |||||
public function getActiveProducts(): ?bool; | |||||
public function setActiveProducts(bool $activeProducts): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getProductsQuantityAsTitle(): ?bool; | |||||
public function setProductsQuantityAsTitle(bool $productsQuantityAsTitle | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getProductsType(): ?string; | |||||
public function setProductsType(?string $productsType): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getQuantityLabel(): ?string; | |||||
public function setQuantityLabel(?string $quantityLabel): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
/** | |||||
* @return Collection|ProductInterface[] | |||||
*/ | |||||
public function getProducts(): Collection; | |||||
public function getProductsOnline(): Collection; | |||||
public function addProduct(ProductInterface $product): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function removeProduct(ProductInterface $product): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getReductionCatalog(): ?ReductionCatalogInterface; | |||||
public function getReductionCatalogInherited(): ?ReductionCatalogInterface; | |||||
public function setReductionCatalog(?ReductionCatalogInterface $reductionCatalog | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
/** | |||||
* @return Collection|ProductCategoryInterface[] | |||||
*/ | |||||
public function getProductCategories(): Collection; | |||||
public function initProductCategories(); | |||||
public function addProductCategory(ProductCategoryInterface $productCategory | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function removeProductCategory(ProductCategoryInterface $productCategory | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getProductCategoryParent(); | |||||
public function getProductCategoryChild(); | |||||
public function getSubtitle(): ?string; | |||||
public function setSubtitle(?string $subtitle): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getWarningMessage(): ?string; | |||||
public function setWarningMessage(?string $warningMessage): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getWarningMessageType(): ?string; | |||||
public function setWarningMessageType(?string $warningMessageType | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getNote(): ?string; | |||||
public function setNote(?string $note): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorOutOfStock(): ?string; | |||||
public function setBehaviorOutOfStock(?string $behaviorOutOfStock | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorCountStock(): ?string; | |||||
public function setBehaviorCountStock(string $behaviorCountStock | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getExportTitle(): ?string; | |||||
public function setExportTitle(?string $exportTitle): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getExportNote(): ?string; | |||||
public function setExportNote(?string $exportNote): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorStockWeek(): ?string; | |||||
public function setBehaviorStockWeek(string $behaviorStockWeek | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getAvailabilityRenewedThisWeek(): ?bool; | |||||
public function setAvailabilityRenewedThisWeek(?bool $availabilityRenewedThisWeek | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorDisplaySale(): ?string; | |||||
public function setBehaviorDisplaySale(string $behaviorDisplaySale | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function isPropertyNoveltyOnline(): ?bool; | |||||
public function getPropertyNoveltyExpirationDate(): ?\DateTimeInterface; | |||||
public function setPropertyNoveltyExpirationDate(?\DateTimeInterface $propertyNoveltyExpirationDate | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyOrganicLabel(): ?string; | |||||
public function setPropertyOrganicLabel(?string $propertyOrganicLabel | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyAllergens(): ?string; | |||||
public function setPropertyAllergens(?string $propertyAllergens | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyComposition(): ?string; | |||||
public function setPropertyComposition(?string $propertyComposition | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyFragrances(): ?string; | |||||
public function setPropertyFragrances(?string $propertyFragrances | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function countProperties(): bool; | |||||
public function getBehaviorExpirationDate(): ?string; | |||||
public function setBehaviorExpirationDate(?string $behaviorExpirationDate | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getTypeExpirationDate(): ?string; | |||||
public function setTypeExpirationDate(?string $typeExpirationDate | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyWeight(): ?string; | |||||
public function setPropertyWeight(?string $propertyWeight): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyQuantity(): ?string; | |||||
public function setPropertyQuantity(?string $propertyQuantity): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyVariety(): ?string; | |||||
public function setPropertyVariety(?string $propertyVariety): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyFeature(): ?string; | |||||
public function setPropertyFeature(?string $propertyFeature): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyAlcoholLevel(): ?string; | |||||
public function setPropertyAlcoholLevel(?string $propertyAlcoholLevel | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyPackaging(): ?string; | |||||
public function setPropertyPackaging(?string $propertyPackaging | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getPropertyCharacteristics(): ?string; | |||||
public function setPropertyCharacteristics(?string $propertyCharacteristics | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorAddToCart(): ?string; | |||||
public function setBehaviorAddToCart(?string $behaviorAddToCart | |||||
): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getBehaviorPrice(): ?string; | |||||
public function getBehaviorPriceInherited(); | |||||
public function setBehaviorPrice(?string $behaviorPrice): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function hasProductsWithVariousWeight(); | |||||
public function getProductsGroupByTitle(); | |||||
public function getOriginProduct(); | |||||
public function getOriginProductOnline(); | |||||
public function hasOneProductOnline(); | |||||
public function getSaleStatus(): ?bool; | |||||
public function setSaleStatus(bool $saleStatus): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
public function getFieldBuyingPrice(); | |||||
public function getFieldPrice(); | |||||
public function getImage(): ?FileInterface; | |||||
} | |||||
public function setImage(?FileInterface $image): \Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
} |
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | ||||
FilterSectionInterface | |||||
FilterSectionInterface, ProductFamilyInterface | |||||
{ | { | ||||
use ProductPropertyTrait; | use ProductPropertyTrait; | ||||
use BlameableNullableTrait; | use BlameableNullableTrait; |
namespace Lc\CaracoleBundle\Model\Product; | namespace Lc\CaracoleBundle\Model\Product; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
interface ProductInterface | interface ProductInterface | ||||
{ | { | ||||
public function getQuantityMaxAddCart(OrderShopInterface $orderShop); | |||||
public function getProductQuantity(); | |||||
public function getBuyingPriceInherited(); | |||||
public function getBuyingPriceByRefUnitInherited(); | |||||
public function getPriceInherited(); | |||||
public function getPriceByRefUnitInherited(); | |||||
public function getBehaviorPriceInherited(); | |||||
public function getReductionCatalogInherited(); | |||||
public function getUnitInherited(); | |||||
public function getTitleInherited(); | |||||
public function getQuantityInherited(); | |||||
public function getQuantityLabelInherited(); | |||||
public function getQuantityTitle($productFamily); | |||||
public function getAvailableQuantityInherited(); | |||||
public function getTaxRateInherited(); | |||||
public function getProductFamily(): ?ProductFamilyInterface; | |||||
public function setProductFamily(?ProductFamilyInterface $productFamily | |||||
): \Lc\CaracoleBundle\Model\Product\ProductModel; | |||||
public function getTitle(): ?string; | |||||
public function setTitle(?string $title): \Lc\CaracoleBundle\Model\Product\ProductModel; | |||||
public function getOriginProduct(): ?bool; | |||||
public function setOriginProduct(?bool $originProduct): \Lc\CaracoleBundle\Model\Product\ProductModel; | |||||
public function getExportTitle(): ?string; | |||||
public function getExportTitleInherited(): ?string; | |||||
public function setExportTitle(?string $exportTitle): \Lc\CaracoleBundle\Model\Product\ProductModel; | |||||
public function getExportNote(): ?string; | |||||
public function getExportNoteInherited(): ?string; | |||||
} | |||||
public function setExportNote(?string $exportNote): \Lc\CaracoleBundle\Model\Product\ProductModel; | |||||
} |
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class ProductModel extends AbstractLightEntity implements SortableInterface, ProductPropertyInterface, | abstract class ProductModel extends AbstractLightEntity implements SortableInterface, ProductPropertyInterface, | ||||
PriceInterface | |||||
PriceInterface, ProductInterface | |||||
{ | { | ||||
use SortableTrait; | use SortableTrait; | ||||
use ProductPropertyTrait; | use ProductPropertyTrait; |
namespace Lc\CaracoleBundle\Repository\Address; | namespace Lc\CaracoleBundle\Repository\Address; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class AddressStore extends AbstractStore | class AddressStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Config; | namespace Lc\CaracoleBundle\Repository\Config; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class TaxRateStore extends AbstractStore | class TaxRateStore extends AbstractStore | ||||
{ | { | ||||
use MerchantStoreTrait; | |||||
protected TaxRateRepositoryQuery $query; | protected TaxRateRepositoryQuery $query; | ||||
public function __construct(TaxRateRepositoryQuery $query) | public function __construct(TaxRateRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getAsArray(MerchantInterface $merchant, $query = null) | |||||
public function getAsArray($query = null) | |||||
{ | { | ||||
$taxRates = $this->createQuery($query)->find(); | |||||
$taxRates = $this->createDefaultQuery($query)->find(); | |||||
$taxRatesList = []; | $taxRatesList = []; | ||||
$taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue(); | $taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue(); | ||||
} | } | ||||
$taxRatesList['default']['title'] = $merchant->getTaxRate()->getTitle(); | |||||
$taxRatesList['default']['value'] = $merchant->getTaxRate()->getValue(); | |||||
$taxRatesList['default']['title'] = $this->merchant->getTaxRate()->getTitle(); | |||||
$taxRatesList['default']['value'] = $this->merchant->getTaxRate()->getValue(); | |||||
return $taxRatesList; | return $taxRatesList; | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Config; | namespace Lc\CaracoleBundle\Repository\Config; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class UnitStore extends AbstractStore | class UnitStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getAsArray($query = null) | public function getAsArray($query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
foreach ($query->find() as $unit) { | foreach ($query->find() as $unit) { | ||||
$unitsList[$unit->getId()]['unit'] = $unit->getUnit(); | $unitsList[$unit->getId()]['unit'] = $unit->getUnit(); |
use App\Entity\Merchant\Merchant; | use App\Entity\Merchant\Merchant; | ||||
use App\Entity\User\UserMerchant; | use App\Entity\User\UserMerchant; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
use DateTime; | use DateTime; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function filterByJoinUserMerchant(Merchant $merchant): self | |||||
public function filterByMerchant(MerchantInterface $merchant): self | |||||
{ | { | ||||
$this->joinUserMerchant(); | $this->joinUserMerchant(); | ||||
return $this | return $this | ||||
->andWhere('um.merchant = :merchant') | |||||
->setParameter('merchant', $merchant); | |||||
->andWhereMerchant('um', $merchant); | |||||
} | } | ||||
public function filterByUserMerchant(UserMerchant $userMerchant): self | |||||
public function filterByUserMerchant(UserMerchantInterface $userMerchant): self | |||||
{ | { | ||||
return $this | return $this | ||||
->andWhere('.userMerchant = :userMerchant') | ->andWhere('.userMerchant = :userMerchant') |
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use DateTime; | use DateTime; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class CreditHistoryStore extends AbstractStore | class CreditHistoryStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('createdAt'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
//findAllByDateStartEnd | //findAllByDateStartEnd | ||||
public function getByDateStartEnd(DateTime $dateStart, DateTime $dateEnd, $query = null): array | public function getByDateStartEnd(DateTime $dateStart, DateTime $dateEnd, $query = null): array | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterByJoinUserMerchant($this->merchant) | |||||
->filterByDateStart($dateStart) | ->filterByDateStart($dateStart) | ||||
->filterByDateEnd($dateEnd) | |||||
->orderBy('.createdAt'); | |||||
->filterByDateEnd($dateEnd); | |||||
return $query->find(); | return $query->find(); | ||||
} | } | ||||
//findAllByUserMerchant | //findAllByUserMerchant | ||||
public function getByUserMerchant(UserMerchant $userMerchant, $query = null): array | public function getByUserMerchant(UserMerchant $userMerchant, $query = null): array | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterByUserMerchant($userMerchant) | ->filterByUserMerchant($userMerchant) | ||||
->orderBy('.createdAt', 'DESC'); | |||||
->orderBy('createdAt', 'DESC'); | |||||
return $query->find(); | return $query->find(); | ||||
} | } |
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class DocumentStore extends AbstractStore | class DocumentStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterIsOnlineAndOffline(); | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getOneLatestByType(string $documentType, $query = null) | public function getOneLatestByType(string $documentType, $query = null) | ||||
{ | { | ||||
// @TODO : à écrire | // @TODO : à écrire | ||||
// findLastInvoice | // findLastInvoice | ||||
public function getOneLastInvoice($query = null) | public function getOneLastInvoice($query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterBySection($this->section) | |||||
->orderBy('.createdAt', 'DESC'); | |||||
->orderBy('createdAt', 'DESC'); | |||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } | ||||
public function getByBuyerAddress(Address $buyerAddress, $query = null) | public function getByBuyerAddress(Address $buyerAddress, $query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByBuyerAddress($buyerAddress); | $query->filterByBuyerAddress($buyerAddress); | ||||
return $query->find(); | return $query->find(); | ||||
} | } |
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class MerchantStore extends AbstractStore | class MerchantStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function getOnline($query = null) | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->filterIsOnline(); | |||||
return $query->find(); | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Newsletter; | namespace Lc\CaracoleBundle\Repository\Newsletter; | ||||
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | ||||
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait; | |||||
use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery as SovNewsletterRepositoryQuery; | use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery as SovNewsletterRepositoryQuery; | ||||
class NewsletterRepositoryQuery extends SovNewsletterRepositoryQuery | class NewsletterRepositoryQuery extends SovNewsletterRepositoryQuery | ||||
{ | { | ||||
use MerchantRepositoryQueryTrait; | |||||
use SectionRepositoryQueryTrait; | |||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\Newsletter; | |||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\Newsletter\NewsletterStore as SovNewsletterStore; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class NewsletterStore extends SovNewsletterStore | |||||
{ | |||||
use SectionStoreTrait; | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('position'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderPaymentStore extends AbstractStore | class OrderPaymentStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderProductReductionCatalogStore extends AbstractStore | class OrderProductReductionCatalogStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderProductRefundStore extends AbstractStore | class OrderProductRefundStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | use Lc\CaracoleBundle\Model\Order\OrderProductInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderProductStore extends AbstractStore | class OrderProductStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderReductionCartStore extends AbstractStore | class OrderReductionCartStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderReductionCreditStore extends AbstractStore | class OrderReductionCreditStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderRefundStore extends AbstractStore | class OrderRefundStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
->setParameter('cycleNumber', $cycleNumber); | ->setParameter('cycleNumber', $cycleNumber); | ||||
} | } | ||||
public function filterIsNotMainOrderShop(): self | |||||
public function filterIsNotComplementaryOrderShop(): self | |||||
{ | { | ||||
return $this | return $this | ||||
->andWhere('.mainOrderShop = false OR .mainOrderShop IS NULL'); | |||||
->andWhere('.mainOrderShop = false OR .mainOrderShop IS NULL'); | |||||
} | } | ||||
public function filterIsNullMainOrderShop(): self | public function filterIsNullMainOrderShop(): self |
use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | use Lc\CaracoleBundle\Model\Order\OrderStatusModel; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; | use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; | ||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | ||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | use Lc\CaracoleBundle\Solver\Price\PriceSolver; | ||||
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | |||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||||
protected PriceSolver $priceSolver; | protected PriceSolver $priceSolver; | ||||
protected DocumentBuilder $documentBuilder; | protected DocumentBuilder $documentBuilder; | ||||
protected ReductionCreditStore $reductionCreditStore; | protected ReductionCreditStore $reductionCreditStore; | ||||
protected ReductionCartSolver $reductionCartSolver; | |||||
protected SectionStore $sectionStore; | protected SectionStore $sectionStore; | ||||
protected OrderProductStore $orderProductStore; | protected OrderProductStore $orderProductStore; | ||||
protected MerchantStore $merchantStore; | protected MerchantStore $merchantStore; | ||||
PriceSolver $priceSolver, | PriceSolver $priceSolver, | ||||
DocumentBuilder $documentBuilder, | DocumentBuilder $documentBuilder, | ||||
ReductionCreditStore $reductionCreditStore, | ReductionCreditStore $reductionCreditStore, | ||||
ReductionCartSolver $reductionCartSolver, | |||||
SectionStore $sectionStore, | SectionStore $sectionStore, | ||||
OrderProductStore $orderProductStore, | OrderProductStore $orderProductStore, | ||||
MerchantStore $merchantStore, | MerchantStore $merchantStore, | ||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
$this->documentBuilder = $documentBuilder; | $this->documentBuilder = $documentBuilder; | ||||
$this->reductionCreditStore = $reductionCreditStore; | $this->reductionCreditStore = $reductionCreditStore; | ||||
$this->reductionCartSolver = $reductionCartSolver; | |||||
$this->sectionStore = $sectionStore; | $this->sectionStore = $sectionStore; | ||||
$this->orderProductStore = $orderProductStore; | $this->orderProductStore = $orderProductStore; | ||||
$this->merchantStore = $merchantStore; | $this->merchantStore = $merchantStore; | ||||
$this->orderShopSolver = $orderShopSolver; | $this->orderShopSolver = $orderShopSolver; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
// getOrderShopsOfWeek | // getOrderShopsOfWeek | ||||
public function getByCurrentCycle($params = [], $query = null) | public function getByCurrentCycle($params = [], $query = null) | ||||
{ | { | ||||
$orderShops = $this->getBy( | $orderShops = $this->getBy( | ||||
array_merge( | array_merge( | ||||
[ | [ | ||||
'section' => $this->section, | |||||
'cycleNumber' => $this->getCycleNumberCurrentOrder($this->section), | 'cycleNumber' => $this->getCycleNumberCurrentOrder($this->section), | ||||
'isValid' => true, | 'isValid' => true, | ||||
], | ], | ||||
[ | [ | ||||
'user' => $user, | 'user' => $user, | ||||
'isValid' => true, | 'isValid' => true, | ||||
'section' => $this->section, | |||||
'excludeComplementaryOrderShops' => true | 'excludeComplementaryOrderShops' => true | ||||
], | ], | ||||
$query | $query | ||||
[ | [ | ||||
'cycleNumber' => $this->getCycleNumberCurrentOrder($this->section), | 'cycleNumber' => $this->getCycleNumberCurrentOrder($this->section), | ||||
'isValid' => true, | 'isValid' => true, | ||||
'section' => $this->section, | |||||
'excludeComplementaryOrderShops' => true | 'excludeComplementaryOrderShops' => true | ||||
], | ], | ||||
$query | $query | ||||
UserInterface $user = null, | UserInterface $user = null, | ||||
$query = null | $query = null | ||||
): int { | ): int { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
if ($user) { | if ($user) { | ||||
$query->filterByUser($user); | $query->filterByUser($user); | ||||
$query | $query | ||||
->selectCount() | ->selectCount() | ||||
->filterByReductionCredit($reductionCredit) | ->filterByReductionCredit($reductionCredit) | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | |||||
->filterBySection($this->section); | |||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid); | |||||
return $query->count(); | return $query->count(); | ||||
} | } | ||||
ReductionCartInterface $reductionCart, | ReductionCartInterface $reductionCart, | ||||
$query = null | $query = null | ||||
): int { | ): int { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->selectCount() | ->selectCount() | ||||
->filterByReductionCart($reductionCart) | ->filterByReductionCart($reductionCart) | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | |||||
->filterBySection($this->section); | |||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid); | |||||
return $query->count(); | return $query->count(); | ||||
} | } | ||||
UserInterface $user, | UserInterface $user, | ||||
$query = null | $query = null | ||||
): int { | ): int { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->selectCount() | ->selectCount() | ||||
->filterByUser($user) | ->filterByUser($user) | ||||
->filterByReductionCart($reductionCart) | ->filterByReductionCart($reductionCart) | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | |||||
->filterBySection($this->section); | |||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid); | |||||
return $query->count(); | return $query->count(); | ||||
} | } | ||||
// findCartCurrent | // findCartCurrent | ||||
public function getCartCurrent(array $params, $query = null): ?OrderShopInterface | |||||
public function getOneCartCurrent(array $params, $query = null): ?OrderShopInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
if (isset($params['user'])) { | if (isset($params['user'])) { | ||||
$query->filterByUser($params['user']); | $query->filterByUser($params['user']); | ||||
} | } | ||||
if (isset($params['visitor'])) { | if (isset($params['visitor'])) { | ||||
$query->filterByVisitor($params['visitor']); | $query->filterByVisitor($params['visitor']); | ||||
} | } | ||||
$query | $query | ||||
->selectOrderReductionCarts() | ->selectOrderReductionCarts() | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | |||||
->filterBySection($this->section); | |||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid); | |||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } | ||||
// findLastOrderValidOfWeek | // findLastOrderValidOfWeek | ||||
public function getOneLastValidByCycle(int $cycleNumber, $query = null): ?OrderShopInterface | public function getOneLastValidByCycle(int $cycleNumber, $query = null): ?OrderShopInterface | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterByCycleNumber($cycleNumber) | ->filterByCycleNumber($cycleNumber) | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | ->filterByStatus(OrderStatusModel::$statusAliasAsValid) | ||||
->filterIsNotMainOrderShop() | |||||
->orderBy('.cycleId', 'DESC') | |||||
->filterBySection($this->section); | |||||
->filterIsNotComplementaryOrderShop() | |||||
->orderBy('.cycleId', 'DESC'); | |||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } | ||||
//findLastOrderValid | //findLastOrderValid | ||||
public function getOneLastValid($query = null): ?OrderShopInterface | public function getOneLastValid($query = null): ?OrderShopInterface | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterByStatus(OrderStatusModel::$statusAliasAsValid) | ->filterByStatus(OrderStatusModel::$statusAliasAsValid) | ||||
->filterIsNotMainOrderShop() | |||||
->orderBy('.idValidOrder', 'DESC') | |||||
->filterBySection($this->section); | |||||
->filterIsNotComplementaryOrderShop() | |||||
->orderBy('.idValidOrder', 'DESC'); | |||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } | ||||
public function countBy(array $params = [], $query = null) | public function countBy(array $params = [], $query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->selectCount() | ->selectCount() | ||||
public function getBy(array $params = [], $query = null): array | public function getBy(array $params = [], $query = null): array | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$this->applyGetByFilters($query); | $this->applyGetByFilters($query); | ||||
protected function applyGetByFilters($query) | protected function applyGetByFilters($query) | ||||
{ | { | ||||
if (isset($params['section'])) { | |||||
$query->filterBySection($params['section']); | |||||
} else { | |||||
$query->filterBySection($this->section); | |||||
} | |||||
if (isset($params['isMerchantOnline'])) { | if (isset($params['isMerchantOnline'])) { | ||||
$query->filterIsMerchantOnline(); | $query->filterIsMerchantOnline(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public function isReductionCreditUsed(ReductionCreditInterface $reductionCredit, UserInterface $user = null, $query = null) | |||||
{ | |||||
public function isReductionCreditUsed( | |||||
ReductionCreditInterface $reductionCredit, | |||||
UserInterface $user = null, | |||||
$query = null | |||||
) { | |||||
if ($this->countValidWithReductionCredit($reductionCredit, $user, $query)) { | if ($this->countValidWithReductionCredit($reductionCredit, $user, $query)) { | ||||
return true; | return true; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
public function getReductionCreditsAvailableByUser(UserInterface $user): array | |||||
{ | |||||
$reductionCredits = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_CREDIT, $user); | |||||
$reductionCreditsArray = []; | |||||
foreach ($reductionCredits as $reductionCredit) { | |||||
if (!$this->countValidWithReductionCredit($reductionCredit, $user)) { | |||||
$reductionCreditsArray[] = $reductionCredit; | |||||
} | |||||
} | |||||
return $reductionCreditsArray; | |||||
} | |||||
public function getReductionGiftsAvailableByUser($user): array | |||||
{ | |||||
$reductionGifts = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_GIFT, $user); | |||||
$reductionGiftsArray = []; | |||||
foreach ($reductionGifts as $reductionGift) { | |||||
if (!$this->countValidWithReductionCredit($reductionGift)) { | |||||
$reductionGiftsArray[] = $reductionGift; | |||||
} | |||||
} | |||||
return $reductionGiftsArray; | |||||
} | |||||
// getReductionCartRemainingQuantity | |||||
public function getReductionCartRemainingQuantity(ReductionCartInterface $reductionCart): float | |||||
{ | |||||
return $reductionCart->getAvailableQuantity() - $this->countValidWithReductionCart( | |||||
$reductionCart | |||||
); | |||||
} | |||||
// getReductionCartUsedQuantityPerUser | |||||
public function getReductionCartUsedQuantityByUser(ReductionCartInterface $reductionCart, UserInterface $user): float | |||||
{ | |||||
return $this->countValidWithReductionCartByUser($reductionCart, $user); | |||||
} | |||||
// getReductionCartUsedQuantity | |||||
public function getReductionCartUsedQuantity(ReductionCartInterface $reductionCart): float | |||||
{ | |||||
return $this->countValidWithReductionCart($reductionCart); | |||||
} | |||||
// getReductionCartRemainingQuantityPerUser | |||||
public function getReductionCartRemainingQuantityByUser(ReductionCartInterface $reductionCart, UserInterface $user): float | |||||
{ | |||||
if ($reductionCart->getAvailableQuantityPerUser()) { | |||||
return $reductionCart->getAvailableQuantityPerUser( | |||||
) - $this->countValidWithReductionCartByUser($reductionCart, $user); | |||||
} | |||||
return false; | |||||
} | |||||
// findAllAvailableForUser / getReductionCartsAvailableByUser | |||||
public function getReductionCartAvailableByUser(UserInterface $user, $query = null) | |||||
{ | |||||
$query = $this->createQuery($query); | |||||
$reductionCarts = $query->find(); | |||||
$reductionCartsArray = []; | |||||
foreach ($reductionCarts as $reductionCart) { | |||||
if ($this->reductionCartSolver->matchWithUser($user) | |||||
&& $this->reductionCartSolver->matchWithGroupUser($user) | |||||
&& $this->getRemainingQuantityByUser($reductionCart, $user) | |||||
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)) { | |||||
$reductionCartsArray[] = $reductionCart; | |||||
} | |||||
} | |||||
return $reductionCartsArray; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderStatusHistoryStore extends AbstractStore | class OrderStatusHistoryStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Order; | namespace Lc\CaracoleBundle\Repository\Order; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OrderStatusStore extends AbstractStore | class OrderStatusStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class PointSaleStore extends AbstractStore | class PointSaleStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('position'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ProductCategoryStore extends AbstractStore | class ProductCategoryStore extends AbstractStore | ||||
{ | { | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('position'); | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault($query): RepositoryQueryInterface | |||||
{ | |||||
$query->joinProductFamilies(); | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Product; | namespace Lc\CaracoleBundle\Repository\Product; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | |||||
class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQuery | |||||
{ | { | ||||
protected bool $isJoinProductCategories; | |||||
protected bool $isJoinProducts; | |||||
public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator) | public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function joinProductCategories(): self | |||||
{ | |||||
if (!$this->isJoinProductCategories) { | |||||
$this->isJoinProductCategories = true; | |||||
return $this | |||||
->leftJoin('.productCategories', 'cat'); | |||||
//$query->addSelect('cat') ; ??? | |||||
} | |||||
return $this; | |||||
} | |||||
public function joinProducts(): self | |||||
{ | |||||
if (!$this->isJoinProducts) { | |||||
$this->isJoinProducts = true; | |||||
return $this | |||||
->innerJoin('.products', 'pfp'); | |||||
// $query->addSelect('pfp') ; ????? | |||||
} | |||||
return $this; | |||||
} | |||||
public function orderByPosition(): self | |||||
{ | |||||
$this->orderBy('e.position', 'ASC'); | |||||
return $this; | |||||
} | |||||
public function filterByProductCategory(ProductCategoryInterface $category): self | |||||
{ | |||||
$this->joinProductCategories(); | |||||
return $this | |||||
->andWhere(':category MEMBER OF .productCategories') | |||||
->setParameter('category', $category->getId()); | |||||
} | |||||
public function filterByPropertyNoveltyExpirationDate($dateTime = null): self | |||||
{ | |||||
if (is_null($dateTime)) { | |||||
$dateTime = new \DateTime(); | |||||
} | |||||
return $this->andWhere(':now <= e.propertyNoveltyExpirationDate') | |||||
->setParameter('now', $dateTime); | |||||
} | |||||
public function filterPropertyLargeVolume(): self | |||||
{ | |||||
return $this->andWhere('.propertyLargeVolume = 1'); | |||||
} | |||||
public function filterPropertyOrganicLabel(): self | |||||
{ | |||||
return $this->andWhere('.propertyOrganicLabel IS NOT NULL'); | |||||
} | |||||
public function filterByTerms($terms): self | |||||
{ | |||||
$this->andWhere('.title LIKE :terms OR cat.title LIKE :terms'); | |||||
$this->setParameter(':terms', '%'.$terms.'%') ; | |||||
return $this; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Product; | namespace Lc\CaracoleBundle\Repository\Product; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | |||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\CaracoleBundle\Resolver\Price\PriceResolver; | |||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | use Lc\CaracoleBundle\Solver\Price\PriceSolver; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ProductFamilyStore extends AbstractStore | class ProductFamilyStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('position'); | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault($query): RepositoryQueryInterface | |||||
{ | |||||
$query->joinProductCategories(); | |||||
$query->joinProducts(); | |||||
return $query; | |||||
} | |||||
//getProductFamiliesByCategory | |||||
public function getByCategory(ProductCategoryInterface $productCategory, $query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterIsOnline() | |||||
->filterByProductCategory($productCategory); | |||||
return $query->find(); | |||||
} | |||||
//getProductFamiliesNovelties | |||||
public function getByNovelties($query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterByPropertyNoveltyExpirationDate() | |||||
->filterIsOnline(); | |||||
return $query->find(); | |||||
} | |||||
//getProductFamiliesLargeVolumes | |||||
public function getLargeVolumes($query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterPropertyLargeVolume() | |||||
->filterIsOnline(); | |||||
return $query->find(); | |||||
} | |||||
//getProductFamiliesOrganics | |||||
public function getOrganics($query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterPropertyOrganicLabel() | |||||
->filterIsOnline(); | |||||
return $query->find(); | |||||
} | |||||
//findByTerms | |||||
public function getByTerms($terms, $maxResults = false, $query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterIsOnline(); | |||||
$query->groupBy('id'); | |||||
if($maxResults) { | |||||
$query->limit($maxResults); | |||||
} | |||||
return $query->find(); | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Product; | namespace Lc\CaracoleBundle\Repository\Product; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ProductRepositoryQuery extends AbstractRepositoryQuery | class ProductRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
protected bool $isJoinProductFamily; | |||||
public function __construct(ProductRepository $repository, PaginatorInterface $paginator) | public function __construct(ProductRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function orderByDefault(): \Lc\SovBundle\Repository\AbstractRepositoryQuery | |||||
{ | |||||
return $this->orderBy('position', 'ASC'); | |||||
} | |||||
public function joinProductFamily():self | |||||
{ | |||||
if (!$this->isJoinProductFamily) { | |||||
$this->isJoinProductFamily = true; | |||||
return $this | |||||
->innerJoin('.productFamily', 'pf'); | |||||
//$qb->addSelect('pf'); ??? | |||||
} | |||||
return $this; | |||||
} | |||||
public function filterBySection(SectionInterface $section):self | |||||
{ | |||||
$this->joinProductFamily(); | |||||
$this->andWhereSection('pf', $section); | |||||
return $this; | |||||
} | |||||
public function filterIsOnline():self | |||||
{ | |||||
$this->joinProductFamily(); | |||||
$this->andWhereStatus('pf', 1); | |||||
return $this; | |||||
} | |||||
public function filterBehaviorCountStock() :self | |||||
{ | |||||
$this->andWhere( | |||||
$this->expr()->orX( | |||||
$this->expr()->andX( | |||||
$this->expr()->orX( | |||||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily', | |||||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure' | |||||
), | |||||
'productFamily.availableQuantity < 0 ' | |||||
), | |||||
$this->expr()->andX( | |||||
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct', | |||||
'e.availableQuantity < 0 ' | |||||
) | |||||
) | |||||
); | |||||
$this->setParameter( | |||||
'behaviorCountStockByProductFamily', | |||||
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY | |||||
); | |||||
$this->setParameter('behaviorCountStockByMeasure', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE); | |||||
$this->setParameter('behaviorCountStockByProduct', ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT); | |||||
return $this; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Product; | namespace Lc\CaracoleBundle\Repository\Product; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ProductStore extends AbstractStore | class ProductStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected ProductRepositoryQuery $query; | protected ProductRepositoryQuery $query; | ||||
public function __construct(ProductRepositoryQuery $query) | public function __construct(ProductRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query) :RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function filtersDefault($query):RepositoryQueryInterface | |||||
{ | |||||
$query->filterIsOnlineAndOffline(); | |||||
$query->filterBySection($this->section); | |||||
} | |||||
public function relationsDefault($query):RepositoryQueryInterface | |||||
{ | |||||
return $query->joinProductFamily(); | |||||
} | |||||
//findProductByAvailabilitiesNegative | |||||
public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterIsOnline(); | |||||
$query->filterBehaviorCountStock(); | |||||
$query->groupBy('pf.id'); | |||||
return $query->find(); | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | use Lc\CaracoleBundle\Solver\Price\PriceSolver; | ||||
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||||
class ReductionCartStore extends AbstractStore | class ReductionCartStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected ReductionCartRepositoryQuery $query; | protected ReductionCartRepositoryQuery $query; | ||||
protected ReductionCartSolver $reductionCartSolver; | protected ReductionCartSolver $reductionCartSolver; | ||||
protected OrderShopStore $orderShopStore; | |||||
protected PriceSolver $priceSolver; | protected PriceSolver $priceSolver; | ||||
protected FlashBagInterface $flashBag; | protected FlashBagInterface $flashBag; | ||||
public function __construct( | public function __construct( | ||||
ReductionCartRepositoryQuery $query, | ReductionCartRepositoryQuery $query, | ||||
ReductionCartSolver $reductionCartSolver, | ReductionCartSolver $reductionCartSolver, | ||||
OrderShopStore $orderShopStore, | |||||
PriceSolver $priceSolver, | PriceSolver $priceSolver, | ||||
FlashBagInterface $flashBag, | FlashBagInterface $flashBag, | ||||
) { | ) { | ||||
$this->query = $query; | $this->query = $query; | ||||
$this->reductionCartSolver = $reductionCartSolver; | $this->reductionCartSolver = $reductionCartSolver; | ||||
$this->orderShopStore = $orderShopStore; | |||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
$this->flashBag = $flashBag; | $this->flashBag = $flashBag; | ||||
} | } | ||||
// getReductionCartByCode | |||||
public function getByCode(string $code, $query = null) | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->filterByCode($code); | |||||
$reductionCarts = $query->find(); | |||||
$findReductionCart = null; | |||||
foreach ($reductionCarts as $reductionCart) { | |||||
if ($reductionCart && in_array($code, $reductionCart->getCodes())) { | |||||
$findReductionCart = $reductionCart; | |||||
} | |||||
} | |||||
return $findReductionCart; | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | } | ||||
// getReductionCartRemainingQuantity | |||||
public function getRemainingQuantity(ReductionCartInterface $reductionCart): float | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
return $reductionCart->getAvailableQuantity() - $this->orderShopStore->countValidWithReductionCart( | |||||
$reductionCart | |||||
); | |||||
$query->filterBySection($this->section); | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | } | ||||
// getReductionCartUsedQuantityPerUser | |||||
public function getUsedQuantityByUser(ReductionCartInterface $reductionCart, UserInterface $user): float | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
return $this->orderShopStore->countValidWithReductionCartByUser($reductionCart, $user); | |||||
return $query; | |||||
} | } | ||||
// getReductionCartUsedQuantity | |||||
public function getUsedQuantity(ReductionCartInterface $reductionCart): float | |||||
{ | |||||
return $this->orderShopStore->countValidWithReductionCart($reductionCart); | |||||
} | |||||
// getReductionCartRemainingQuantityPerUser | |||||
public function getRemainingQuantityByUser(ReductionCartInterface $reductionCart, UserInterface $user): float | |||||
{ | |||||
if ($reductionCart->getAvailableQuantityPerUser()) { | |||||
return $reductionCart->getAvailableQuantityPerUser( | |||||
) - $this->orderShopStore->countValidWithReductionCartByUser($reductionCart, $user); | |||||
} | |||||
return false; | |||||
} | |||||
// findAllAvailableForUser / getReductionCartsAvailableByUser | |||||
public function getAvailableByUser(UserInterface $user, $query = null) | |||||
// getReductionCartByCode | |||||
public function getByCode(string $code, $query = null) | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByCode($code); | |||||
$reductionCarts = $query->find(); | $reductionCarts = $query->find(); | ||||
$reductionCartsArray = []; | |||||
$findReductionCart = null; | |||||
foreach ($reductionCarts as $reductionCart) { | foreach ($reductionCarts as $reductionCart) { | ||||
if ($this->reductionCartSolver->matchWithUser($user) | |||||
&& $this->reductionCartSolver->matchWithGroupUser($user) | |||||
&& $this->getRemainingQuantityByUser($reductionCart, $user) | |||||
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)) { | |||||
$reductionCartsArray[] = $reductionCart; | |||||
if ($reductionCart && in_array($code, $reductionCart->getCodes())) { | |||||
$findReductionCart = $reductionCart; | |||||
} | } | ||||
} | } | ||||
return $reductionCartsArray; | |||||
return $findReductionCart; | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Reduction; | namespace Lc\CaracoleBundle\Repository\Reduction; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ReductionCatalogStore extends AbstractStore | class ReductionCatalogStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected ReductionCatalogRepositoryQuery $query; | protected ReductionCatalogRepositoryQuery $query; | ||||
public function __construct(ReductionCatalogRepositoryQuery $query) | public function __construct(ReductionCatalogRepositoryQuery $query) | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null) | public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterProductFamily($productFamily) | ->filterProductFamily($productFamily) | ||||
->filterIsOnline(); | ->filterIsOnline(); |
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ReductionCreditStore extends AbstractStore | class ReductionCreditStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected ReductionCreditRepositoryQuery $query; | protected ReductionCreditRepositoryQuery $query; | ||||
public function __construct( | public function __construct( | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
$query->filterIsOnlineAndOffline(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
// findReductionCreditsByUser | // findReductionCreditsByUser | ||||
public function getByTypeAndUser(string $type, UserInterface $user, $query = null) | public function getByTypeAndUser(string $type, UserInterface $user, $query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | $query | ||||
->filterByType($type) | ->filterByType($type) |
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore; | use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class ReminderStore extends SovReminderStore | class ReminderStore extends SovReminderStore | ||||
{ | { | ||||
use SectionStoreTrait; | use SectionStoreTrait; | ||||
use MerchantStoreTrait; | use MerchantStoreTrait; | ||||
public function get($params = [], $query = null) | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
if ($this->merchant) { | |||||
$query->filterByMerchant($this->merchant); | |||||
} | |||||
if ($this->section) { | |||||
$query->filterBySection($this->section); | |||||
} | |||||
return parent::get($params, $query); | |||||
} | |||||
public function getByUser(UserInterface $user, $query = null): array | |||||
{ | |||||
$query = $this->createQuery($query); | |||||
if ($this->merchant) { | |||||
$query->filterByMerchant($this->merchant); | |||||
} | |||||
if ($this->section) { | |||||
$query->filterBySection($this->section); | |||||
} | |||||
return parent::getByUser($user, $query); | |||||
} | |||||
public function getByEasyAdminConfigAndUser( | |||||
string $crudAction, | |||||
string $crudControllerFqcn, | |||||
UserInterface $user, | |||||
int $entityId = null, | |||||
$query = null | |||||
): array { | |||||
$query = $this->createQuery($query); | |||||
if ($this->merchant) { | if ($this->merchant) { | ||||
$query->filterByMerchant($this->merchant); | $query->filterByMerchant($this->merchant); | ||||
} | } | ||||
$query->filterBySection($this->section); | $query->filterBySection($this->section); | ||||
} | } | ||||
return parent::getByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId, $query); | |||||
return parent::filtersDefault($query); | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Section; | namespace Lc\CaracoleBundle\Repository\Section; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class OpeningStore extends AbstractStore | class OpeningStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected OpeningRepositoryQuery $query; | protected OpeningRepositoryQuery $query; | ||||
public function __construct(OpeningRepositoryQuery $query) | public function __construct(OpeningRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('day'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function filterByIsDefault(bool $isDefault) | |||||
{ | |||||
return $this | |||||
->andWhere('.isDefault = :isDefault') | |||||
->setParameter('isDefault', $isDefault); | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Section; | namespace Lc\CaracoleBundle\Repository\Section; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||
class SectionStore extends AbstractStore | class SectionStore extends AbstractStore | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
// getSection | |||||
public function getOneByDevAlias(string $devAlias, $query = null): ?SectionInterface | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->orderBy('position'); | |||||
return $query; | |||||
} | |||||
$query | |||||
->filterByMerchant($this->merchant) | |||||
->filterByDevAlias($devAlias); | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
$section = $query->findOne(); | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getOneDefault($query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByIsDefault(true); | |||||
return $query->findOne(); | |||||
} | |||||
// getSection | |||||
public function getOneByDevAlias(string $devAlias, bool $isOnline = true, $query = null): ?SectionInterface | |||||
{ | |||||
$section = parent::getOneByDevAlias($devAlias, $isOnline, $query); | |||||
if (!$section) { | if (!$section) { | ||||
throw new NotFoundHttpException('La section ' . $devAlias . ' est introuvable'); | throw new NotFoundHttpException('La section ' . $devAlias . ' est introuvable'); | ||||
{ | { | ||||
// @TODO : à implémenter avec le nouveau système d'ouverture des commandes | // @TODO : à implémenter avec le nouveau système d'ouverture des commandes | ||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\Setting; | namespace Lc\CaracoleBundle\Repository\Setting; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class MerchantSettingStore extends AbstractStore | class MerchantSettingStore extends AbstractStore | ||||
{ | { | ||||
use MerchantStoreTrait; | |||||
protected MerchantSettingRepositoryQuery $query; | protected MerchantSettingRepositoryQuery $query; | ||||
public function __construct(MerchantSettingRepositoryQuery $query) | public function __construct(MerchantSettingRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Setting; | namespace Lc\CaracoleBundle\Repository\Setting; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class SectionSettingStore extends AbstractStore | class SectionSettingStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected SectionSettingRepositoryQuery $query; | protected SectionSettingRepositoryQuery $query; | ||||
public function __construct(SectionSettingRepositoryQuery $query) | public function __construct(SectionSettingRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterBySection($this->section); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Site; | namespace Lc\CaracoleBundle\Repository\Site; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\Site\NewsStore as SovNewsStore; | use Lc\SovBundle\Repository\Site\NewsStore as SovNewsStore; | ||||
class NewsStore extends SovNewsStore | class NewsStore extends SovNewsStore | ||||
{ | { | ||||
use SectionStoreTrait; | use SectionStoreTrait; | ||||
public function getLatests(int $maxResults = 0, $query = null): array | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->filterBySection($this->section); | $query->filterBySection($this->section); | ||||
return parent::getLatests($maxResults, $query); | |||||
return parent::filtersDefault($query); | |||||
} | } | ||||
} | } |
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Model\Site\PageInterface; | use Lc\SovBundle\Model\Site\PageInterface; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\Site\PageStore as SovPageStore; | use Lc\SovBundle\Repository\Site\PageStore as SovPageStore; | ||||
class PageStore extends SovPageStore | class PageStore extends SovPageStore | ||||
parent::__construct($query); | parent::__construct($query); | ||||
} | } | ||||
// findPage | |||||
public function getOneByDevAlias(string $devAlias, $query = null): ?PageInterface | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query | |||||
->filterIsOnline() | |||||
->filterByDevAlias($devAlias) | |||||
->filterBySection($this->section); | |||||
return $query->findOne(); | |||||
$query->filterBySection($this->section); | |||||
return parent::filtersDefault($query); | |||||
} | } | ||||
} | } |
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\Ticket\TicketStore as SovTicketStore; | use Lc\SovBundle\Repository\Ticket\TicketStore as SovTicketStore; | ||||
class TicketStore extends SovTicketStore | class TicketStore extends SovTicketStore | ||||
{ | { | ||||
use SectionStoreTrait; | use SectionStoreTrait; | ||||
public function getByUser(UserInterface $user, $query = null): array | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->filterBySection($this->section); | $query->filterBySection($this->section); | ||||
return parent::getByUser($user, $query); | |||||
} | |||||
public function getOpen(int $limit = 0, $query = null): array | |||||
{ | |||||
$query = $this->createQuery($query); | |||||
$query->filterBySection($this->section); | |||||
return parent::getOpen($limit, $query); | |||||
} | |||||
public function countOpen($query = null): string | |||||
{ | |||||
$query = $this->createQuery($query); | |||||
$query->filterBySection($this->section); | |||||
return parent::countOpen($query); | |||||
return $query; | |||||
} | } | ||||
} | } |
namespace Lc\CaracoleBundle\Repository\User; | namespace Lc\CaracoleBundle\Repository\User; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\User\GroupUserStore as SovGroupUserStore; | use Lc\SovBundle\Repository\User\GroupUserStore as SovGroupUserStore; | ||||
class GroupUserStore extends SovGroupUserStore | class GroupUserStore extends SovGroupUserStore | ||||
{ | { | ||||
use MerchantStoreTrait; | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return parent::filtersDefault($query); | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Solver\User\UserMerchantSolver; | use Lc\CaracoleBundle\Solver\User\UserMerchantSolver; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class UserMerchantStore extends AbstractStore | class UserMerchantStore extends AbstractStore | ||||
{ | { | ||||
$this->userMerchantSolver = $userMerchantSolver; | $this->userMerchantSolver = $userMerchantSolver; | ||||
} | } | ||||
// getUserMerchant | |||||
public function getOneByUser(UserInterface $user, $query = null): UserMerchantInterface | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
$query | |||||
->filterByMerchant($this->merchant) | |||||
->filterByUser($user); | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
// getUserMerchant | |||||
public function getOneByUser(UserInterface $user, $query = null): UserMerchantInterface | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByUser($user); | |||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } | ||||
namespace Lc\CaracoleBundle\Repository\User; | namespace Lc\CaracoleBundle\Repository\User; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class UserPointSaleStore extends AbstractStore | class UserPointSaleStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
} | } |
use App\Entity\Newsletter\Newsletter; | use App\Entity\Newsletter\Newsletter; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\User\UserStore as SovUserStore; | use Lc\SovBundle\Repository\User\UserStore as SovUserStore; | ||||
class UserStore extends SovUserStore | class UserStore extends SovUserStore | ||||
{ | { | ||||
use MerchantStoreTrait; | use MerchantStoreTrait; | ||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterByMerchant($this->merchant); | |||||
return $query; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\User; | namespace Lc\CaracoleBundle\Repository\User; | ||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class VisitorStore extends AbstractStore | class VisitorStore extends AbstractStore | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getOneByCookie(string $cookie, $query = null) | public function getOneByCookie(string $cookie, $query = null) | ||||
{ | { | ||||
$query = $this->createQuery($query); | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByCookie($cookie); | $query->filterByCookie($cookie); | ||||
return $query->findOne(); | return $query->findOne(); | ||||
} | } |
return false; | return false; | ||||
} | } | ||||
// isMaximumOrderWeekAchieved | // isMaximumOrderWeekAchieved | ||||
public function isMaximumOrderCycleAchieved(SectionInterface $section) | public function isMaximumOrderCycleAchieved(SectionInterface $section) | ||||
{ | { | ||||
$countOrderShopCycle = $this->orderShopStore->countValidByCurrentCycle(); | $countOrderShopCycle = $this->orderShopStore->countValidByCurrentCycle(); | ||||
$orderMaximumPerCycle = $section->getSettingValue(SectionSettingDefinition::SETTING_ORDER_MAXIMUM_PER_CYCLE); | $orderMaximumPerCycle = $section->getSettingValue(SectionSettingDefinition::SETTING_ORDER_MAXIMUM_PER_CYCLE); | ||||
if ($orderMaximumPerCycle && $countOrderShopCycle >= $orderMaximumPerCycle) { | if ($orderMaximumPerCycle && $countOrderShopCycle >= $orderMaximumPerCycle) { |
<?php | |||||
namespace Lc\CaracoleBundle\Resolver; | |||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | |||||
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; | |||||
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
class ReductionResolver | |||||
{ | |||||
protected OrderShopStore $orderShopStore; | |||||
protected ReductionCreditStore $reductionCreditStore; | |||||
public function __construct(OrderShopStore $orderShopStore, ReductionCreditStore $reductionCreditStore) | |||||
{ | |||||
$this->orderShopStore = $orderShopStore; | |||||
$this->reductionCreditStore = $reductionCreditStore; | |||||
} | |||||
public function getReductionCreditsAvailableByUser(UserInterface $user) | |||||
{ | |||||
$reductionCredits = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_CREDIT, $user); | |||||
$reductionCreditsArray = []; | |||||
foreach ($reductionCredits as $reductionCredit) { | |||||
if (!$this->orderShopStore->countValidOrderWithReductionCredit($reductionCredit, $user)) { | |||||
$reductionCreditsArray[] = $reductionCredit; | |||||
} | |||||
} | |||||
return $reductionCreditsArray; | |||||
} | |||||
public function getReductionGiftsAvailableByUser($user) | |||||
{ | |||||
$reductionGifts = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_GIFT, $user); | |||||
$reductionGiftsArray = []; | |||||
foreach ($reductionGifts as $reductionGift) { | |||||
if (!$this->orderShopStore->countValidOrderWithReductionCredit($reductionGift)) { | |||||
$reductionGiftsArray[] = $reductionGift; | |||||
} | |||||
} | |||||
return $reductionGiftsArray; | |||||
} | |||||
} |
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | use Lc\CaracoleBundle\Repository\Section\SectionRepository; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionStore; | |||||
use Lc\SovBundle\Resolver\UrlResolver; | use Lc\SovBundle\Resolver\UrlResolver; | ||||
use Symfony\Component\HttpFoundation\RequestStack; | use Symfony\Component\HttpFoundation\RequestStack; | ||||
use Symfony\Component\Security\Core\Security; | use Symfony\Component\Security\Core\Security; | ||||
class SectionResolver | class SectionResolver | ||||
{ | { | ||||
protected $sectionRepository; | |||||
protected $merchantResolver; | |||||
protected EntityManagerInterface $entityManager; | |||||
protected MerchantResolver $merchantResolver; | |||||
protected SectionStore $sectionStore; | |||||
public function __construct(MerchantResolver $merchantResolver, EntityManagerInterface $em) | |||||
public function __construct(EntityManagerInterface $entityManager, MerchantResolver $merchantResolver, SectionStore $sectionStore) | |||||
{ | { | ||||
$this->em = $em; | |||||
$this->entityManager = $entityManager; | |||||
$this->merchantResolver = $merchantResolver; | $this->merchantResolver = $merchantResolver; | ||||
$this->sectionStore = $sectionStore; | |||||
} | } | ||||
public function getCurrent(): SectionInterface | public function getCurrent(): SectionInterface | ||||
if ($currentAdminSection === null) { | if ($currentAdminSection === null) { | ||||
$currentAdminSection = $this->em->getRepository(SectionInterface::class)->findOneBy(array('isDefault' => true)); | $currentAdminSection = $this->em->getRepository(SectionInterface::class)->findOneBy(array('isDefault' => true)); | ||||
$currentAdminSection = $this->sectionStore | |||||
->setMerchant($userMerchant->getMerchant()) | |||||
->getOneDefault(); | |||||
if ($currentAdminSection === null) { | if ($currentAdminSection === null) { | ||||
throw new \ErrorException('Aucune section par défaut définie pour ce merchant'); | throw new \ErrorException('Aucune section par défaut définie pour ce merchant'); | ||||
} | } |
namespace Lc\CaracoleBundle\Solver\Address; | namespace Lc\CaracoleBundle\Solver\Address; | ||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | |||||
class AddressSolver | class AddressSolver | ||||
{ | { | ||||
// getAddressSummary | // getAddressSummary | ||||
public function getSummaryShort() | |||||
public function getSummaryShort(AddressInterface $address): string | |||||
{ | { | ||||
return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity(); | |||||
return $address->getAddress() . ' - ' . $address->getZip() . ' ' . $address->getCity(); | |||||
} | } | ||||
public function getSummary($withTitle = true) | |||||
public function getSummary(AddressInterface $address, $withTitle = true): string | |||||
{ | { | ||||
$html = ''; | $html = ''; | ||||
if ($this->getTitle() && $withTitle) { | |||||
$html .= $this->getTitle() . '<br />'; | |||||
if ($address->getTitle() && $withTitle) { | |||||
$html .= $address->getTitle() . '<br />'; | |||||
} | } | ||||
if ($this->getLastname() || $this->getFirstname()) { | |||||
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />'; | |||||
if ($address->getLastname() || $address->getFirstname()) { | |||||
$html .= $address->getLastname() . ' ' . $address->getFirstname() . '<br />'; | |||||
} | } | ||||
if ($this->getAddress()) { | |||||
$html .= $this->getAddress() . '<br />'; | |||||
if ($address->getAddress()) { | |||||
$html .= $address->getAddress() . '<br />'; | |||||
} | } | ||||
if ($this->getZip() || $this->getCity()) { | |||||
$html .= $this->getZip() . ' ' . $this->getCity() . '<br />'; | |||||
if ($address->getZip() || $address->getCity()) { | |||||
$html .= $address->getZip() . ' ' . $address->getCity() . '<br />'; | |||||
} | } | ||||
if ($this->getPhone()) { | |||||
foreach ($this->getPhone() as $phone) { | |||||
if ($address->getPhone()) { | |||||
foreach ($address->getPhone() as $phone) { | |||||
$html .= 'Tél. ' . $phone . '<br />'; | $html .= 'Tél. ' . $phone . '<br />'; | ||||
} | } | ||||
} | } | ||||
return $html; | return $html; | ||||
} | } | ||||
public function getLongitudeInherit() | |||||
public function getLongitudeInherit(AddressInterface $address): ?string | |||||
{ | { | ||||
if ($this->getLongitudeOverride()) { | |||||
return $this->getLongitudeOverride(); | |||||
if ($address->getLongitudeOverride()) { | |||||
return $address->getLongitudeOverride(); | |||||
} else { | } else { | ||||
return $this->getLongitude(); | |||||
return $address->getLongitude(); | |||||
} | } | ||||
} | } | ||||
public function getLatitudeInherit() | |||||
public function getLatitudeInherit(AddressInterface $address): ?string | |||||
{ | { | ||||
if ($this->getLatitudeOverride()) { | |||||
return $this->getLatitudeOverride(); | |||||
if ($address->getLatitudeOverride()) { | |||||
return $address->getLatitudeOverride(); | |||||
} else { | } else { | ||||
return $this->getLatitude(); | |||||
return $address->getLatitude(); | |||||
} | } | ||||
} | } | ||||
class OrderProductReductionCatalogSolver | class OrderProductReductionCatalogSolver | ||||
{ | { | ||||
// getSummaryOrderProductReductionCatalog | // getSummaryOrderProductReductionCatalog | ||||
public function getSummary(OrderProductReductionCatalogInterface $orderProductReductionCatalog) | |||||
public function getSummary(OrderProductReductionCatalogInterface $orderProductReductionCatalog): string | |||||
{ | { | ||||
$text = ''; | $text = ''; | ||||
public function compare( | public function compare( | ||||
OrderProductReductionCatalogInterface $orderProductReductionCatalog, | OrderProductReductionCatalogInterface $orderProductReductionCatalog, | ||||
OrderProductReductionCatalogInterface $orderProductReductionCatalogCompare | OrderProductReductionCatalogInterface $orderProductReductionCatalogCompare | ||||
) { | |||||
): bool { | |||||
return $orderProductReductionCatalogCompare | return $orderProductReductionCatalogCompare | ||||
&& $orderProductReductionCatalog->getUnit() == $orderProductReductionCatalogCompare->getUnit() | && $orderProductReductionCatalog->getUnit() == $orderProductReductionCatalogCompare->getUnit() | ||||
&& (string)$orderProductReductionCatalog->getValue( | && (string)$orderProductReductionCatalog->getValue( |
public function getTotalOrderPayments(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): float | public function getTotalOrderPayments(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): float | ||||
{ | { | ||||
$totalAmount = floatval(0); | $totalAmount = floatval(0); | ||||
foreach ($orderShop->getOrderPayments() as $orderPayment) { | foreach ($orderShop->getOrderPayments() as $orderPayment) { | ||||
$totalAmount = $orderPayment->getAmount() + $totalAmount; | $totalAmount = $orderPayment->getAmount() + $totalAmount; | ||||
} | } | ||||
if ($mergeComplementaryOrderShop) { | if ($mergeComplementaryOrderShop) { | ||||
foreach ($orderShop->getComplementaryOrderShops() as $complementaryOrderShop) { | foreach ($orderShop->getComplementaryOrderShops() as $complementaryOrderShop) { | ||||
foreach ($complementaryOrderShop->getOrderPayments() as $orderPayment) { | foreach ($complementaryOrderShop->getOrderPayments() as $orderPayment) { | ||||
public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status) | public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status) | ||||
{ | { | ||||
$orderStatusHistories = $orderShop->getOrderStatusHistories(); | $orderStatusHistories = $orderShop->getOrderStatusHistories(); | ||||
if (count($orderStatusHistories) > 0) { | if (count($orderStatusHistories) > 0) { | ||||
foreach ($orderStatusHistories as $orderStatusHistory) { | foreach ($orderStatusHistories as $orderStatusHistory) { | ||||
if ($orderStatusHistory->getOrderStatus() === $status) { | if ($orderStatusHistory->getOrderStatus() === $status) { | ||||
public function isComplementaryOrderShop(OrderShopInterface $orderShop): bool | public function isComplementaryOrderShop(OrderShopInterface $orderShop): bool | ||||
{ | { | ||||
return (bool) $orderShop->getMainOrderShop() ; | |||||
return (bool) $orderShop->getMainOrderShop(); | |||||
} | } | ||||
public function mergeComplentaryOrderShops(OrderShopInterface $orderShop, bool $combineProducts = true) :OrderShopInterface | |||||
{ | |||||
public function mergeComplentaryOrderShops( | |||||
OrderShopInterface $orderShop, | |||||
bool $combineProducts = true | |||||
): OrderShopInterface { | |||||
$this->entityManager->refresh($orderShop); | $this->entityManager->refresh($orderShop); | ||||
if ($orderShop->getComplementaryOrderShops()) { | if ($orderShop->getComplementaryOrderShops()) { |
{ | { | ||||
protected PriceSolver $priceSolver; | protected PriceSolver $priceSolver; | ||||
protected OrderShopSolver $orderShopSolver; | protected OrderShopSolver $orderShopSolver; | ||||
protected ReductionResolver $reductionResolver; | |||||
public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver, ReductionResolver $reductionResolver) | |||||
public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver) | |||||
{ | { | ||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
$this->orderShopSolver = $orderShopSolver; | $this->orderShopSolver = $orderShopSolver; | ||||
$this->reductionResolver = $reductionResolver; | |||||
} | } | ||||
// getOrderDatas | // getOrderDatas |
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | ||||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | use Lc\CaracoleBundle\Repository\Config\UnitStore; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; | |||||
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | use Lc\CaracoleBundle\Repository\Section\SectionRepository; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface; | use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionStore; | |||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | use Lc\CaracoleBundle\Resolver\SectionResolver; | ||||
use Lc\ShopBundle\Context\UnitInterface; | use Lc\ShopBundle\Context\UnitInterface; | ||||
class StoreTwigExtension extends AbstractExtension | class StoreTwigExtension extends AbstractExtension | ||||
{ | { | ||||
protected MerchantRepositoryQuery $merchantRepositoryQuery; | |||||
protected SectionRepositoryQuery $sectionRepositoryQuery; | |||||
protected MerchantStore $merchantStore; | |||||
protected SectionStore $sectionStore; | |||||
protected ReminderStore $reminderStore; | protected ReminderStore $reminderStore; | ||||
protected MerchantResolver $merchantResolver; | protected MerchantResolver $merchantResolver; | ||||
protected SectionResolver $sectionResolver; | protected SectionResolver $sectionResolver; | ||||
public function __construct( | public function __construct( | ||||
MerchantResolver $merchantResolver, | MerchantResolver $merchantResolver, | ||||
SectionResolver $sectionResolver, | SectionResolver $sectionResolver, | ||||
MerchantRepositoryQuery $merchantRepositoryQuery, | |||||
SectionRepositoryQuery $sectionRepositoryQuery, | |||||
MerchantStore $merchantStore, | |||||
SectionStore $sectionStore, | |||||
ReminderStore $reminderStore, | ReminderStore $reminderStore, | ||||
UnitStore $unitStore, | UnitStore $unitStore, | ||||
TaxRateStore $taxRateStore | TaxRateStore $taxRateStore | ||||
) { | ) { | ||||
$this->merchantResolver = $merchantResolver; | $this->merchantResolver = $merchantResolver; | ||||
$this->sectionResolver = $sectionResolver; | $this->sectionResolver = $sectionResolver; | ||||
$this->merchantRepositoryQuery = $merchantRepositoryQuery; | |||||
$this->sectionRepositoryQuery = $sectionRepositoryQuery; | |||||
$this->merchantStore = $merchantStore; | |||||
$this->sectionStore = $sectionStore; | |||||
$this->reminderStore = $reminderStore; | $this->reminderStore = $reminderStore; | ||||
$this->unitStore = $unitStore; | $this->unitStore = $unitStore; | ||||
$this->taxRateStore = $taxRateStore; | $this->taxRateStore = $taxRateStore; | ||||
public function getSections() | public function getSections() | ||||
{ | { | ||||
return $this->sectionRepositoryQuery | |||||
->filterByMerchant($this->merchantResolver->getCurrent()) | |||||
->find(); | |||||
return $this->sectionStore->setMerchant($this->merchantResolver->getCurrent())->getOnline(); | |||||
} | } | ||||
public function getMerchants() | public function getMerchants() | ||||
{ | { | ||||
return $this->merchantRepositoryQuery->find(); | |||||
return $this->merchantStore->getOnline(); | |||||
} | } | ||||
public function getReminders($params = []) | public function getReminders($params = []) | ||||
->get($params); | ->get($params); | ||||
} | } | ||||
public function getUnits(){ | |||||
public function getUnits() | |||||
{ | |||||
return $this->unitStore->getAsArray(); | return $this->unitStore->getAsArray(); | ||||
} | } | ||||
public function getTaxRates(){ | |||||
return $this->taxRateStore->getAsArray(); | |||||
public function getTaxRates() | |||||
{ | |||||
return $this->taxRateStore->setMerchant($this->merchantResolver->getCurrent())->getAsArray(); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Twig; | |||||
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantButtonAdminFormType; | |||||
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType; | |||||
use Lc\CaracoleBundle\Form\Section\SwitchSectionFormType; | |||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | |||||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface; | |||||
use Symfony\Component\Form\FormFactoryInterface; | |||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | |||||
use Twig\Extension\AbstractExtension; | |||||
use Twig\TwigFunction; | |||||
class TwigExtension extends AbstractExtension | |||||
{ | |||||
public function __construct() { | |||||
} | |||||
public function getFilters() | |||||
{ | |||||
return []; | |||||
} | |||||
public function getFunctions() | |||||
{ | |||||
return []; | |||||
} | |||||
} |