Browse Source

Création du bundle

feature/ticket
Fab 3 years ago
commit
4f7b484740
98 changed files with 8231 additions and 0 deletions
  1. +14
    -0
      CaracoleBundle.php
  2. +24
    -0
      DependencyInjection/CaracoleExtension.php
  3. +8
    -0
      Doctrine/Extension/FilterMerchantInterface.php
  4. +8
    -0
      Doctrine/Extension/FilterMultipleMerchantsInterface.php
  5. +26
    -0
      Doctrine/Extension/OrderAmountMin.php
  6. +8
    -0
      Doctrine/Extension/OrderAmountMinInterface.php
  7. +61
    -0
      Doctrine/Extension/OrderPayoffTrait.php
  8. +7
    -0
      Doctrine/Extension/PayoffInterface.php
  9. +104
    -0
      Doctrine/Extension/PayoffTrait.php
  10. +27
    -0
      Doctrine/Extension/PriceInterface.php
  11. +101
    -0
      Doctrine/Extension/PriceTrait.php
  12. +8
    -0
      Doctrine/Extension/ProductPropertyInterface.php
  13. +131
    -0
      Doctrine/Extension/ProductPropertyTrait.php
  14. +7
    -0
      Doctrine/Extension/ReductionCartPropertyInterface.php
  15. +63
    -0
      Doctrine/Extension/ReductionCartPropertyTrait.php
  16. +15
    -0
      Doctrine/Extension/ReductionInterface.php
  17. +8
    -0
      Doctrine/Extension/ReductionPropertyInterface.php
  18. +153
    -0
      Doctrine/Extension/ReductionPropertyTrait.php
  19. +61
    -0
      Doctrine/Extension/ReductionTrait.php
  20. +379
    -0
      Model/Address/Address.php
  21. +8
    -0
      Model/Address/AddressInterface.php
  22. +101
    -0
      Model/Credit/CreditConfig.php
  23. +8
    -0
      Model/Credit/CreditConfigInterface.php
  24. +184
    -0
      Model/Credit/CreditHistory.php
  25. +8
    -0
      Model/Credit/CreditHistoryInterface.php
  26. +288
    -0
      Model/File/Document.php
  27. +8
    -0
      Model/File/DocumentInterface.php
  28. +52
    -0
      Model/Global/TaxRate.php
  29. +8
    -0
      Model/Global/TaxRateInterface.php
  30. +120
    -0
      Model/Global/Unit.php
  31. +8
    -0
      Model/Global/UnitInterface.php
  32. +392
    -0
      Model/Merchant/Merchant.php
  33. +125
    -0
      Model/Merchant/MerchantConfig.php
  34. +8
    -0
      Model/Merchant/MerchantConfigInterface.php
  35. +8
    -0
      Model/Merchant/MerchantInterface.php
  36. +93
    -0
      Model/Newsletter/Newsletter.php
  37. +8
    -0
      Model/Newsletter/NewsletterInterface.php
  38. +17
    -0
      Model/Order/OrderPayment.php
  39. +8
    -0
      Model/Order/OrderPaymentInterface.php
  40. +7
    -0
      Model/Order/OrderPayoffInterface.php
  41. +202
    -0
      Model/Order/OrderProduct.php
  42. +8
    -0
      Model/Order/OrderProductInterface.php
  43. +31
    -0
      Model/Order/OrderProductReductionCatalog.php
  44. +8
    -0
      Model/Order/OrderProductReductionCatalogInterface.php
  45. +87
    -0
      Model/Order/OrderProductRefund.php
  46. +7
    -0
      Model/Order/OrderProductRefundInterface.php
  47. +77
    -0
      Model/Order/OrderReductionCart.php
  48. +8
    -0
      Model/Order/OrderReductionCartInterface.php
  49. +93
    -0
      Model/Order/OrderReductionCredit.php
  50. +8
    -0
      Model/Order/OrderReductionCreditInterface.php
  51. +52
    -0
      Model/Order/OrderRefund.php
  52. +7
    -0
      Model/Order/OrderRefundInterface.php
  53. +604
    -0
      Model/Order/OrderShop.php
  54. +8
    -0
      Model/Order/OrderShopInterface.php
  55. +8
    -0
      Model/Order/OrderShopPriceUtilsInterface.php
  56. +145
    -0
      Model/Order/OrderStatus.php
  57. +84
    -0
      Model/Order/OrderStatusHistory.php
  58. +8
    -0
      Model/Order/OrderStatusHistoryInterface.php
  59. +8
    -0
      Model/Order/OrderStatusInterface.php
  60. +175
    -0
      Model/PointSale/PointSale.php
  61. +80
    -0
      Model/PointSale/PointSaleDayInfo.php
  62. +8
    -0
      Model/PointSale/PointSaleDayInfoInterface.php
  63. +8
    -0
      Model/PointSale/PointSaleInterface.php
  64. +221
    -0
      Model/Product/Product.php
  65. +199
    -0
      Model/Product/ProductCategory.php
  66. +8
    -0
      Model/Product/ProductCategoryInterface.php
  67. +929
    -0
      Model/Product/ProductFamily.php
  68. +8
    -0
      Model/Product/ProductFamilyInterface.php
  69. +8
    -0
      Model/Product/ProductInterface.php
  70. +228
    -0
      Model/Reduction/ReductionCart.php
  71. +11
    -0
      Model/Reduction/ReductionCartInterface.php
  72. +152
    -0
      Model/Reduction/ReductionCatalog.php
  73. +7
    -0
      Model/Reduction/ReductionCatalogInterface.php
  74. +158
    -0
      Model/Reduction/ReductionCredit.php
  75. +7
    -0
      Model/Reduction/ReductionCreditInterface.php
  76. +193
    -0
      Model/Reminder/Reminder.php
  77. +7
    -0
      Model/Reminder/ReminderInterface.php
  78. +172
    -0
      Model/Section/Section.php
  79. +8
    -0
      Model/Section/SectionInterface.php
  80. +68
    -0
      Model/Site/News.php
  81. +8
    -0
      Model/Site/NewsInterface.php
  82. +53
    -0
      Model/Site/Page.php
  83. +8
    -0
      Model/Site/PageInterface.php
  84. +300
    -0
      Model/Ticket/Ticket.php
  85. +8
    -0
      Model/Ticket/TicketInterface.php
  86. +104
    -0
      Model/Ticket/TicketMessage.php
  87. +8
    -0
      Model/Ticket/TicketMessageInterface.php
  88. +79
    -0
      Model/User/GroupUser.php
  89. +8
    -0
      Model/User/GroupUserInterface.php
  90. +490
    -0
      Model/User/User.php
  91. +8
    -0
      Model/User/UserInterface.php
  92. +150
    -0
      Model/User/UserMerchant.php
  93. +8
    -0
      Model/User/UserMerchantInterface.php
  94. +64
    -0
      Model/User/UserPointSale.php
  95. +8
    -0
      Model/User/UserPointSaleInterface.php
  96. +8
    -0
      Model/User/UserUtilsInterface.php
  97. +131
    -0
      Model/User/Visitor.php
  98. +8
    -0
      Model/User/VisitorInterface.php

+ 14
- 0
CaracoleBundle.php View File

@@ -0,0 +1,14 @@
<?php

namespace Lc\CaracoleBundle;

use Lc\ShopBundle\DependencyInjection\CaracoleExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class CaracoleBundle extends Bundle
{
public function getContainerExtension()
{
return new CaracoleExtension();
}
}

+ 24
- 0
DependencyInjection/CaracoleExtension.php View File

@@ -0,0 +1,24 @@
<?php

namespace Lc\CaracoleBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class CaracoleExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container)
{

}

public function prepend(ContainerBuilder $container)
{
/*$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/easy_admin'));
$loader->load('base.yaml');
$loader->load('entities/merchant.yaml');*/
}
}

+ 8
- 0
Doctrine/Extension/FilterMerchantInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension ;

interface FilterMerchantInterface
{

}

+ 8
- 0
Doctrine/Extension/FilterMultipleMerchantsInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension ;

interface FilterMultipleMerchantsInterface
{

}

+ 26
- 0
Doctrine/Extension/OrderAmountMin.php View File

@@ -0,0 +1,26 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;

trait OrderAmountMin
{
/**
* @ORM\Column(type="float")
*/
protected $orderAmountMin;

public function getOrderAmountMin(): ?float
{
return $this->orderAmountMin;
}

public function setOrderAmountMin(float $orderAmountMin): self
{
$this->orderAmountMin = $orderAmountMin;

return $this;
}

}

+ 8
- 0
Doctrine/Extension/OrderAmountMinInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface OrderAmountMinInterface
{

}

+ 61
- 0
Doctrine/Extension/OrderPayoffTrait.php View File

@@ -0,0 +1,61 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
trait OrderPayoffTrait
{

use PayoffTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderPayments")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\Column(type="boolean")
*/
protected $editable;

public function __toString()
{
return $this->amount. ' le '.$this->getPaidAt()->format('d-m-y').' par '.$this->getMeanPayment();
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function setEditable(bool $editable): self
{
$this->editable = $editable;

return $this;
}

public function getEditable(): ?bool
{
return $this->editable;
}

public function isEditable(): ?bool
{
return $this->editable;
}
}

+ 7
- 0
Doctrine/Extension/PayoffInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface PayoffInterface
{
}

+ 104
- 0
Doctrine/Extension/PayoffTrait.php View File

@@ -0,0 +1,104 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
trait PayoffTrait
{

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $meanPayment;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $reference;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $paidAt;

/**
* @ORM\Column(type="float")
*/
protected $amount;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;



public function setMeanPayment(?string $meanPayment): self
{
$this->meanPayment = $meanPayment;

return $this;
}

public function getMeanPayment() : ?string
{
return $this->meanPayment ;
}


public function getReference(): ?string
{
return $this->reference;
}

public function setReference(?string $reference): self
{
$this->reference = $reference;

return $this;
}

public function getPaidAt(): ?\DateTimeInterface
{
return $this->paidAt;
}

public function setPaidAt(?\DateTimeInterface $paidAt): self
{
$this->paidAt = $paidAt;

return $this;
}

public function getAmount(): ?float
{
return $this->amount;
}

public function setAmount(float $amount): self
{
$this->amount = $amount;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}


}

+ 27
- 0
Doctrine/Extension/PriceInterface.php View File

@@ -0,0 +1,27 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension ;

interface PriceInterface
{
/**
* Retourne le prix hérité
*
* @return float
*/
public function getPriceInherited();

/**
* Retourne le TaxRate hérité
*
* @return entity
*/
public function getTaxRateInherited();

/**
* Retourne le Unit hérité
*
* @return float
*/
public function getUnitInherited();
}

+ 101
- 0
Doctrine/Extension/PriceTrait.php View File

@@ -0,0 +1,101 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension ;

use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\UnitInterface;

trait PriceTrait
{
/**
* @ORM\Column(type="float", nullable=true)
*/
protected $price;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UnitInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $unit;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $taxRate;


/**
* @ORM\Column(type="float", nullable=true)
*/
protected $buyingPrice;


public function getPriceInherited(): ?float
{
return $this->getPrice() ;
}

public function getUnitInherited(): ?Unit
{
return $this->getUnit() ;
}

public function getTaxRateInherited(): ?TaxRate
{
return $this->getTaxRate() ;
}

public function getBuyingPriceInherited(): ?float
{
return $this->getBuyingPrice() ;
}

public function getBuyingPrice(): ?float
{
return $this->buyingPrice;
}

public function setBuyingPrice(?float $buyingPrice): self
{
$this->buyingPrice = $buyingPrice;

return $this;
}

public function getPrice(): ?float
{
return $this->price;
}

public function setPrice(?float $price): self
{
$this->price = $price;

return $this;
}

public function getUnit(): ?Unit
{
return $this->unit;
}

public function setUnit(?Unit $unit): self
{
$this->unit = $unit;

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}
}

+ 8
- 0
Doctrine/Extension/ProductPropertyInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface ProductPropertyInterface
{

}

+ 131
- 0
Doctrine/Extension/ProductPropertyTrait.php View File

@@ -0,0 +1,131 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\ShopBundle\Services\Price;

trait ProductPropertyTrait
{
use PriceTrait ;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $buyingPriceByRefUnit;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $priceByRefUnit;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $quantity;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $availableQuantity;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $availableQuantityDefault;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $propertyExpirationDate;

public function getBuyingPriceByRefUnit(): ?float
{
return $this->buyingPriceByRefUnit;
}

public function getBuyingPriceByRefUnitInherited(): ?float
{
return $this->getBuyingPriceByRefUnit() ;
}

public function setBuyingPriceByRefUnit(?float $buyingPriceByRefUnit): self
{
$this->buyingPriceByRefUnit = $buyingPriceByRefUnit;

return $this;
}

public function getPriceByRefUnit(): ?float
{
return $this->priceByRefUnit;
}

public function getPriceByRefUnitInherited(): ?float
{
return $this->getPriceByRefUnit();
}

public function setPriceByRefUnit(?float $priceByRefUnit): self
{
$this->priceByRefUnit = $priceByRefUnit;

return $this;
}


public function getQuantity(): ?float
{
return $this->quantity;
}

public function setQuantity(?float $quantity): self
{
$this->quantity = $quantity;

return $this;
}

public function getQuantityInherited(): ?float
{
return $this->getQuantity() ;
}

public function getAvailableQuantity(): ?float
{
return $this->availableQuantity;
}

public function setAvailableQuantity(?float $availableQuantity): self
{
$this->availableQuantity = $availableQuantity;

return $this;
}

public function getAvailableQuantityDefault(): ?float
{
return $this->availableQuantityDefault;
}

public function setAvailableQuantityDefault(?float $availableQuantityDefault): self
{
$this->availableQuantityDefault = $availableQuantityDefault;

return $this;
}

public function getPropertyExpirationDate(): ?string
{
return $this->propertyExpirationDate;
}

public function setPropertyExpirationDate(?string $propertyExpirationDate): self
{
$this->propertyExpirationDate = $propertyExpirationDate;

return $this;
}

}

+ 7
- 0
Doctrine/Extension/ReductionCartPropertyInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface ReductionCartPropertyInterface
{
}

+ 63
- 0
Doctrine/Extension/ReductionCartPropertyTrait.php View File

@@ -0,0 +1,63 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;

trait ReductionCartPropertyTrait
{

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $freeShipping;

/**
* @ORM\Column(type="string", length=25)
*/
protected $appliedTo;

/**
* @ORM\Column(type="string", length=25)
*/
protected $type;


public function getFreeShipping(): ?bool
{
return $this->freeShipping;
}

public function setFreeShipping(?bool $freeShipping): self
{
$this->freeShipping = $freeShipping;

return $this;
}

public function getAppliedTo(): ?string
{
return $this->appliedTo;
}

public function setAppliedTo(string $appliedTo): self
{
$this->appliedTo = $appliedTo;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}


}

+ 15
- 0
Doctrine/Extension/ReductionInterface.php View File

@@ -0,0 +1,15 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface ReductionInterface
{
/**
* Retourne le merchant courant en fonction du user ou du cookie du visitor
*
* @return MerchantInterface
*/
public function getUnit();
public function getValue();
public function getBehaviorTaxRate();
}

+ 8
- 0
Doctrine/Extension/ReductionPropertyInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface ReductionPropertyInterface
{

}

+ 153
- 0
Doctrine/Extension/ReductionPropertyTrait.php View File

@@ -0,0 +1,153 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

trait ReductionPropertyTrait
{

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface")
*/
protected $users;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\GroupUserInterface")
*/
protected $groupUsers;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $dateStart;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $dateEnd;

/**
* @ORM\Column(type="boolean")
*/
protected $permanent;



public function __construct()
{
$this->users = new ArrayCollection();
$this->groupUsers = new ArrayCollection();
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

return $this;
}

public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
}

return $this;
}


/**
* @return Collection|GroupUser[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}

public function addGroupUser(GroupUser $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
}

return $this;
}

public function removeGroupUser(GroupUser $groupUser): self
{
if ($this->groupUsers->contains($groupUser)) {
$this->groupUsers->removeElement($groupUser);
}

return $this;
}


public function getDateStart(): ?\DateTimeInterface
{
return $this->dateStart;
}

public function setDateStart(?\DateTimeInterface $dateStart): self
{
$this->dateStart = $dateStart;

return $this;
}

public function getDateEnd(): ?\DateTimeInterface
{
return $this->dateEnd;
}

public function setDateEnd(?\DateTimeInterface $dateEnd): self
{
$this->dateEnd = $dateEnd;

return $this;
}

public function getPermanent(): ?bool
{
return $this->permanent;
}

public function setPermanent(bool $permanent): self
{
$this->permanent = $permanent;

return $this;
}

}

+ 61
- 0
Doctrine/Extension/ReductionTrait.php View File

@@ -0,0 +1,61 @@
<?php

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;

trait ReductionTrait
{

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $value;

/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $unit;

/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $behaviorTaxRate;


public function getValue(): ?float
{
return $this->value;
}

public function setValue(?float $value): self
{
$this->value = $value;

return $this;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(?string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getBehaviorTaxRate(): ?string
{
return $this->behaviorTaxRate;
}

public function setBehaviorTaxRate(?string $behaviorTaxRate): self
{
$this->behaviorTaxRate = $behaviorTaxRate;

return $this;
}
}

+ 379
- 0
Model/Address/Address.php View File

@@ -0,0 +1,379 @@
<?php

namespace Lc\CaracoleBundle\;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\StatusInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Address extends AbstractEntity implements StatusInterface
{
use StatusTrait;

const TYPE_INDIVIDUAL = 'individual';
const TYPE_LEGAL_PERSON = 'legal-person';

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="addresses")
* @ORM\JoinColumn(nullable=true)
*/
protected $user;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="string", length=31)
*/
protected $type;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $civility;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="text")
*/
protected $address;

/**
* @ORM\Column(type="string", length=31)
*/
protected $zip;

/**
* @ORM\Column(type="string", length=255)
*/
protected $city;

/**
* @ORM\Column(type="string", length=255)
*/
protected $country;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $company;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $siret;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $tva;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $phone;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $pointSale;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $merchant;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $deliveryInfos;

public function __construct()
{
$this->phone = [] ;
}

public function __toString()
{
return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}

public function getSummaryShort()
{
return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}

public function getSummary($withTitle = true)
{
$html = '';

if ($this->getTitle() && $withTitle) {
$html .= $this->getTitle() . '<br />';
}

if ($this->getLastname() || $this->getFirstname()) {
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />';
}

if ($this->getAddress()) {
$html .= $this->getAddress() . '<br />';
}

if ($this->getZip() || $this->getCity()) {
$html .= $this->getZip() . ' ' . $this->getCity() . '<br />';
}

if ($this->getPhone()) {
foreach($this->getPhone() as $phone) {
$html .= 'Tél. ' . $phone.'<br />';
}
}

return $html;
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getCivility(): ?bool
{
return $this->civility;
}

public function setCivility(?bool $civility): self
{
$this->civility = $civility;

return $this;
}

public function getLastname(): ?string
{
return $this->lastname;
}

public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;

return $this;
}

public function getFirstname(): ?string
{
return $this->firstname;
}

public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;

return $this;
}

public function getAddress(): ?string
{
return $this->address;
}

public function setAddress(string $address): self
{
$this->address = $address;

return $this;
}

public function getZip(): ?string
{
return $this->zip;
}

public function setZip(string $zip): self
{
$this->zip = $zip;

return $this;
}

public function getCity(): ?string
{
return $this->city;
}

public function setCity(string $city): self
{
$this->city = $city;

return $this;
}

public function getCountry(): ?string
{
return $this->country;
}

public function setCountry(string $country): self
{
$this->country = $country;

return $this;
}

public function getCompany(): ?string
{
return $this->company;
}

public function setCompany(?string $company): self
{
$this->company = $company;

return $this;
}

public function getSiret(): ?string
{
return $this->siret;
}

public function setSiret(?string $siret): self
{
$this->siret = $siret;

return $this;
}

public function getTva(): ?string
{
return $this->tva;
}

public function setTva(?string $tva): self
{
$this->tva = $tva;

return $this;
}

public function getPhone(): ?array
{
return $this->phone;
}

public function setPhone(?array $phone): self
{
$this->phone = $phone;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}


public function getPointSale(): ?PointSale
{
return $this->pointSale;
}

public function setPointSale(PointSale $pointSale): self
{
$this->pointSale = $pointSale;

// set the owning side of the relation if necessary
if ($pointSale->getAddress() !== $this) {
$pointSale->setAddress($this);
}

return $this;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(Merchant $merchant): self
{
$this->merchant = $merchant;

// set the owning side of the relation if necessary
if ($merchant->getAddress() !== $this) {
$merchant->setAddress($this);
}

return $this;
}

public function getDeliveryInfos(): ?string
{
return $this->deliveryInfos;
}

public function setDeliveryInfos(?string $deliveryInfos): self
{
$this->deliveryInfos = $deliveryInfos;

return $this;
}
}

+ 8
- 0
Model/Address/AddressInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface AddressInterface
{

}

+ 101
- 0
Model/Credit/CreditConfig.php View File

@@ -0,0 +1,101 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class CreditConfig
{
/**
* @ORM\Column(type="boolean")
*/
protected $active;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $limitAmount;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $limitReminder;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $behavior;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $processOrderCheckedDefault;

public function __toString()
{
return '' ;
}

public function getActive(): ?bool
{
return $this->active;
}

public function setActive(bool $active): self
{
$this->active = $active;

return $this;
}

public function getLimitAmount(): ?float
{
return $this->limitAmount;
}

public function setLimitAmount(?float $limitAmount): self
{
$this->limitAmount = $limitAmount;

return $this;
}

public function getLimitReminder(): ?float
{
return $this->limitReminder;
}

public function setLimitReminder(?float $limitReminder): self
{
$this->limitReminder = $limitReminder;

return $this;
}

public function getBehavior(): ?string
{
return $this->behavior;
}

public function setBehavior(?string $behavior): self
{
$this->behavior = $behavior;

return $this;
}

public function getProcessOrderCheckedDefault(): ?bool
{
return $this->processOrderCheckedDefault;
}

public function setProcessOrderCheckedDefault(?bool $processOrderCheckedDefault): self
{
$this->processOrderCheckedDefault = $processOrderCheckedDefault;

return $this;
}
}

+ 8
- 0
Model/Credit/CreditConfigInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CreditConfigInterface
{

}

+ 184
- 0
Model/Credit/CreditHistory.php View File

@@ -0,0 +1,184 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\OrderPayment;
use App\Entity\OrderRefund;
use App\Entity\UserMerchant;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderRefundInterface;
use Lc\ShopBundle\Context\PayoffInterface;
use Lc\ShopBundle\Context\UserMerchantInterface;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class CreditHistory extends AbstractEntity implements PayoffInterface
{
use PayoffTrait;

const TYPE_CREDIT = 'credit';
const TYPE_DEBIT = 'debit';

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $amount;

/**
* @ORM\Column(type="string", length=31)
*/
protected $type;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserMerchantInterface", inversedBy="creditHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $userMerchant;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderPaymentInterface", cascade={"persist", "remove"})
*/
protected $orderPayment;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderRefundInterface", cascade={"persist", "remove"})
*/
protected $orderRefund;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

public function getAmount(): ?float
{
return $this->amount;
}

public function setAmount(?float $amount): self
{
$this->amount = $amount;

return $this;
}

public function getAmountInherited(): float
{
if ($this->getOrderPayment() !== null) {
return $this->getOrderPayment()->getAmount();
} else if ($this->getOrderRefund() !== null) {
return $this->getOrderRefund()->getAmount();
} else {
return $this->getAmount();
}
}

public function getMeanPaymentInherited(): string
{
if ($this->getOrderPayment() !== null) {
return $this->getOrderPayment()->getMeanPayment();
} else if ($this->getOrderRefund() !== null) {
return $this->getOrderRefund()->getMeanPayment();
} else {
return $this->getMeanPayment();
}
}

public function getPaidAtInherited (): ?\DateTimeInterface
{
if ($this->getOrderPayment() !== null) {
return $this->getOrderPayment()->getPaidAt();
} else if ($this->getOrderRefund() !== null) {
return $this->getOrderRefund()->getPaidAt();
} else {
return $this->getPaidAt();
}
}

public function getReferenceInherited (): ?string
{
if ($this->getOrderPayment() !== null) {
return $this->getOrderPayment()->getReference();
} else if ($this->getOrderRefund() !== null) {
return $this->getOrderRefund()->getReference();
} else {
return $this->getReference();
}
}

public function getCommentInherited (): ?string
{
if ($this->getOrderPayment() !== null) {
return $this->getOrderPayment()->getComment();
} else if ($this->getOrderRefund() !== null) {
return $this->getOrderRefund()->getComment();
} else {
return $this->getComment();
}
}

public function getMeanPaymentInheritedLabel(): string
{
return 'field.default.meanPaymentOptions.'.$this->getMeanPaymentInherited() ;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getUserMerchant(): ?UserMerchantInterface
{
return $this->userMerchant;
}

public function setUserMerchant(?UserMerchantInterface $userMerchant): self
{
$this->userMerchant = $userMerchant;

return $this;
}

public function getOrderPayment(): ?OrderPaymentInterface
{
return $this->orderPayment;
}

public function setOrderPayment(?OrderPaymentInterface $orderPayment): self
{
$this->orderPayment = $orderPayment;

return $this;
}

public function getOrderRefund(): ?OrderRefundInterface
{
return $this->orderRefund;
}

public function setOrderRefund(?OrderRefundInterface $orderRefund): self
{
$this->orderRefund = $orderRefund;

return $this;
}
}

+ 8
- 0
Model/Credit/CreditHistoryInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CreditHistoryInterface
{

}

+ 288
- 0
Model/File/Document.php View File

@@ -0,0 +1,288 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class Document extends AbstractDocumentEntity implements FilterMerchantInterface
{
const TYPE_INVOICE = 'invoice';
const TYPE_QUOTATION = 'quotation';
const TYPE_PURCHASE_ORDER = 'purchase-order';
const TYPE_DELIVERY_NOTE = 'delivery-note';

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=64)
*/
protected $type;

/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
protected $reference;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $logo;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchantAddress;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $buyerAddress;

/**
* @ORM\Column(type="text")
*/
protected $merchantAddressText;

/**
* @ORM\Column(type="text",nullable=true)
*/
protected $buyerAddressText;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $deliveryAddressText;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isSent;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documents")
* @ORM\JoinColumn(nullable=true)
*/
protected $orderShops;


/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"})
*/
protected $orderRefund;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

public function __construct()
{
$this->orderShops = new ArrayCollection();
}

public function __toString()
{
return $this->getReference();
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getLabel()
{
if ($this->getType() == self::TYPE_INVOICE) {
return 'Facture';
} elseif ($this->getType() == self::TYPE_QUOTATION) {
return 'Devis';
} elseif ($this->getType() == self::TYPE_PURCHASE_ORDER) {
return 'Bon de commande';
} elseif ($this->getType() == self::TYPE_DELIVERY_NOTE) {
return 'Bon de livraison';
}
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getReference(): ?string
{
return $this->reference;
}

public function setReference(?string $reference): self
{
$this->reference = $reference;

return $this;
}

public function getLogo(): ?string
{
return $this->logo;
}

public function setLogo(string $logo): self
{
$this->logo = $logo;

return $this;
}

public function getMerchantAddress(): ?Address
{
return $this->merchantAddress;
}

public function setMerchantAddress(?Address $merchantAddress): self
{
$this->merchantAddress = $merchantAddress;

return $this;
}

public function getBuyerAddress(): ?Address
{
return $this->buyerAddress;
}

public function setBuyerAddress(?Address $buyerAddress): self
{
$this->buyerAddress = $buyerAddress;

return $this;
}

public function getMerchantAddressText(): ?string
{
return $this->merchantAddressText;
}

public function setMerchantAddressText(string $merchantAddressText): self
{
$this->merchantAddressText = $merchantAddressText;

return $this;
}

public function getBuyerAddressText(): ?string
{
return $this->buyerAddressText;
}

public function setBuyerAddressText(?string $buyerAddressText): self
{
$this->buyerAddressText = $buyerAddressText;

return $this;
}

public function getDeliveryAddressText(): ?string
{
return $this->deliveryAddressText;
}

public function setDeliveryAddressText(?string $deliveryAddressText): self
{
$this->deliveryAddressText = $deliveryAddressText;

return $this;
}

public function getIsSent(): ?bool
{
return $this->isSent;
}

public function setIsSent(?bool $isSent): self
{
$this->isSent = $isSent;

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrderShops(): Collection
{
return $this->orderShops;
}

public function addOrderShop(OrderShop $orderShop): self
{
if (!$this->orderShops->contains($orderShop)) {
$this->orderShops[] = $orderShop;
$orderShop->addDocument($this);
}

return $this;
}

public function removeOrderShop(OrderShop $orderShop): self
{
if ($this->orderShops->contains($orderShop)) {
$this->orderShops->removeElement($orderShop);
$orderShop->removeDocument($this);
}

return $this;
}


public function getOrderRefund(): ?OrderRefund
{
return $this->orderRefund;
}

public function setOrderRefund(OrderRefund $orderRefund): self
{
$this->orderRefund = $orderRefund;

// set the owning side of the relation if necessary
if ($orderRefund->getDocument() !== $this) {
$orderRefund->setDocument($this);
}

return $this;
}
}

+ 8
- 0
Model/File/DocumentInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface DocumentInterface
{

}

+ 52
- 0
Model/Global/TaxRate.php View File

@@ -0,0 +1,52 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class TaxRate extends AbstractEntity
{

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="float")
*/
protected $value;


public function __toString()
{
return $this->getTitle() ;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getValue(): ?float
{
return $this->value;
}

public function setValue(float $value): self
{
$this->value = $value;

return $this;
}
}

+ 8
- 0
Model/Global/TaxRateInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface TaxRateInterface
{

}

+ 120
- 0
Model/Global/Unit.php View File

@@ -0,0 +1,120 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Model\AbstractEntity;

/**
* @ORM\MappedSuperclass
*/
abstract class Unit extends AbstractEntity
{
/**
* @ORM\Column(type="string", length=32)
*/
protected $unit;

/**
* @ORM\Column(type="string", length=32)
*/
protected $wording;

/**
* @ORM\Column(type="string", length=32)
*/
protected $wordingUnit;

/**
* @ORM\Column(type="string", length=32)
*/
protected $wordingShort;

/**
* @ORM\Column(type="integer")
*/
protected $coefficient;

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Unit")
* @ORM\JoinColumn(nullable=true)
*/
protected $unitReference;

public function __toString()
{
return $this->getWording() ;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getWording(): ?string
{
return $this->wording;
}

public function setWording(string $wording): self
{
$this->wording = $wording;

return $this;
}

public function getWordingUnit(): ?string
{
return $this->wordingUnit;
}

public function setWordingUnit(string $wordingUnit): self
{
$this->wordingUnit = $wordingUnit;

return $this;
}

public function getWordingShort(): ?string
{
return $this->wordingShort;
}

public function setWordingShort(string $wordingShort): self
{
$this->wordingShort = $wordingShort;

return $this;
}

public function getCoefficient(): ?int
{
return $this->coefficient;
}

public function setCoefficient(int $coefficient): self
{
$this->coefficient = $coefficient;

return $this;
}

public function getUnitReference(): ?self
{
return $this->unitReference;
}

public function setUnitReference(?self $unitReference): self
{
$this->unitReference = $unitReference;

return $this;
}
}

+ 8
- 0
Model/Global/UnitInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface UnitInterface
{

}

+ 392
- 0
Model/Merchant/Merchant.php View File

@@ -0,0 +1,392 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\CreditConfigInterface;
use Lc\ShopBundle\Context\GroupUserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Merchant extends AbstractDocumentEntity
{
/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\CreditConfigInterface", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
protected $creditConfig;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $taxRate;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="merchants")
*/
protected $pointSales;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="merchant")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\MerchantConfigInterface", mappedBy="merchant", orphanRemoval=true, cascade={"persist"})
*/
protected $merchantConfigs;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="merchant", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
protected $address;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="merchant", orphanRemoval=true)
*/
protected $productCategories;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\NewsInterface", mappedBy="merchant", orphanRemoval=true)
*/
protected $news;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PageInterface", mappedBy="merchant", orphanRemoval=true)
*/
protected $pages;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\NewsletterInterface", mappedBy="merchant")
*/
protected $newsletters;

/**
* @ORM\OneToMany(targetEntity="App\Entity\GroupUser", mappedBy="merchant")
*/
protected $groupUsers;


public function __construct()
{
$this->pointSales = new ArrayCollection();
$this->productFamilies = new ArrayCollection();
$this->merchantConfigs = new ArrayCollection();
$this->productCategories = new ArrayCollection();
$this->news = new ArrayCollection();
$this->groupUsers = new ArrayCollection();
$this->newsletters = new ArrayCollection();
}

public function getCreditConfig(): ?CreditConfig
{
return $this->creditConfig;
}

public function setCreditConfig(CreditConfigInterface $creditConfig): self
{
$this->creditConfig = $creditConfig;

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}

/**
* @return Collection|PointSale[]
*/
public function getPointSales(): Collection
{
return $this->pointSales;
}

public function addPointSale(PointSale $pointSale): self
{
if (!$this->pointSales->contains($pointSale)) {
$this->pointSales[] = $pointSale;
$pointSale->addMerchant($this);
}

return $this;
}

public function removePointSale(PointSale $pointSale): self
{
if ($this->pointSales->contains($pointSale)) {
$this->pointSales->removeElement($pointSale);
$pointSale->removeMerchant($this);
}

return $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->setMerchant($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
// set the owning side to null (unless already changed)
if ($productFamily->getMerchant() === $this) {
$productFamily->setMerchant(null);
}
}

return $this;
}

/**
* @return Collection|MerchantConfig[]
*/
public function getMerchantConfigs(): Collection
{
return $this->merchantConfigs;
}

public function addMerchantConfig(MerchantConfig $merchantConfig): self
{
if (!$this->merchantConfigs->contains($merchantConfig)) {
$this->merchantConfigs[] = $merchantConfig;
$merchantConfig->setMerchant($this);
}

return $this;
}

public function removeMerchantConfig(MerchantConfig $merchantConfig): self
{
if ($this->merchantConfigs->contains($merchantConfig)) {
$this->merchantConfigs->removeElement($merchantConfig);
// set the owning side to null (unless already changed)
if ($merchantConfig->getMerchant() === $this) {
$merchantConfig->setMerchant(null);
}
}

return $this;
}

public function getMerchantConfig($name)
{
if($this->getMerchantConfigs()) {
foreach($this->getMerchantConfigs() as $merchantConfig) {
if($merchantConfig->getName() == $name) {
return $merchantConfig->getValue() ;
}
}
}

return false ;
}

public function getAddress(): ?Address
{
return $this->address;
}

public function setAddress(Address $address): self
{
$this->address = $address;

return $this;
}

/**
* @return Collection|ProductCategory[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
$productCategory->setMerchant($this);
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getMerchant() === $this) {
$productCategory->setMerchant(null);
}
}

return $this;
}

/**
* @return Collection|News[]
*/
public function getNews(): Collection
{
return $this->news;
}

public function addNews(News $news): self
{
if (!$this->news->contains($news)) {
$this->news[] = $news;
$news->setMerchant($this);
}

return $this;
}

public function removeNews(News $news): self
{
if ($this->news->contains($news)) {
$this->news->removeElement($news);
// set the owning side to null (unless already changed)
if ($news->getMerchant() === $this) {
$news->setMerchant(null);
}
}

return $this;
}

/**
* @return Collection|Page[]
*/
public function getPages(): Collection
{
return $this->pages;
}

public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages[] = $page;
$page->setMerchant($this);
}

return $this;
}

public function removePage(Page $page): self
{
if ($this->pages->contains($page)) {
$this->pages->removeElement($page);
// set the owning side to null (unless already changed)
if ($page->getMerchant() === $this) {
$page->setMerchant(null);
}
}

return $this;
}

/**
* @return Collection|Newsletter[]
*/
public function getNewsletters(): Collection
{
return $this->newsletters;
}

public function addNewsletter(Newsletter $newsletter): self
{
if (!$this->newsletters->contains($newsletter)) {
$this->newsletters[] = $newsletter;
$newsletter->setMerchant($this);
}

return $this;
}

public function removeNewsletter(News $newsletter): self
{
if ($this->newsletters->contains($newsletter)) {
$this->newsletters->removeElement($newsletter);
// set the owning side to null (unless already changed)
if ($newsletter->getMerchant() === $this) {
$newsletter->setMerchant(null);
}
}

return $this;
}

public function getNewsletter()
{
$newsletters = $this->getNewsletters() ;

foreach($newsletters as $newsletter) {
if($newsletter->getIsMain()) {
return $newsletter ;
}
}

return false ;
}

/**
* @return Collection|GroupUser[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}

public function addGroupUser(GroupUser $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->setMerchant($this);
}

return $this;
}

public function removeGroupUser(GroupUser $groupUser): self
{
if ($this->groupUsers->contains($groupUser)) {
$this->groupUsers->removeElement($groupUser);
// set the owning side to null (unless already changed)
if ($groupUser->getMerchant() === $this) {
$groupUser->setMerchant(null);
}
}

return $this;
}
}

+ 125
- 0
Model/Merchant/MerchantConfig.php View File

@@ -0,0 +1,125 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;

/**
* @ORM\MappedSuperclass()
* @Vich\Uploadable
*/
abstract class MerchantConfig extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="merchantConfigs")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=63)
*/
protected $name;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $value;

/**
* @ORM\ManyToOne(targetEntity=File::class, cascade={"persist", "remove"})
*/
protected $image;

public static $availableOptions = [];

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

public function getValue(): ?string
{
return $this->value;
}

public function setValue($value): self
{
$this->value = $value;

return $this;
}

public function getImage(): ?\App\Entity\File
{
return $this->image;
}

public function setImage(?File $image): self
{
$this->image = $image;

return $this;
}

public static function getAvailableOptions(): array
{
return static::$availableOptions;
}

public function getOption()
{
if (isset(static::$availableOptions[$this->getName()])) {
return static::$availableOptions[$this->getName()];
}

return false;
}

public function getOptionValue($key, $default = '')
{
$option = $this->getOption();
if ($option) {
if (isset($option[$key])) {
return $option[$key];
}
}

return $default;
}

public function getLabel()
{
return 'field.MerchantConfig.'.$this->getOptionValue('id');
}

public function getFieldType()
{
return $this->getOptionValue('type', 'text');
}

public function getDefaultValue()
{
return $this->getOptionValue('default');
}
}

+ 8
- 0
Model/Merchant/MerchantConfigInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface MerchantConfigInterface
{

}

+ 8
- 0
Model/Merchant/MerchantInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface MerchantInterface
{

}

+ 93
- 0
Model/Newsletter/Newsletter.php View File

@@ -0,0 +1,93 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Newsletter extends AbstractDocumentEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="newsletters")
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", mappedBy="newsletters")
*/
protected $users;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isMain;

public function __toString()
{
return $this->getTitle() ;
}

public function __construct()
{
$this->users = new ArrayCollection();
}

public function getMerchant(): ?Hub
{
return $this->merchant;
}

public function setMerchant(?Hub $merchant): self
{
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->addNewsletter($this);
}

return $this;
}

public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
$user->removeNewsletter($this);
}

return $this;
}

public function getIsMain(): ?bool
{
return $this->isMain;
}

public function setIsMain(?bool $isMain): self
{
$this->isMain = $isMain;

return $this;
}
}

+ 8
- 0
Model/Newsletter/NewsletterInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface NewsletterInterface
{

}

+ 17
- 0
Model/Order/OrderPayment.php View File

@@ -0,0 +1,17 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderPayoffInterface;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderPayment extends AbstractEntity implements OrderPayoffInterface
{
use OrderPayoffTrait;

}

+ 8
- 0
Model/Order/OrderPaymentInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface OrderPaymentInterface
{

}

+ 7
- 0
Model/Order/OrderPayoffInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderPayoffInterface
{
}

+ 202
- 0
Model/Order/OrderProduct.php View File

@@ -0,0 +1,202 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\OrderProductReductionCatalog;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\PriceInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProduct implements PriceInterface
{
use PriceTrait ;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderProducts", cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductInterface"))
*/
protected $product;

/**
* @ORM\Column(type="integer")
*/
protected $quantityOrder;

/**
* @ORM\Column(type="float")
*/
protected $quantityProduct;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderProductReductionCatalogInterface", cascade={"persist", "remove"})
*/
protected $orderProductReductionCatalog;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderProductRefundInterface", mappedBy="orderProduct", cascade={"persist", "remove"})
*/
protected $orderProductRefund;

public function __toString()
{
if($this->getTitle()) {
return $this->getTitle();
}
else{
return $this->getProduct()->getProductFamily()->getTitle(). ' - '.$this->getProduct()->getTitle();
}
}

public function getTitleOrderShop()
{
$product = $this->getProduct() ;
$productFamily = $product->getProductFamily() ;

$titleProduct = $product->getTitle() ;
$titleProductFamily = $productFamily->getTitle() ;

if(strlen($titleProduct) > 0 && strlen($titleProductFamily) > 0) {
$title = $titleProductFamily.' - '.$titleProduct ;
}
else {
$title = strlen($titleProduct) ? $titleProduct : $titleProductFamily ;
}

if($productFamily->hasProductsWithVariousWeight()) {
$title .= ' - '.$product->getQuantityLabelInherited() ;
}

return $title ;
}

public function getTitleSummaryAfterAddCart()
{
$title = '' ;

$product = $this->getProduct() ;
$productFamily = $product->getProductFamily() ;
$titleProduct = $product->getTitleInherited() ;
$titleProductFamily = $productFamily->getTitle() ;

// multiple
if($productFamily->getActiveProducts() && $productFamily->getBehaviorAddToCart() == 'multiple') {
$title .= $titleProduct ;
if($productFamily->hasProductsWithVariousWeight()) {
$title .= ' - '.$product->getQuantityLabelInherited() ;
}
}

// simple
if($productFamily->getBehaviorAddToCart() == 'simple') {
if($productFamily->getActiveProducts()) {
$title .= $titleProduct ;
if($productFamily->hasProductsWithVariousWeight()) {
$title .= ' - '.$product->getQuantityLabelInherited() ;
}
}
}

return $title ;
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getProduct(): ?Product
{
return $this->product;
}

public function setProduct(?Product $product): self
{
$this->product = $product;

return $this;
}

public function getQuantityOrder(): ?int
{
return $this->quantityOrder;
}

public function setQuantityOrder(int $quantityOrder): self
{
$this->quantityOrder = $quantityOrder;

return $this;
}

public function getQuantityProduct(): ?float
{
return $this->quantityProduct;
}

public function setQuantityProduct(float $quantityProduct): self
{
$this->quantityProduct = $quantityProduct;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getOrderProductReductionCatalog(): ?OrderProductReductionCatalog
{
return $this->orderProductReductionCatalog;
}

public function setOrderProductReductionCatalog(?OrderProductReductionCatalog $orderProductReductionCatalog): self
{
$this->orderProductReductionCatalog = $orderProductReductionCatalog;

return $this;
}
public function getOrderProductRefund(): ?OrderProductRefund
{
return $this->orderProductRefund;
}

public function setOrderProductRefund(OrderProductRefund $orderProductRefund): self
{
$this->orderProductRefund = $orderProductRefund;

// set the owning side of the relation if necessary
if ($orderProductRefund->getOrderProduct() !== $this) {
$orderProductRefund->setOrderProduct($this);
}

return $this;
}

}

+ 8
- 0
Model/Order/OrderProductInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderProductInterface
{

}

+ 31
- 0
Model/Order/OrderProductReductionCatalog.php View File

@@ -0,0 +1,31 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderProductReductionCatalogInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProductReductionCatalog implements OrderProductReductionCatalogInterface
{
use ReductionTrait ;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}
}

+ 8
- 0
Model/Order/OrderProductReductionCatalogInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface OrderProductReductionCatalogInterface
{

}

+ 87
- 0
Model/Order/OrderProductRefund.php View File

@@ -0,0 +1,87 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;


/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProductRefund
{
/**
* @ORM\Column(type="integer")
*/
protected $quantityRefund;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $title;

/**
* @ORM\Column(type="float")
*/
protected $price;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", inversedBy="orderProductRefund", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $orderProduct;

public function getQuantityRefund(): ?int
{
return $this->quantityRefund;
}

public function setQuantityOrder(int $quantityRefund): self
{
$this->quantityRefund = $quantityRefund;

return $this;
}

public function getPrice(): ?float
{
return $this->getPrice() ;
}

public function setPrice(?float $price): self
{
$this->price = $price;

return $this;
}

public function getTitleInherited(): ?string
{
return $this->title;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getOrderProduct(): ?OrderProduct
{
return $this->orderProduct;
}

public function setOrderProduct(OrderProduct $orderProduct): self
{
$this->orderProduct = $orderProduct;

return $this;
}
}


+ 7
- 0
Model/Order/OrderProductRefundInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderProductRefundInterface
{
}

+ 77
- 0
Model/Order/OrderReductionCart.php View File

@@ -0,0 +1,77 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\ReductionCartPropertyInterface;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderReductionCart implements ReductionInterface, ReductionCartPropertyInterface
{
use ReductionTrait;
use ReductionCartPropertyTrait;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderReductionCarts")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ReductionCartInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $reductionCart;

public function __toString()
{
return $this->title;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getReductionCart(): ?ReductionCart
{
return $this->reductionCart;
}

public function setReductionCart(?ReductionCart $reductionCart): self
{
$this->reductionCart = $reductionCart;

return $this;
}


}

+ 8
- 0
Model/Order/OrderReductionCartInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderReductionCartInterface
{

}

+ 93
- 0
Model/Order/OrderReductionCredit.php View File

@@ -0,0 +1,93 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderReductionCredit implements ReductionInterface
{
use ReductionTrait ;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderReductionCredits")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ReductionCreditInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $reductionCredit;


/**
* @ORM\Column(type="string", length=255)
*/
protected $type;


public function __toString()
{
return $this->title;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getReductionCredit(): ?ReductionCredit
{
return $this->reductionCredit;
}

public function setReductionCredit(?ReductionCredit $reductionCredit): self
{
$this->reductionCredit = $reductionCredit;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

}

+ 8
- 0
Model/Order/OrderReductionCreditInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderReductionCreditInterface
{

}

+ 52
- 0
Model/Order/OrderRefund.php View File

@@ -0,0 +1,52 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderPayoffInterface;
use Lc\ShopBundle\Context\ReductionInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderRefund extends AbstractEntity implements OrderPayoffInterface
{
use OrderPayoffTrait;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $deliveryRefundAmount;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\DocumentInterface", inversedBy="orderRefund", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $document;

public function getDeliveryRefundAmount(): ?float
{
return $this->deliveryRefundAmount;
}

public function setDeliveryRefundAmount(?float $deliveryRefundAmount): self
{
$this->deliveryRefundAmount = $deliveryRefundAmount;

return $this;
}

public function getDocument(): ?Document
{
return $this->document;
}

public function setDocument(Document $document): self
{
$this->document = $document;

return $this;
}
}


+ 7
- 0
Model/Order/OrderRefundInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderRefundInterface
{
}

+ 604
- 0
Model/Order/OrderShop.php View File

@@ -0,0 +1,604 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Services\Order\OrderUtils;
use Lc\ShopBundle\Model\OrderStatus ;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderShop extends AbstractEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders", fetch="EAGER")
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Visitor", inversedBy="orders")
*/
protected $visitor;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface")
*/
protected $invoiceAddress;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $invoiceAddressText;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $validationDate;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $autoPayment;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $meanPayment;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusHistoryInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderStatusHistories;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderPaymentInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderPayments;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EAGER")
*/
protected $orderProducts;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $deliveryInfos;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderStatus;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderReductionCartInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderReductionCarts;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderReductionCreditInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderReductionCredits;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\DocumentInterface", inversedBy="orderShops")
*/
protected $documents;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop")
*/
protected $tickets;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="orderShops")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct()
{
$this->orderStatusHistories = new ArrayCollection();
$this->orderPayments = new ArrayCollection();
$this->orderProducts = new ArrayCollection();
$this->creditHistories = new ArrayCollection();
$this->orderReductionCarts = new ArrayCollection();
$this->orderReductionCredits = new ArrayCollection();
$this->documents = new ArrayCollection();
}

public function __toString()
{
if($this->getValidationDate()) {
return 'Commande du '.$this->getValidationDate()->format('d/m/Y') ;
}
else {
return 'Commande #'.$this->getId() ;
}
}

public function getValidationDate(): ?\DateTimeInterface
{
return $this->validationDate;
}

public function setValidationDate(\DateTimeInterface $validationDate): self
{
$this->validationDate = $validationDate;

return $this;
}

public function getDateCreated()
{
$orderStatusHistory = $this->getOrderStatusHistory(OrderStatus::ALIAS_WAITING_DELIVERY);
if ($orderStatusHistory) {
return $orderStatusHistory->getCreatedAt();
}

return null;
}

public function getOrderStatusHistory($status)
{
$orderStatusHistories = $this->getOrderStatusHistories();
if (count($orderStatusHistories) > 0) {
foreach ($orderStatusHistories as $orderStatusHistory) {
if ($orderStatusHistory->getOrderStatus() == $status) {
return $orderStatusHistory;
}
}
}

return null;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getInvoiceAddress(): ?Address
{
return $this->invoiceAddress;
}

public function setInvoiceAddress(?Address $invoiceAddress): self
{
$this->invoiceAddress = $invoiceAddress;

return $this;
}

public function getInvoiceAddressText(): ?string
{
return $this->invoiceAddressText;
}

public function setInvoiceAddressText(string $invoiceAddressText): self
{
$this->invoiceAddressText = $invoiceAddressText;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}

public function getAutoPayment(): ?bool
{
return $this->autoPayment;
}

public function setAutoPayment(bool $autoPayment): self
{
$this->autoPayment = $autoPayment;

return $this;
}

public function getMeanPayment(): ?string
{
return $this->meanPayment;
}

public function setMeanPayment(string $meanPayment): self
{
$this->meanPayment = $meanPayment;

return $this;
}

/**
* @return Collection|OrderStatusHistory[]
*/
public function getOrderStatusHistories(): Collection
{
return $this->orderStatusHistories;
}

public function addOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
{
if (!$this->orderStatusHistories->contains($orderStatusHistory)) {
$this->orderStatusHistories[] = $orderStatusHistory;
$orderStatusHistory->setOrderShop($this);
}

return $this;
}

public function removeOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
{
if ($this->orderStatusHistories->contains($orderStatusHistory)) {
$this->orderStatusHistories->removeElement($orderStatusHistory);
// set the owning side to null (unless already changed)
if ($orderStatusHistory->getOrderShop() === $this) {
$orderStatusHistory->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|OrderPayment[]
*/
public function getOrderPayments($meanPayment = null): Collection
{
if($meanPayment) {
$orderPaymentsReturn = new ArrayCollection() ;

foreach($this->orderPayments as $orderPayment) {
if($orderPayment->getMeanPayment() == $meanPayment) {
$orderPaymentsReturn[] = $orderPayment ;
}
}

return $orderPaymentsReturn ;
}

return $this->orderPayments;
}

public function addOrderPayment(OrderPayment $orderPayment): self
{
if (!$this->orderPayments->contains($orderPayment)) {
$this->orderPayments[] = $orderPayment;
$orderPayment->setOrderShop($this);
}

return $this;
}

public function removeOrderPayment(OrderPayment $orderPayment): self
{
if ($this->orderPayments->contains($orderPayment)) {
$this->orderPayments->removeElement($orderPayment);
// set the owning side to null (unless already changed)
if ($orderPayment->getOrderShop() === $this) {
$orderPayment->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|OrderProduct[]
*/
public function getOrderProducts(): Collection
{
return $this->orderProducts;
}

public function addOrderProduct(OrderProduct $orderProduct): self
{
if (!$this->orderProducts->contains($orderProduct)) {
$this->orderProducts[] = $orderProduct;
$orderProduct->setOrderShop($this);
}

return $this;
}

public function removeOrderProduct(OrderProduct $orderProduct): self
{
if ($this->orderProducts->contains($orderProduct)) {
$this->orderProducts->removeElement($orderProduct);
// set the owning side to null (unless already changed)
if ($orderProduct->getOrderShop() === $this) {
$orderProduct->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|CreditHistory[]
*/
public function getCreditHistories(): Collection
{
return $this->creditHistories;
}

public function addCreditHistory(CreditHistory $creditHistory): self
{
if (!$this->creditHistories->contains($creditHistory)) {
$this->creditHistories[] = $creditHistory;
$creditHistory->setOrderShop($this);
}

return $this;
}

public function removeCreditHistory(CreditHistory $creditHistory): self
{
if ($this->creditHistories->contains($creditHistory)) {
$this->creditHistories->removeElement($creditHistory);
// set the owning side to null (unless already changed)
if ($creditHistory->getOrderShop() === $this) {
$creditHistory->setOrderShop(null);
}
}

return $this;
}

public function getVisitor(): ?Visitor
{
return $this->visitor;
}

public function setVisitor(?Visitor $visitor): self
{
$this->visitor = $visitor;

return $this;
}

public function getDeliveryInfos(): ?string
{
return $this->deliveryInfos;
}

public function setDeliveryInfos(?string $deliveryInfos): self
{
$this->deliveryInfos = $deliveryInfos;

return $this;
}


public function getOrderStatus(): ?OrderStatus
{
return $this->orderStatus;
}

public function setOrderStatusProtected(?OrderStatus $orderStatus): self
{
$this->orderStatus = $orderStatus;

return $this;
}


/**
* @return Collection|OrderReductionCart[]
*/
public function getOrderReductionCarts(): Collection
{
return $this->orderReductionCarts;
}

public function addOrderReductionCart(OrderReductionCart $orderReductionCart): self
{
if (!$this->orderReductionCarts->contains($orderReductionCart)) {
$this->orderReductionCarts[] = $orderReductionCart;
$orderReductionCart->setOrderShop($this);
}

return $this;
}

public function removeOrderReductionCart(OrderReductionCart $orderReductionCart): self
{
if ($this->orderReductionCarts->contains($orderReductionCart)) {
$this->orderReductionCarts->removeElement($orderReductionCart);
// set the owning side to null (unless already changed)
if ($orderReductionCart->getOrderShop() === $this) {
$orderReductionCart->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|OrderReductionCart[]
*/
public function getOrderReductionCredits(): Collection
{
return $this->orderReductionCredits;
}

public function addOrderReductionCredit(OrderReductionCredit $orderReductionCredit): self
{
if (!$this->orderReductionCredits->contains($orderReductionCredit)) {
$this->orderReductionCredits[] = $orderReductionCredit;
$orderReductionCredit->setOrderShop($this);
}

return $this;
}

public function removeOrderReductionCredit(OrderReductionCredit $orderReductionCredit): self
{
if ($this->orderReductionCredits->contains($orderReductionCredit)) {
$this->orderReductionCredits->removeElement($orderReductionCredit);
// set the owning side to null (unless already changed)
if ($orderReductionCredit->getOrderShop() === $this) {
$orderReductionCredit->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}

public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
}

return $this;
}

public function removeDocument(Document $document): self
{
if ($this->documents->contains($document)) {
$this->documents->removeElement($document);
}

return $this;
}

public function getDocumentInvoice(): Document
{
foreach($this->getDocuments() as $document) {
if($document->getType() == Document::TYPE_INVOICE) {
return $document ;
}
}

return false ;
}

/**
* @return Collection|Ticket[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}

public function addTicket(Ticket $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setOrderShop($this);
}

return $this;
}

public function removeTicket(Ticket $ticket): self
{
if ($this->tickets->contains($ticket)) {
$this->tickets->removeElement($ticket);
// set the owning side to null (unless already changed)
if ($ticket->getOrderShop() === $this) {
$ticket->setOrderShop(null);
}
}

return $this;
}

public function isValid() {
if($this->getOrderStatus() && in_array($this->getOrderStatus()->getAlias(), OrderStatus::$statusAliasAsValid) > 0) {
return true ;
}

return false ;
}

public function isCart() {
if($this->getOrderStatus() && in_array($this->getOrderStatus()->getAlias(), OrderStatus::$statusAliasAsCart) > 0) {
return true ;
}

return false ;
}

public function getSection(): ?Section
{
return $this->section;
}

public function setSection(?Section $section): self
{
$this->section = $section;

return $this;
}

}

+ 8
- 0
Model/Order/OrderShopInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderShopInterface
{

}

+ 8
- 0
Model/Order/OrderShopPriceUtilsInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface OrderShopPriceUtilsInterface
{

}

+ 145
- 0
Model/Order/OrderStatus.php View File

@@ -0,0 +1,145 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderStatus
{
const ALIAS_CART = 'cart' ;
const ALIAS_CART_CANCELED = 'cart-canceled' ;
const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ;
const ALIAS_WAITING_BANK_RETURN = 'waiting-bank-return' ;
const ALIAS_PARTIAL_PAYMENT = 'partial-payment' ;
const ALIAS_PAID = 'paid' ;
const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ;
const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ;
const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment' ;
const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment' ;
const ALIAS_DONE = 'done' ;
const ALIAS_CANCELED = 'canceled' ;
const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund' ;
const ALIAS_REFUND = 'refund' ;


//TODO : AJOUTER un champ valid ds orderSTATUS
static $statusAliasAsValid = [
self::ALIAS_PAID,
self::ALIAS_WAITING_DELIVERY,
self::ALIAS_WAITING_BANK_RETURN,
self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
self::ALIAS_DELIVERED_WITHOUT_PAYMENT,
self::ALIAS_DONE
] ;

static $statusAliasWaitingDelivery = [
self::ALIAS_WAITING_DELIVERY,
self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
];

static $statusAliasAsCart = [
self::ALIAS_CART,
self::ALIAS_PARTIAL_PAYMENT,
self::ALIAS_WAITING_PAYMENT_ONLINE,
self::ALIAS_ERROR_PAYMENT_ONLINE
];

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface")
*/
protected $nextStatusAllowed;

/**
* @ORM\Column(type="string", length=255)
*/
protected $alias;

public function __toString()
{
return $this->title. ' ['.$this->alias.']';
}

public function __construct()
{
$this->nextStatusAllowed = new ArrayCollection();
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): self
{
$this->description = $description;

return $this;
}

/**
* @return Collection|self[]
*/
public function getNextStatusAllowed(): Collection
{
return $this->nextStatusAllowed;
}

public function addNextStatusAllowed(self $nextStatusAllowed): self
{
if (!$this->nextStatusAllowed->contains($nextStatusAllowed)) {
$this->nextStatusAllowed[] = $nextStatusAllowed;
}

return $this;
}

public function removeNextStatusAllowed(self $nextStatusAllowed): self
{
if ($this->nextStatusAllowed->contains($nextStatusAllowed)) {
$this->nextStatusAllowed->removeElement($nextStatusAllowed);
}

return $this;
}

public function getAlias(): ?string
{
return $this->alias;
}

public function setAlias(string $alias): self
{
$this->alias = $alias;

return $this;
}


}

+ 84
- 0
Model/Order/OrderStatusHistory.php View File

@@ -0,0 +1,84 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;


/**
* @ORM\MappedSuperclass()
*/
abstract class OrderStatusHistory extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderStatusHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderStatus;

/**
* @ORM\Column(type="string", length=31)
*/
protected $origin;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
public function __toString()
{
return $this->getOrderStatus()->getAlias(). ' le : '.$this->getCreatedAt()->format('d-m-Y H:i').'('.$this->getOrigin().')';
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getOrderStatus(): ?OrderStatus
{
return $this->orderStatus;
}

public function setOrderStatus(?OrderStatus $orderStatus): self
{
$this->orderStatus = $orderStatus;

return $this;
}

public function getOrigin(): ?string
{
return $this->origin;
}

public function setOrigin(string $origin): self
{
$this->origin = $origin;

return $this;
}
}

+ 8
- 0
Model/Order/OrderStatusHistoryInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderStatusHistoryInterface
{

}

+ 8
- 0
Model/Order/OrderStatusInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderStatusInterface
{

}

+ 175
- 0
Model/PointSale/PointSale.php View File

@@ -0,0 +1,175 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\User;
use App\Entity\UserPointSale;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\OrderAmountMinInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSale extends AbstractDocumentEntity implements FilterMultipleMerchantsInterface, OrderAmountMinInterface
{

use OrderAmountMin;
/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pointSales")
*/
protected $merchants;

/**
* @ORM\Column(type="string", length=63, nullable=true)
*/
protected $code;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PointSaleDayInfoInterface", mappedBy="pointSale", orphanRemoval=true)
*/
protected $pointSaleDayInfos;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $address;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\UserPointSaleInterface", mappedBy="pointSale", orphanRemoval=true)
*/
protected $userPointSales;


public function __construct()
{
$this->merchants = new ArrayCollection();
$this->pointSaleDayInfos = new ArrayCollection();
$this->userPointSales = new ArrayCollection();
}

public function __toString()
{
return $this->getTitle() ;
}

public function labelAdminChoice()
{
return $this->getTitle();
}

/**
* @return Collection|Merchant[]
*/
public function getMerchants(): Collection
{
return $this->merchants;
}

public function addMerchant(Merchant $merchant): self
{
if (!$this->merchants->contains($merchant)) {
$this->merchants[] = $merchant;
}

return $this;
}

public function removeMerchant(Merchant $merchant): self
{
if ($this->merchants->contains($merchant)) {
$this->merchants->removeElement($merchant);
}

return $this;
}

public function getCode(): ?string
{
return $this->code;
}

public function setCode(?string $code): self
{
$this->code = $code;

return $this;
}

/**
* @return Collection|PointSaleDayInfo[]
*/
public function getPointSaleDayInfos(): Collection
{
return $this->pointSaleDayInfos;
}

public function addPointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
{
if (!$this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
$this->pointSaleDayInfos[] = $pointSaleDayInfo;
$pointSaleDayInfo->setPointSale($this);
}

return $this;
}

public function removePointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
{
if ($this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
$this->pointSaleDayInfos->removeElement($pointSaleDayInfo);
// set the owning side to null (unless already changed)
if ($pointSaleDayInfo->getPointSale() === $this) {
$pointSaleDayInfo->setPointSale(null);
}
}

return $this;
}

public function getAddress(): ?Address
{
return $this->address;
}

public function setAddress(Address $address): self
{
$this->address = $address;

return $this;
}

/**
* @return Collection|UserPointSale[]
*/
public function getUserPointSales(): Collection
{
return $this->userPointSales;
}

public function addUserPointSale(UserPointSale $userPointSale): self
{
if (!$this->userPointSales->contains($userPointSale)) {
$this->userPointSales[] = $userPointSale;
$userPointSale->setPointSale($this);
}

return $this;
}

public function removeUserPointSale(UserPointSale $userPointSale): self
{
if ($this->userPointSales->contains($userPointSale)) {
$this->userPointSales->removeElement($userPointSale);
// set the owning side to null (unless already changed)
if ($userPointSale->getPointSale() === $this) {
$userPointSale->setPointSale(null);
}
}

return $this;
}
}

+ 80
- 0
Model/PointSale/PointSaleDayInfo.php View File

@@ -0,0 +1,80 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSaleDayInfo extends AbstractEntity
{
/**
* @ORM\Column(type="boolean")
*/
protected $active;

/**
* @ORM\Column(type="smallint")
*/
protected $day;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", inversedBy="pointSaleDayInfos")
* @ORM\JoinColumn(nullable=false)
*/
protected $pointSale;

public function getActive(): ?bool
{
return $this->active;
}

public function setActive(bool $active): self
{
$this->active = $active;

return $this;
}

public function getDay(): ?int
{
return $this->day;
}

public function setDay(int $day): self
{
$this->day = $day;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): self
{
$this->description = $description;

return $this;
}

public function getPointSale(): ?PointSale
{
return $this->pointSale;
}

public function setPointSale(?PointSale $pointSale): self
{
$this->pointSale = $pointSale;

return $this;
}
}

+ 8
- 0
Model/PointSale/PointSaleDayInfoInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PointSaleDayInfoInterface
{

}

+ 8
- 0
Model/PointSale/PointSaleInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PointSaleInterface
{

}

+ 221
- 0
Model/Product/Product.php View File

@@ -0,0 +1,221 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\PriceInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Lc\ShopBundle\Context\SortableInterface;
use Lc\ShopBundle\Services\Price;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class Product extends AbstractEntity implements SortableInterface, ProductPropertyInterface, PriceInterface
{
use SortableTrait;
use ProductPropertyTrait;
use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", inversedBy="products", cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
protected $productFamily;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $title;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $originProduct;

public function __construct()
{
$this->orderProducts = new ArrayCollection();
$this->status = 1;
}

public function __toString()
{
$title = $this->getProductFamily()->getTitle();

if ($this->getTitle() && strlen($this->getTitle())) {
$title .= ' - ' . $this->getTitle();
}

if($this->getProductFamily()->hasProductsWithVariousWeight()) {
$title .= ' - '.$this->getQuantityLabelInherited() ;
}

return $title;
}

public function getBuyingPriceInherited()
{
if ($this->getBuyingPrice()) {
return $this->getBuyingPrice();
} else {
return $this->getProductFamily()->getBuyingPrice();
}
}

public function getBuyingPriceByRefUnitInherited()
{
if ($this->getBuyingPriceByRefUnit()) {
return $this->getBuyingPriceByRefUnit();
} else {
return $this->getProductFamily()->getBuyingPriceByRefUnit();
}
}

public function getPriceInherited()
{
if ($this->getPrice()) {
return $this->getPrice();
} else {
return $this->getProductFamily()->getPrice();
}
}

public function getPriceByRefUnitInherited()
{
if ($this->getPriceByRefUnit()) {
return $this->getPriceByRefUnit();
} else {
return $this->getProductFamily()->getPriceByRefUnit();
}
}

public function getBehaviorPriceInherited()
{
return $this->getProductFamily()->getBehaviorPrice();
}

public function getReductionCatalogInherited()
{
return $this->getProductFamily()->getReductionCatalog();
}

public function getUnitInherited()
{
if ($this->getUnit()) {
return $this->getUnit();
} else {
return $this->getProductFamily()->getUnit();
}
}

public function getTitleInherited()
{
if ($this->getTitle()) {
return $this->getTitle();
} else {
return $this->getProductFamily()->getTitle();
}
}

public function getQuantityInherited()
{
if ($this->getQuantity()) {
return $this->getQuantity();
} else {
return $this->getProductFamily()->getQuantity();
}
}

public function getQuantityLabelInherited()
{
$quantity = $this->getQuantityInherited();
$unit = $this->getUnitInherited();
return $quantity . $unit->getWordingShort();
}

public function getQuantityTitle($productFamily)
{
$title = $this->getQuantityLabelInherited();
if ($productFamily->hasProductsWithVariousWeight()) {
$title .= ', ' . $this->getTitleInherited();
}
return $title;
}

public function getAvailableQuantityInherited()
{
switch ($this->getProductFamily()->getBehaviorCountStock()) {
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
return $this->getProductFamily()->getAvailableQuantity();
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $this->getAvailableQuantity();
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return false;
break;
}
}

public function getTaxRateInherited()
{
return $this->getProductFamily()->getTaxRateInherited();
}

public function getProductFamily(): ?ProductFamily
{
return $this->productFamily;
}

public function setProductFamily(?ProductFamily $productFamily): self
{
$this->productFamily = $productFamily;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(?string $title): self
{
$this->title = $title;

return $this;
}

public function getOriginProduct(): ?bool
{
return $this->originProduct;
}

public function setOriginProduct(?bool $originProduct): self
{
$this->originProduct = $originProduct;

return $this;
}
}

+ 199
- 0
Model/Product/ProductCategory.php View File

@@ -0,0 +1,199 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\TreeInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProductCategory extends AbstractDocumentEntity implements TreeInterface, FilterMerchantInterface
{

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productCategories")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="childrens")
*/
protected $parent;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="parent" , fetch="EAGER"))
* @ORM\OrderBy({"position" = "ASC"})
*/
protected $childrens;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="productCategories")
*/
protected $productFamilies;

/**
* @ORM\Column(type="boolean")
*/
protected $saleStatus;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productCategories")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct()
{
$this->childrens = new ArrayCollection();
$this->productFamilies = new ArrayCollection();
}

public function __toString()
{
$parent = $this->getParent() ;
$title = $parent ? $parent->getTitle().' - ' : '' ;
$title .= $this->getTitle() ;
return $title ;
}

public function getParent(): ?self
{
return $this->parent;
}

public function setParent(?self $productCategory): self
{
$this->parent = $productCategory;

return $this;
}

public function getParentCategory()
{
if($this->getParent()) {
return $this->getParent() ;
}

return $this ;
}

/**
* @return Collection|self[]
*/
public function getChildrens(): Collection
{
//TODO les lignes ci-dessous ne devraient pas exister, sert à résoudre le problème d'ordre dans le menu
$iterator = $this->childrens->getIterator();
$iterator->uasort(function ($a, $b) {
return ($a->getPosition() < $b->getPosition()) ? -1 : 1;
});
return new ArrayCollection(iterator_to_array($iterator));
}

public function addChildren(self $productCategory): self
{
if (!$this->childrens->contains($productCategory)) {
$this->childrens[] = $productCategory;
$productCategory->setParent($this);
}

return $this;
}

public function removeChildren(self $productCategory): self
{
if ($this->childrens->contains($productCategory)) {
$this->childrens->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getParent() === $this) {
$productCategory->setParent(null);
}
}

return $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->addProductCategory($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
$productFamily->removeProductCategory($this);
}

return $this;
}

public function countProductFamilies($status = null)
{
$count = 0 ;

foreach($this->getProductFamilies() as $productFamily) {
if($status === null || ($status !== null && $productFamily->getStatus() == $status)) {
$count ++ ;
}
}

return $count ;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getSaleStatus(): ?bool
{
return $this->saleStatus;
}

public function setSaleStatus(bool $saleStatus): self
{
$this->saleStatus = $saleStatus;

return $this;
}

public function getSection(): ?Section
{
return $this->section;
}

public function setSection(?Section $section): self
{
$this->section = $section;

return $this;
}

}

+ 8
- 0
Model/Product/ProductCategoryInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductCategoryInterface
{

}

+ 929
- 0
Model/Product/ProductFamily.php View File

@@ -0,0 +1,929 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\PriceInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ProductPropertyInterface;
use Gedmo\Mapping\Annotation as Gedmo;


/**
* @ORM\MappedSuperclass()
*/

abstract class ProductFamily extends AbstractDocumentEntity implements ProductPropertyInterface, PriceInterface, FilterMerchantInterface
{

use ProductPropertyTrait;

const BEHAVIOR_COUNT_STOCK_UNLIMITED = 'unlimited' ;
const BEHAVIOR_COUNT_STOCK_BY_MEASURE = 'by-measure' ;
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family' ;
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product' ;

const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure' ;
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity' ;

const BEHAVIOR_STOCK_WEEK_RENEWABLE = 'renewable';
const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation';
const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable';

const WARNING_MESSAGE_TYPE_SUCCESS = 'success';
const WARNING_MESSAGE_TYPE_ERROR = 'error';
const WARNING_MESSAGE_TYPE_WARNING = 'warning';
const WARNING_MESSAGE_TYPE_INFO = 'info';

const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple';
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple';

const BEHAVIOR_PRICE_BY_PIECE = 'by-piece';
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit';

const PROPERTY_ORGANIC_LABEL_AB = 'ab';
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres';
const PROPERTY_ORGANIC_LABEL_HVE = 'hve';

const TYPE_EXPIRATION_DATE_DLC = 'dlc';
const TYPE_EXPIRATION_DATE_DDM = 'ddm';
const TYPE_EXPIRATION_DATE_DLUO = 'dluo';

const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family';
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product';

//Champ hydraté par ProductFamilyUtils
protected $reductionCatalog;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies")
*/
protected $productCategories;

/**
* @ORM\Column(type="boolean")
*/
protected $activeProducts;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $productsType;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $productsQuantityAsTitle;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $quantityLabel;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"})
* @ORM\OrderBy({"position" = "ASC"})
*/
protected $products;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
*/
protected $supplierTaxRate;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $subtitle;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $warningMessage;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $warningMessageType;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $note;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $behaviorOutOfStock;

/**
* @ORM\Column(type="string", length=31)
*/
protected $behaviorCountStock;

/**
* @ORM\Column(type="string", length=255)
*/
protected $behaviorDisplaySale;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $propertyNoveltyExpirationDate;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $propertyOrganicLabel;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyAllergens;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyComposition;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyFragrances;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyPackaging;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyCharacteristics;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyWeight;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyQuantity;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyFeature;


/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyVariety;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $propertyAlcoholLevel;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $behaviorExpirationDate;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $typeExpirationDate;

/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
protected $behaviorAddToCart;

/**
* @ORM\Column(type="string", length=31)
*/
protected $behaviorPrice;

/**
* @ORM\Column(type="boolean")
*/
protected $saleStatus;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productFamilies")
*/
protected $sections;

public function __construct()
{
$this->productCategories = new ArrayCollection();
$this->products = new ArrayCollection();
}

public function __toString()
{
return $this->getTitle();
}

public function getAvailableQuantityInherited()
{
$availableQuantity = 0 ;

switch ($this->getBehaviorCountStock()) {

case self::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
case self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$availableQuantity = $this->getAvailableQuantity() ;
break;

case self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :

foreach($this->getProductsOnline() as $product) {
$availableQuantity += $product->getAvailableQuantityInherited() ;
}
break ;

case self::BEHAVIOR_COUNT_STOCK_UNLIMITED :
$availableQuantity = false;
break;
}

return $availableQuantity ;
}

public function getTaxRateInherited()
{
if ($this->getTaxRate()) {
return $this->getTaxRate();
} else {
return $this->getMerchant()->getTaxRate();
}
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getActiveProducts(): ?bool
{
return $this->activeProducts;
}

public function setActiveProducts(bool $activeProducts): self
{
$this->activeProducts = $activeProducts;

return $this;
}

public function getProductsQuantityAsTitle(): ?bool
{
return $this->productsQuantityAsTitle;
}

public function setProductsQuantityAsTitle(bool $productsQuantityAsTitle): self
{
$this->productsQuantityAsTitle = $productsQuantityAsTitle;

return $this;
}

public function getProductsType(): ?string
{
return $this->productsType;
}

public function setProductsType(?string $productsType): self
{
$this->productsType = $productsType;

return $this;
}

public function getQuantityLabel(): ?string
{
return $this->quantityLabel;
}

public function setQuantityLabel(?string $quantityLabel): self
{
$this->quantityLabel = $quantityLabel;

return $this;
}

/**
* @return Collection|ProductInterface[]
*/
public function getProducts(): Collection
{
return $this->products;
}

public function getProductsOnline(): Collection
{
$products = $this->getProducts() ;
$productsOnlineArray = new ArrayCollection() ;

foreach($products as $product) {
if($product->getStatus() == 1 && $product->getOriginProduct() !=true) {
$productsOnlineArray[] = $product ;
}
}

return $productsOnlineArray ;
}

public function addProduct(ProductInterface $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setProductFamily($this);
}

return $this;
}

public function removeProduct(ProductInterface $product): self
{
if ($this->products->contains($product)) {
$this->products->removeElement($product);
// set the owning side to null (unless already changed)
if ($product->getProductFamily() === $this) {
$product->setProductFamily(null);
}
}

return $this;
}

public function getReductionCatalog(): ?ReductionCatalog
{
return $this->reductionCatalog;
}

public function getReductionCatalogInherited(): ?ReductionCatalog
{
return $this->getReductionCatalog() ;
}

public function setReductionCatalog(?ReductionCatalog $reductionCatalog): self
{
$this->reductionCatalog = $reductionCatalog;

return $this;
}
/**
* @return Collection|ProductCategory[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function initProductCategories()
{
$this->productCategories = new ArrayCollection();
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
}

return $this;
}

public function getProductCategoryParent()
{
$productCategories = $this->getProductCategories();

if (count($productCategories) > 0) {
return $productCategories[0]->getParent();
}

return false;
}

public function getProductCategoryChild()
{
$productCategories = $this->getProductCategories();

foreach ($productCategories as $productCategory) {
if ($productCategory->getParent()) {
return $productCategory;
}
}

return false;
}

public function getSupplierTaxRate(): ?TaxRate
{
return $this->supplierTaxRate;
}

public function setSupplierTaxRate(?TaxRate $supplierTaxRate): self
{
$this->supplierTaxRate = $supplierTaxRate;

return $this;
}

public function getSubtitle(): ?string
{
return $this->subtitle;
}

public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;

return $this;
}


public function getWarningMessage(): ?string
{
return $this->warningMessage;
}

public function setWarningMessage(?string $warningMessage): self
{
$this->warningMessage = $warningMessage;

return $this;
}

public function getWarningMessageType(): ?string
{
return $this->warningMessageType;
}

public function setWarningMessageType(?string $warningMessageType): self
{
$this->warningMessageType = $warningMessageType;

return $this;
}

public function getNote(): ?string
{
return $this->note;
}

public function setNote(?string $note): self
{
$this->note = $note;

return $this;
}

public function getBehaviorOutOfStock(): ?string
{
return $this->behaviorOutOfStock;
}

public function setBehaviorOutOfStock(?string $behaviorOutOfStock): self
{
$this->behaviorOutOfStock = $behaviorOutOfStock;

return $this;
}

public function getBehaviorCountStock(): ?string
{
return $this->behaviorCountStock;
}


public function setBehaviorCountStock(string $behaviorCountStock): self
{
$this->behaviorCountStock = $behaviorCountStock;

return $this;
}

public function getBehaviorDisplaySale(): ?string
{
return $this->behaviorDisplaySale;
}

public function setBehaviorDisplaySale(string $behaviorDisplaySale): self
{
$this->behaviorDisplaySale = $behaviorDisplaySale;

return $this;
}
public function isPropertyNoveltyOnline(): ?bool
{
if ($this->getPropertyNoveltyExpirationDate()) {
$now = new \DateTime();
if ($now <= $this->getPropertyNoveltyExpirationDate()) {
return true;
}
}

return false;
}

public function getPropertyNoveltyExpirationDate(): ?\DateTimeInterface
{
return $this->propertyNoveltyExpirationDate;
}

public function setPropertyNoveltyExpirationDate(?\DateTimeInterface $propertyNoveltyExpirationDate): self
{
$this->propertyNoveltyExpirationDate = $propertyNoveltyExpirationDate;

return $this;
}

public function getPropertyOrganicLabel(): ?string
{
return $this->propertyOrganicLabel;
}

public function setPropertyOrganicLabel(?string $propertyOrganicLabel): self
{
$this->propertyOrganicLabel = $propertyOrganicLabel;

return $this;
}

public function getPropertyAllergens(): ?string
{
return $this->propertyAllergens;
}

public function setPropertyAllergens(?string $propertyAllergens): self
{
$this->propertyAllergens = $propertyAllergens;

return $this;
}

public function getPropertyComposition(): ?string
{
return $this->propertyComposition;
}

public function setPropertyComposition(?string $propertyComposition): self
{
$this->propertyComposition = $propertyComposition;

return $this;
}

public function getPropertyFragrances(): ?string
{
return $this->propertyFragrances;
}

public function setPropertyFragrances(?string $propertyFragrances): self
{
$this->propertyFragrances = $propertyFragrances;

return $this;
}

public function countProperties(): bool
{
$count = 0;

$count += (int)strlen($this->getPropertyOrganicLabel()) > 0;
$count += (int)strlen($this->getPropertyWeight()) > 0;
$count += (int)strlen($this->getPropertyFragrances()) > 0;
$count += (int)strlen($this->getPropertyComposition()) > 0;
$count += (int)strlen($this->getPropertyAllergens()) > 0;
$count += (int)strlen($this->getPropertyAlcoholLevel()) > 0;
$count += (int)strlen($this->getPropertyCharacteristics()) > 0;
$count += (int)strlen($this->getPropertyFeature()) > 0;
$count += (int)strlen($this->getPropertyPackaging()) > 0;
$count += (int)strlen($this->getPropertyQuantity()) > 0;
$count += (int)strlen($this->getPropertyVariety()) > 0;
$count += (int)($this->getPropertyExpirationDate() != null);

return $count;
}

public function getBehaviorExpirationDate(): ?string
{
return $this->behaviorExpirationDate;
}

public function setBehaviorExpirationDate(?string $behaviorExpirationDate): self
{
$this->behaviorExpirationDate = $behaviorExpirationDate;

return $this;
}

public function getTypeExpirationDate(): ?string
{
return $this->typeExpirationDate;
}

public function setTypeExpirationDate(?string $typeExpirationDate): self
{
$this->typeExpirationDate = $typeExpirationDate;

return $this;
}


public function getPropertyWeight(): ?string
{
return $this->propertyWeight;
}

public function setPropertyWeight(?string $propertyWeight): self
{
$this->propertyWeight = $propertyWeight;

return $this;
}


public function getPropertyQuantity(): ?string
{
return $this->propertyQuantity;
}

public function setPropertyQuantity(?string $propertyQuantity): self
{
$this->propertyQuantity = $propertyQuantity;

return $this;
}

public function getPropertyVariety(): ?string
{
return $this->propertyVariety;
}

public function setPropertyVariety(?string $propertyVariety): self
{
$this->propertyVariety = $propertyVariety;

return $this;
}

public function getPropertyFeature(): ?string
{
return $this->propertyFeature;
}

public function setPropertyFeature(?string $propertyFeature): self
{
$this->propertyFeature = $propertyFeature;

return $this;
}

public function getPropertyAlcoholLevel(): ?string
{
return $this->propertyAlcoholLevel;
}

public function setPropertyAlcoholLevel(?string $propertyAlcoholLevel): self
{
$this->propertyAlcoholLevel = $propertyAlcoholLevel;

return $this;
}


public function getPropertyPackaging(): ?string
{
return $this->propertyPackaging;
}

public function setPropertyPackaging(?string $propertyPackaging): self
{
$this->propertyPackaging = $propertyPackaging;

return $this;
}

public function getPropertyCharacteristics(): ?string
{
return $this->propertyCharacteristics;
}

public function setPropertyCharacteristics(?string $propertyCharacteristics): self
{
$this->propertyCharacteristics = $propertyCharacteristics;

return $this;
}

public function getBehaviorAddToCart(): ?string
{
return $this->behaviorAddToCart;
}

public function setBehaviorAddToCart(?string $behaviorAddToCart): self
{
$this->behaviorAddToCart = $behaviorAddToCart;

return $this;
}


public function getBehaviorPrice(): ?string
{
return $this->behaviorPrice;
}

public function getBehaviorPriceInherited()
{
return $this->getBehaviorPrice() ;
}

public function setBehaviorPrice(?string $behaviorPrice): self
{
$this->behaviorPrice = $behaviorPrice;

return $this;
}


public function hasProductsWithVariousWeight()
{
if ($this->getActiveProducts()) {
$arrayCountProducts = [];
$products = $this->getProductsOnline();

foreach ($products as $product) {
$titleProduct = $product->getTitleInherited();
if (!isset($arrayCountProducts[$titleProduct])) {
$arrayCountProducts[$titleProduct] = [];
}

if (!in_array($product->getQuantityLabelInherited(), $arrayCountProducts[$titleProduct])) {
$arrayCountProducts[$titleProduct][] = $product->getQuantityLabelInherited();
}

if (count($arrayCountProducts[$titleProduct]) > 1) {
return true;
}
}
}

return false;
}

public function getProductsGroupByTitle()
{
$arrayProductsGroupByTitle = [];
$products = $this->getProductsOnline();

foreach ($products as $product) {
if($product->getStatus() == 1) {
$titleProduct = $product->getTitleInherited();
if (!isset($arrayProductsGroupByTitle[$titleProduct])) {
$arrayProductsGroupByTitle[$titleProduct] = [];
}
$arrayProductsGroupByTitle[$titleProduct][] = $product;
}
}

return $arrayProductsGroupByTitle;
}

public function getOriginProduct()
{
$products = $this->getProducts() ;

foreach($products as $product) {
if($product->getOriginProduct()) {
return $product ;
}
}
}

public function getOriginProductOnline()
{
$originProduct = $this->getOriginProduct() ;

if($originProduct->getStatus()==1){
return $originProduct;
}else{
return false;
}
}

public function hasOneProductOnline()
{
if( ($this->getActiveProducts() && count($this->getProductsOnline()) > 0)
|| (!$this->getActiveProducts() && $this->getOriginProduct())){
return true ;
}

return false ;
}

public function getSaleStatus(): ?bool
{
return $this->saleStatus;
}

public function setSaleStatus(bool $saleStatus): self
{
$this->saleStatus = $saleStatus;

return $this;
}

/**
* @return Collection|Section[]
*/
public function getSections(): Collection
{
return $this->sections;
}

public function addSection(Section $section): self
{
if (!$this->sections->contains($section)) {
$this->sections[] = $section;
}

return $this;
}

public function removeSection(Section $section): self
{
if ($this->sections->contains($section)) {
$this->sections->removeElement($section);
}

return $this;
}

public function getFieldBuyingPrice()
{
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) {
return 'buyingPrice' ;
}
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) {
return 'buyingPriceByRefUnit' ;
}
}

public function getFieldPrice()
{
if($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_PIECE) {
return 'price' ;
}
elseif($this->getBehaviorPrice() === self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) {
return 'priceByRefUnit' ;
}
}
}

+ 8
- 0
Model/Product/ProductFamilyInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductFamilyInterface
{

}

+ 8
- 0
Model/Product/ProductInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductInterface
{

}

+ 228
- 0
Model/Reduction/ReductionCart.php View File

@@ -0,0 +1,228 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\OrderAmountMinInterface;
use Lc\ShopBundle\Context\ReductionCartPropertyInterface;
use Lc\ShopBundle\Context\ReductionInterface;
use Lc\ShopBundle\Context\ReductionPropertyInterface;
use Lc\ShopBundle\Context\StatusInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCart extends AbstractEntity implements ReductionPropertyInterface, ReductionInterface, ReductionCartPropertyInterface, FilterMerchantInterface, OrderAmountMinInterface, StatusInterface
{

const APPLIED_TO_DELIVERY = 'delivery';
const APPLIED_TO_ORDER_PRODUCTS = 'order-products';


use StatusTrait;
use OrderAmountMin;
use ReductionTrait;
use ReductionCartPropertyTrait;
use ReductionPropertyTrait {
ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
}
/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $codes = [];

/**
* @ORM\Column(type="integer")
*/
protected $availableQuantity;

/**
* @ORM\Column(type="integer")
*/
protected $availableQuantityPerUser;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\PointSaleInterface")
*/
protected $pointSales;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCartInterface")
*/
protected $uncombinables;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $uncombinableTypes = [];

/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $availableQuantityPerCode;
public function __toString()
{
return $this->title;
}

public function __construct()
{
$this->__reductionPropertyConstruct();
$this->pointSales = new ArrayCollection();
$this->uncombinables = new ArrayCollection();
}


public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}


public function getCodes(): ?array
{
return $this->codes;
}

public function setCodes(?array $codes): self
{
$this->codes = $codes;

return $this;
}

/**
* @return Collection|PointSale[]
*/
public function getPointSales(): Collection
{
return $this->pointSales;
}

public function addPointSale(PointSale $pointSale): self
{
if (!$this->pointSales->contains($pointSale)) {
$this->pointSales[] = $pointSale;
}

return $this;
}

public function removePointSale(PointSale $pointSale): self
{
if ($this->pointSales->contains($pointSale)) {
$this->pointSales->removeElement($pointSale);
}

return $this;
}

public function getAvailableQuantity(): ?int
{
return $this->availableQuantity;
}

public function setAvailableQuantity(int $availableQuantity): self
{
$this->availableQuantity = $availableQuantity;

return $this;
}

public function getAvailableQuantityPerUser(): ?int
{
return $this->availableQuantityPerUser;
}

public function setAvailableQuantityPerUser(int $availableQuantityPerUser): self
{
$this->availableQuantityPerUser = $availableQuantityPerUser;

return $this;
}

/**
* @return Collection|self[]
*/
public function getUncombinables(): Collection
{
return $this->uncombinables;
}

public function addUncombinable(self $uncombinable): self
{
if (!$this->uncombinables->contains($uncombinable)) {
$this->uncombinables[] = $uncombinable;
}

return $this;
}

public function removeUncombinables(self $uncombinable): self
{
if ($this->uncombinables->contains($uncombinable)) {
$this->uncombinables->removeElement($uncombinable);
}

return $this;
}


public function getUncombinableTypes(): ?array
{
return $this->uncombinableTypes;
}

public function setUncombinableTypes(?array $uncombinableTypes): self
{
$this->uncombinableTypes = $uncombinableTypes;

return $this;
}

public function getAvailableQuantityPerCode(): ?int
{
return $this->availableQuantityPerCode;
}

public function setAvailableQuantityPerCode(int $availableQuantityPerCode): self
{
$this->availableQuantityPerCode = $availableQuantityPerCode;

return $this;
}

}

+ 11
- 0
Model/Reduction/ReductionCartInterface.php View File

@@ -0,0 +1,11 @@
<?php

namespace Lc\ShopBundle\Context;

use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Model\PointSale;

interface ReductionCartInterface
{

}

+ 152
- 0
Model/Reduction/ReductionCatalog.php View File

@@ -0,0 +1,152 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\ReductionInterface;
use Lc\ShopBundle\Context\ReductionPropertyInterface;
use Lc\ShopBundle\Context\StatusInterface;
use phpDocumentor\Reflection\Types\Integer;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCatalog extends AbstractEntity implements ReductionCatalogInterface, ReductionPropertyInterface, FilterMerchantInterface, StatusInterface
{
use StatusTrait;
use ReductionTrait;
use ReductionPropertyTrait{
ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
}

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
*/
protected $productFamilies;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
*/
protected $productFamily;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface")
*/
protected $productCategories;


public function __construct()
{
$this->__reductionPropertyConstruct();
$this->productFamilies = new ArrayCollection();
$this->productCategories = new ArrayCollection();
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}


public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}


/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
}

return $this;
}


public function getProductFamily(): ?ProductFamily
{
return $this->productFamily;
}

public function setProductFamily(?ProductFamily $productFamily): self
{
$this->productFamily = $productFamily;

return $this;
}


/**
* @return Collection|ProductCategory[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
}

return $this;
}

}

+ 7
- 0
Model/Reduction/ReductionCatalogInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface ReductionCatalogInterface
{
}

+ 158
- 0
Model/Reduction/ReductionCredit.php View File

@@ -0,0 +1,158 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\ReductionInterface;
use Lc\ShopBundle\Context\ReductionPropertyInterface;
use Lc\ShopBundle\Context\StatusInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCredit extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, StatusInterface
{
const TYPE_CREDIT = 'credit';
const TYPE_GIFT = 'gift';


use ReductionTrait;
use StatusTrait;


/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="reductionCredits")
*/
protected $users;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=255)
*/
protected $type;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $sended;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
*/
protected $owner;

public function __construct()
{
$this->users = new ArrayCollection();
$this->unit = 'amount';
}

public function __toString()
{
return $this->title;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}


public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}


public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

return $this;
}

public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
}

return $this;
}


public function getSended(): ?bool
{
return $this->sended;
}

public function setSended(?bool $sended): self
{
$this->sended = $sended;

return $this;
}


public function getOwner(): ?User
{
return $this->owner;
}

public function setOwner(?User $owner): self
{
$this->owner = $owner;

return $this;
}
}

+ 7
- 0
Model/Reduction/ReductionCreditInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface ReductionCreditInterface
{
}

+ 193
- 0
Model/Reminder/Reminder.php View File

@@ -0,0 +1,193 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Reminder extends AbstractEntity implements FilterMerchantInterface
{
public $relatedPage;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $entityName;

/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $entityId;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $entityAction;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface")
*/
protected $users;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $dateReminder;


/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $done;


public function __construct()
{
$this->users = new ArrayCollection();
$this->done = false;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): self
{
$this->description = $description;

return $this;
}

public function getEntityName(): ?string
{
return $this->entityName;
}

public function setEntityName(?string $entityName): self
{
$this->entityName = $entityName;

return $this;
}

public function getEntityAction(): ?string
{
return $this->entityAction;
}

public function setEntityAction(?string $entityAction): self
{
$this->entityAction = $entityAction;

return $this;
}

public function getEntityId(): ?int
{
return $this->entityId;
}

public function setEntityId(?int $entityId): self
{
$this->entityId = $entityId;

return $this;
}

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

return $this;
}

public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
}

return $this;
}

public function getDateReminder(): ?\DateTimeInterface
{
return $this->dateReminder;
}

public function setDateReminder(?\DateTimeInterface $dateReminder): self
{
$this->dateReminder = $dateReminder;

return $this;
}

public function getDone(): ?bool
{
return $this->done;
}

public function setDone(?bool $done): self
{
$this->done = $done;

return $this;
}

}

+ 7
- 0
Model/Reminder/ReminderInterface.php View File

@@ -0,0 +1,7 @@
<?php

namespace Lc\ShopBundle\Context;

interface ReminderInterface
{
}

+ 172
- 0
Model/Section/Section.php View File

@@ -0,0 +1,172 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Section extends AbstractDocumentEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=32)
*/
protected $cycle;

const SECTION_CYCLE_DAY = 'day' ;
const SECTION_CYCLE_WEEK = 'week' ;
const SECTION_CYCLE_MONTH = 'month' ;
const SECTION_CYCLE_YEAR = 'year' ;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="sections")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="section")
*/
protected $orderShops;


/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="section")
*/
protected $productCategories;

public function __construct()
{
$this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection();
}

public function __toString()
{
return $this->getTitle();
}

public function getMerchant(): ?Hub
{
return $this->merchant;
}

public function setMerchant(?Hub $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getCycle(): ?string
{
return $this->cycle;
}

public function setCycle(string $cycle): self
{
$this->cycle = $cycle;

return $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->addSection($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
$productFamily->removeSection($this);
}

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrderShops(): Collection
{
return $this->orderShops;
}

public function addOrderShop(OrderShop $orderShop): self
{
if (!$this->orderShops->contains($orderShop)) {
$this->orderShops[] = $orderShop;
$orderShop->setSection($this);
}

return $this;
}

public function removeOrderShop(OrderShop $orderShop): self
{
if ($this->orderShops->contains($orderShop)) {
$this->orderShops->removeElement($orderShop);
// set the owning side to null (unless already changed)
if ($orderShop->getSection() === $this) {
$orderShop->setSection(null);
}
}

return $this;
}

/**
* @return Collection|ProductCategory[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
$productCategory->setSection($this);
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getSection() === $this) {
$productCategory->setSection(null);
}
}

return $this;
}
}

+ 8
- 0
Model/Section/SectionInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface SectionInterface
{

}

+ 68
- 0
Model/Site/News.php View File

@@ -0,0 +1,68 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Model\AbstractDocumentEntity;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class News extends AbstractDocumentEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="news")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $date;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isSent;

public function getDate(): ?\DateTimeInterface
{
return $this->date;
}

public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;

return $this;
}

public function getMerchant(): ?Hub
{
return $this->merchant;
}

public function setMerchant(?Hub $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getIsSent(): ?bool
{
return $this->isSent;
}

public function setIsSent(?bool $isSent): self
{
$this->isSent = $isSent;

return $this;
}
}

+ 8
- 0
Model/Site/NewsInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface NewsInterface
{

}

+ 53
- 0
Model/Site/Page.php View File

@@ -0,0 +1,53 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Hub;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Page extends AbstractDocumentEntity implements FilterMerchantInterface
{
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $content;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

public function __toString()
{
return $this->getTitle() ;
}

public function getContent(): ?string
{
return $this->content;
}

public function setContent(?string $content): self
{
$this->content = $content;

return $this;
}

public function getMerchant(): ?Hub
{
return $this->merchant;
}

public function setMerchant(?Hub $merchant): self
{
$this->merchant = $merchant;

return $this;
}
}

+ 8
- 0
Model/Site/PageInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PageInterface
{

}

+ 300
- 0
Model/Ticket/Ticket.php View File

@@ -0,0 +1,300 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\TicketMessage;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\ShopBundle\Context\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Ticket extends AbstractEntity implements FilterMerchantInterface
{
const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable' ;
const TYPE_PRODUCT_ERROR = 'product-error' ;
const TYPE_TECHNICAL_PROBLEM = 'technical-problem' ;
const TYPE_GENERAL_QUESTION = 'general-question' ;
const TYPE_POULTRY_BOOKING = 'poultry-booking' ;
const TYPE_MESSAGE_FROM_PDL = 'message-from-pdl' ;


const TICKET_STATUS_OPEN = 'open' ;
const TICKET_STATUS_BEING_PROCESSED = 'being-processed' ;
const TICKET_STATUS_CLOSED = 'closed' ;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=32)
*/
protected $type;

/**
* @ORM\Column(type="string", length=32)
*/
protected $status;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="tickets")
*/
protected $orderShop;

/**
* @ORM\Column(type="string", length=255)
*/
protected $subject;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $tags = [];

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorFirstname;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorLastname;

/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
protected $visitorEmail;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $visitorToken;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
* @ORM\OrderBy({"id" = "ASC"})
*/
protected $ticketMessages;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="tickets")
*/
protected $user;

public function __construct()
{
$this->ticketMessages = new ArrayCollection();
}

public function getUsername(){
if($this->getUser()){
return $this->getUser()->getName();
}else{
return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname();
}
}

public function getVisitorInfos(){

return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname(). ' ('.$this->getVisitorEmail().')';

}

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getTypeLabel(): string
{
return 'field.Ticket.typeOptions.'.$this->getType() ;
}

public function getStatus(): ?string
{
return $this->status;
}

public function setStatus(string $status): self
{
$this->status = $status;

return $this;
}

public function getStatusLabel(): string
{
return 'field.Ticket.statusOptions.'.$this->getStatus() ;
}

public function getOrderShop(): ?OrderShopInterface
{
return $this->orderShop;
}

public function setOrderShop(?OrderShopInterface $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getSubject(): ?string
{
return $this->subject;
}

public function setSubject(string $subject): self
{
$this->subject = $subject;

return $this;
}

public function getTags(): ?array
{
return $this->tags;
}

public function setTags(?array $tags): self
{
$this->tags = $tags;

return $this;
}

public function getVisitorFirstname(): ?string
{
return $this->visitorFirstname;
}

public function setVisitorFirstname(?string $visitorFirstname): self
{
$this->visitorFirstname = $visitorFirstname;

return $this;
}

public function getVisitorLastname(): ?string
{
return $this->visitorLastname;
}

public function setVisitorLastname(?string $visitorLastname): self
{
$this->visitorLastname = $visitorLastname;

return $this;
}

public function getVisitorEmail(): ?string
{
return $this->visitorEmail;
}

public function setVisitorEmail(?string $visitorEmail): self
{
$this->visitorEmail = $visitorEmail;

return $this;
}

public function getVisitorToken(): ?string
{
return $this->visitorToken;
}

public function setVisitorToken(?string $visitorToken): self
{
$this->visitorToken = $visitorToken;

return $this;
}

/**
* @return Collection|TicketMessage[]
*/
public function getTicketMessages(): Collection
{
return $this->ticketMessages;
}

public function addTicketMessage(TicketMessage $ticketMessage): self
{
if (!$this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages[] = $ticketMessage;
$ticketMessage->setTicket($this);
}

return $this;
}

public function removeTicketMessage(TicketMessage $ticketMessage): self
{
if ($this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages->removeElement($ticketMessage);
// set the owning side to null (unless already changed)
if ($ticketMessage->getTicket() === $this) {
$ticketMessage->setTicket(null);
}
}

return $this;
}

public function getUser(): ?UserInterface
{
return $this->user;
}

public function setUser(?UserInterface $user): self
{
$this->user = $user;

return $this;
}
}

+ 8
- 0
Model/Ticket/TicketInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface TicketInterface
{

}

+ 104
- 0
Model/Ticket/TicketMessage.php View File

@@ -0,0 +1,104 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Ticket;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\TicketInterface;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketMessage extends AbstractEntity
{
use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\Column(type="text")
*/
protected $message;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TicketInterface", inversedBy="ticketMessages")
* @ORM\JoinColumn(nullable=false)
*/
protected $ticket;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $answerByAdmin;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $imageFilename;

public function __toString()
{
return $this->message;
}

public function getMessage(): ?string
{
return $this->message;
}

public function setMessage(string $message): self
{
$this->message = $message;

return $this;
}

public function getTicket(): ?TicketInterface
{
return $this->ticket;
}

public function setTicket(?TicketInterface $ticket): self
{
$this->ticket = $ticket;

return $this;
}

public function getAnswerByAdmin(): ?bool
{
return $this->answerByAdmin;
}

public function setAnswerByAdmin(?bool $answerByAdmin): self
{
$this->answerByAdmin = $answerByAdmin;

return $this;
}

public function getImageFilename(): ?string
{
return $this->imageFilename;
}

public function setImageFilename(?string $imageFilename): self
{
$this->imageFilename = $imageFilename;

return $this;
}
}

+ 8
- 0
Model/Ticket/TicketMessageInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface TicketMessageInterface
{

}

+ 79
- 0
Model/User/GroupUser.php View File

@@ -0,0 +1,79 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Lc\ShopBundle\Context\FilterMerchantInterface;


/**
* @ORM\MappedSuperclass()
*/
abstract class GroupUser extends AbstractDocumentEntity implements FilterMerchantInterface
{

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="groupUsers")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", mappedBy="groupUsers")
*/
protected $users;


public function __toString()
{
return $this->getTitle();
}


public function __construct()
{
$this->users = new ArrayCollection();
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

return $this;
}

public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
}

return $this;
}


}

+ 8
- 0
Model/User/GroupUserInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface GroupUserInterface
{

}

+ 490
- 0
Model/User/User.php View File

@@ -0,0 +1,490 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Newsletter;
use App\Entity\Ticket;
use App\Entity\UserPointSale;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Model\User\User as SovUserModel;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\TicketInterface;

/**
* @ORM\MappedSuperclass()
*
*/
abstract class User extends SovUserModel
{
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $phone;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $behaviorDisplayPrice;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
*/
protected $merchant;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\AddressInterface", mappedBy="user", cascade={"persist"})
*/
protected $addresses;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="user")
*/
protected $orders;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $gender;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\NewsletterInterface", inversedBy="users")
*/
protected $newsletters;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\GroupUserInterface", inversedBy="users")
*/
protected $groupUsers;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
*/
protected $favoriteProductFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\UserPointSaleInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userPointSales;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\UserMerchantInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userMerchants;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="user")
*/
protected $tickets;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $ticketTypesNotification = [];


/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCreditInterface", mappedBy="users")
*/
protected $reductionCredits;


public function __construct()
{
parent::__construct();
$this->addresses = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->groupUsers = new ArrayCollection();
$this->newsletters = new ArrayCollection();
$this->favoriteProductFamilies = new ArrayCollection();
$this->userPointSales = new ArrayCollection();
$this->userMerchants = new ArrayCollection();
$this->reductionCredits = new ArrayCollection();
$this->tickets = new ArrayCollection();
}

public function __toString()
{
return $this->getSummary();
}

public function getSummary()
{
return '#'.$this->getId().' '.strtoupper($this->getLastname()).' '.$this->getFirstname(). ' ('.$this->getEmail().')';
}

public function getName()
{
return (string) ucfirst(strtolower($this->getFirstname())). ' '.strtoupper($this->getLastname());
}

public function setEmail($email)
{
$this->setUsername($email);
return parent::setEmail($email);
}

public function getPhone(): ?string
{
return $this->phone;
}

public function setPhone(?string $phone): self
{
$this->phone = $phone;

return $this;
}

public function getBehaviorDisplayPrice(): ?string
{
return $this->behaviorDisplayPrice;
}

public function setBehaviorDisplayPrice(?string $behaviorDisplayPrice): self
{
$this->behaviorDisplayPrice = $behaviorDisplayPrice;

return $this;
}

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|Address[]
*/
public function getAddresses($status = null): Collection
{
if($status){
$addressToReturn = new ArrayCollection();
foreach ($this->addresses as $address){
if($address->getStatus() == $status) {
$addressToReturn[] = $address;
}
}
return $addressToReturn;
}else{
return $this->addresses;
}

}

public function addAddress(Address $address): self
{
if (!$this->addresses->contains($address)) {
$this->addresses[] = $address;
$address->setUser($this);
}

return $this;
}

public function removeAddress(Address $address): self
{
if ($this->addresses->contains($address)) {
$this->addresses->removeElement($address);
// set the owning side to null (unless already changed)
if ($address->getUser() === $this) {
$address->setUser(null);
}
}

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrders(): Collection
{
return $this->orders;
}

public function addOrder(OrderShop $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setUser($this);
}

return $this;
}

public function removeOrder(OrderShop $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getUser() === $this) {
$order->setUser(null);
}
}

return $this;
}

public function getFirstname(): ?string
{
return $this->firstname;
}

public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;

return $this;
}

public function getLastname(): ?string
{
return $this->lastname;
}

public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;

return $this;
}

public function getGender(): ?bool
{
return $this->gender;
}

public function setGender(?bool $gender): self
{
$this->gender = $gender;

return $this;
}

/**
* @return Collection|Newsletter[]
*/
public function getNewsletters(): Collection
{
return $this->newsletters;
}

public function addNewsletter(Newsletter $newsletter): self
{
if (!$this->newsletters->contains($newsletter)) {
$this->newsletters[] = $newsletter;
}

return $this;
}

public function removeNewsletter(Newsletter $newsletter): self
{
if ($this->newsletters->contains($newsletter)) {
$this->newsletters->removeElement($newsletter);
}

return $this;
}

/**
* @return Collection|GroupUser[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}

public function addGroupUser(GroupUser $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->addUser($this);
}

return $this;
}

public function removeGroupUser(GroupUser $groupUser): self
{
if ($this->groupUsers->contains($groupUser)) {
$this->groupUsers->removeElement($groupUser);
$groupUser->removeUser($this);
}

return $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getFavoriteProductFamilies(): Collection
{
return $this->favoriteProductFamilies;
}

public function addFavoriteProductFamily(ProductFamily $favoriteProductFamily): self
{
if (!$this->favoriteProductFamilies->contains($favoriteProductFamily)) {
$this->favoriteProductFamilies[] = $favoriteProductFamily;
}

return $this;
}

public function removeFavoriteProductFamily(ProductFamily $favoriteProductFamily): self
{
if ($this->favoriteProductFamilies->contains($favoriteProductFamily)) {
$this->favoriteProductFamilies->removeElement($favoriteProductFamily);
}

return $this;
}

/**
* @return Collection|UserPointSale[]
*/
public function getUserPointSales(): Collection
{
return $this->userPointSales;
}

public function addUserPointSale(UserPointSale $userPointSale): self
{
if (!$this->userPointSales->contains($userPointSale)) {
$this->userPointSales[] = $userPointSale;
$userPointSale->setUser($this);
}

return $this;
}

public function removeUserPointSale(UserPointSale $userPointSale): self
{
if ($this->userPointSales->contains($userPointSale)) {
$this->userPointSales->removeElement($userPointSale);
// set the owning side to null (unless already changed)
if ($userPointSale->getUser() === $this) {
$userPointSale->setUser(null);
}
}

return $this;
}

/**
* @return Collection|TicketInterface[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}

public function addTicket(TicketInterface $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setUser($this);
}

return $this;
}

public function removeTicket(TicketInterface $ticket): self
{
if ($this->tickets->contains($ticket)) {
$this->tickets->removeElement($ticket);
// set the owning side to null (unless already changed)
if ($ticket->getUser() === $this) {
$ticket->setUser(null);
}
}

return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}

public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;

return $this;
}

public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}

public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;

return $this;
}


public function getTicketTypesNotification(): ?array
{
return $this->ticketTypesNotification;
}

public function setTicketTypesNotification(?array $ticketTypesNotification): self
{
$this->ticketTypesNotification = $ticketTypesNotification;

return $this;
}

/**
* @return Collection|ReductionCredit[]
*/
public function getReductionCredits(): Collection
{
return $this->reductionCredits;
}

public function addReductionCredit(ReductionCredit $reductionCredit): self
{
if (!$this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits[] = $reductionCredit;
$reductionCredit->addUser($this);
}

return $this;
}

public function removeReductionCredit(ReductionCredit $reductionCredit): self
{
if ($this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits->removeElement($reductionCredit);
$reductionCredit->removeUser($this);
}

return $this;
}

}

+ 8
- 0
Model/User/UserInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface UserInterface
{

}

+ 150
- 0
Model/User/UserMerchant.php View File

@@ -0,0 +1,150 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\CreditHistory;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\CreditHistoryInterface;
use Lc\ShopBundle\Context\FilterMerchantInterface;

/**
* @ORM\MappedSuperclass()
*
*/
abstract class UserMerchant implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="userMerchants")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $credit;

/**
* @ORM\Column(type="boolean")
*/
protected $creditActive;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="userMerchant", orphanRemoval=true)
*/
protected $creditHistories;

/**
* @ORM\Column(type="boolean")
*/
protected $active;

public function __construct()
{
$this->creditHistories = new ArrayCollection();
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getCredit(): ?float
{
return $this->credit;
}

public function setCredit(?float $credit): self
{
$this->credit = $credit;

return $this;
}

public function getCreditActive(): ?bool
{
return $this->creditActive;
}

public function isCreditActive(): bool
{
return $this->creditActive;
}

public function setCreditActive(bool $creditActive): self
{
$this->creditActive = $creditActive;

return $this;
}

/**
* @return Collection|CreditHistory[]
*/
public function getCreditHistories(): Collection
{
return $this->creditHistories;
}

public function addCreditHistory(CreditHistoryInterface $creditHistory): self
{
if (!$this->creditHistories->contains($creditHistory)) {
$this->creditHistories[] = $creditHistory;
$creditHistory->setUserMerchant($this);
}

return $this;
}

public function removeCreditHistory(CreditHistoryInterface $creditHistory): self
{
if ($this->creditHistories->contains($creditHistory)) {
$this->creditHistories->removeElement($creditHistory);
// set the owning side to null (unless already changed)
if ($creditHistory->getUserMerchant() === $this) {
$creditHistory->setUserMerchant(null);
}
}

return $this;
}

public function getActive(): ?bool
{
return $this->active;
}

public function setActive(bool $active): self
{
$this->active = $active;

return $this;
}
}

+ 8
- 0
Model/User/UserMerchantInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface UserMerchantInterface
{

}

+ 64
- 0
Model/User/UserPointSale.php View File

@@ -0,0 +1,64 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass
*/
abstract class UserPointSale
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="userPointSales")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", inversedBy="userPointSales")
* @ORM\JoinColumn(nullable=false)
*/
protected $pointSale;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getPointSale(): ?PointSale
{
return $this->pointSale;
}

public function setPointSale(?PointSale $pointSale): self
{
$this->pointSale = $pointSale;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}
}

+ 8
- 0
Model/User/UserPointSaleInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface UserPointSaleInterface
{

}

+ 8
- 0
Model/User/UserUtilsInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface UserUtilsInterface
{

}

+ 131
- 0
Model/User/Visitor.php View File

@@ -0,0 +1,131 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\OrderShop;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class Visitor
{
/**
* @ORM\Column(type="string", length=255)
*/
protected $cookie;

/**
* @ORM\Column(type="datetime")
*/
protected $lastAccess;

/**
* @ORM\Column(type="string", length=255)
*/
protected $ip;

/**
* @ORM\Column(type="integer")
*/
protected $totalVisit;

/**
* @ORM\OneToMany(targetEntity="App\Entity\OrderShop", mappedBy="visitor")
*/
protected $orders;

public function __construct()
{
$this->orders = new ArrayCollection();
}

public function __toString()
{
return $this->getLastAccess()->format('d-m-y h:i') .'( visites :'.$this->totalVisit.')';
}
public function getSummary(){
return 'Visiteur non inscrit ( visites :'.$this->totalVisit.')';
}

public function getCookie(): ?string
{
return $this->cookie;
}

public function setCookie(?string $cookie): self
{
$this->cookie = $cookie;

return $this;
}

public function getLastAccess(): ?\DateTimeInterface
{
return $this->lastAccess;
}

public function setLastAccess(\DateTimeInterface $lastAccess): self
{
$this->lastAccess = $lastAccess;

return $this;
}

public function getIp(): ?string
{
return $this->ip;
}

public function setIp(?string $ip): self
{
$this->ip = $ip;

return $this;
}

public function getTotalVisit(): ?int
{
return $this->totalVisit;
}

public function setTotalVisit(int $totalVisit): self
{
$this->totalVisit = $totalVisit;

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrders(): Collection
{
return $this->orders;
}

public function addOrder(OrderShop $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setVisitor($this);
}

return $this;
}

public function removeOrder(OrderShop $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getVisitor() === $this) {
$order->setVisitor(null);
}
}

return $this;
}
}

+ 8
- 0
Model/User/VisitorInterface.php View File

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface VisitorInterface
{

}

Loading…
Cancel
Save