瀏覽代碼

Refactoring modèles

feature/ticket
Guillaume 3 年之前
父節點
當前提交
bd95cb4a60
共有 50 個檔案被更改,包括 6312 行新增6247 行删除
  1. +0
    -26
      Doctrine/Extension/OrderAmountMin.php
  2. +26
    -0
      Doctrine/Extension/OrderAmountMinTrait.php
  3. +7
    -0
      Doctrine/Extension/OrderPayoffInterface.php
  4. +37
    -38
      Doctrine/Extension/OrderPayoffTrait.php
  5. +65
    -68
      Doctrine/Extension/PayoffTrait.php
  6. +94
    -94
      Doctrine/Extension/PriceTrait.php
  7. +118
    -119
      Doctrine/Extension/ProductPropertyTrait.php
  8. +39
    -39
      Doctrine/Extension/ReductionCartPropertyTrait.php
  9. +119
    -117
      Doctrine/Extension/ReductionPropertyTrait.php
  10. +300
    -295
      Model/Address/AddressModel.php
  11. +32
    -31
      Model/Common/TaxRateModel.php
  12. +109
    -109
      Model/Common/UnitModel.php
  13. +89
    -89
      Model/Credit/CreditConfigModel.php
  14. +177
    -168
      Model/Credit/CreditHistoryModel.php
  15. +261
    -256
      Model/File/DocumentModel.php
  16. +9
    -8
      Model/Merchant/MerchantConfigModel.php
  17. +383
    -374
      Model/Merchant/MerchantModel.php
  18. +72
    -72
      Model/Newsletter/NewsletterModel.php
  19. +5
    -6
      Model/Order/OrderPaymentModel.php
  20. +0
    -7
      Model/Order/OrderPayoffInterface.php
  21. +162
    -162
      Model/Order/OrderProductModel.php
  22. +16
    -16
      Model/Order/OrderProductReductionCatalogModel.php
  23. +73
    -73
      Model/Order/OrderProductRefundModel.php
  24. +65
    -62
      Model/Order/OrderReductionCartModel.php
  25. +62
    -60
      Model/Order/OrderReductionCreditModel.php
  26. +40
    -39
      Model/Order/OrderRefundModel.php
  27. +528
    -514
      Model/Order/OrderShopModel.php
  28. +0
    -8
      Model/Order/OrderShopPriceUtilsInterface.php
  29. +75
    -71
      Model/Order/OrderStatusHistoryModel.php
  30. +121
    -121
      Model/Order/OrderStatusModel.php
  31. +70
    -69
      Model/PointSale/PointSaleDayInfoModel.php
  32. +161
    -156
      Model/PointSale/PointSaleModel.php
  33. +161
    -156
      Model/Product/ProductCategoryModel.php
  34. +735
    -750
      Model/Product/ProductFamilyModel.php
  35. +207
    -206
      Model/Product/ProductModel.php
  36. +190
    -177
      Model/Reduction/ReductionCartModel.php
  37. +124
    -118
      Model/Reduction/ReductionCatalogModel.php
  38. +111
    -106
      Model/Reduction/ReductionCreditModel.php
  39. +164
    -161
      Model/Reminder/ReminderModel.php
  40. +149
    -145
      Model/Section/SectionModel.php
  41. +44
    -44
      Model/Site/NewsModel.php
  42. +42
    -41
      Model/Site/PageModel.php
  43. +93
    -91
      Model/Ticket/TicketMessageModel.php
  44. +274
    -274
      Model/Ticket/TicketModel.php
  45. +51
    -48
      Model/User/GroupUserModel.php
  46. +0
    -8
      Model/User/UserInterface.php
  47. +126
    -126
      Model/User/UserMerchantModel.php
  48. +405
    -412
      Model/User/UserModel.php
  49. +6
    -4
      Model/User/UserPointSaleModel.php
  50. +115
    -113
      Model/User/VisitorModel.php

+ 0
- 26
Doctrine/Extension/OrderAmountMin.php 查看文件

@@ -1,26 +0,0 @@
<?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;
}

}

+ 26
- 0
Doctrine/Extension/OrderAmountMinTrait.php 查看文件

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

namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;

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

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

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

return $this;
}

}

+ 7
- 0
Doctrine/Extension/OrderPayoffInterface.php 查看文件

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

namespace Lc\CaracoleBundle\Doctrine\Extension;

interface OrderPayoffInterface
{
}

+ 37
- 38
Doctrine/Extension/OrderPayoffTrait.php 查看文件

@@ -3,8 +3,7 @@
namespace Lc\CaracoleBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\ReductionInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;

/**
* @ORM\MappedSuperclass()
@@ -12,50 +11,50 @@ use Lc\ShopBundle\Context\ReductionInterface;
trait OrderPayoffTrait
{

use PayoffTrait;
use PayoffTrait;

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

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

public function __toString()
{
return $this->amount. ' le '.$this->getPaidAt()->format('d-m-y').' par '.$this->getMeanPayment();
}
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 getOrderShop(): ?OrderShopInterface
{
return $this->orderShop;
}

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

return $this;
}
return $this;
}

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

return $this;
}
return $this;
}

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

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

+ 65
- 68
Doctrine/Extension/PayoffTrait.php 查看文件

@@ -3,8 +3,6 @@
namespace Lc\CaracoleBundle\Doctrine\Extension;

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

/**
* @ORM\MappedSuperclass()
@@ -12,93 +10,92 @@ use Lc\ShopBundle\Context\ReductionInterface;
trait PayoffTrait
{

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return $this;
}
return $this;
}


}

+ 94
- 94
Doctrine/Extension/PriceTrait.php 查看文件

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

namespace Lc\CaracoleBundle\Doctrine\Extension ;
namespace Lc\CaracoleBundle\Doctrine\Extension;

use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\UnitInterface;
use Lc\CaracoleBundle\Model\Common\TaxRateInterface;
use Lc\CaracoleBundle\Model\Common\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;
}
/**
* @ORM\Column(type="float", nullable=true)
*/
protected $price;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Common\UnitInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $unit;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Common\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(): ?UnitInterface
{
return $this->getUnit();
}
public function getTaxRateInherited(): ?TaxRateInterface
{
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(): ?UnitInterface
{
return $this->unit;
}
public function setUnit(?UnitInterface $unit): self
{
$this->unit = $unit;
return $this;
}
public function getTaxRate(): ?TaxRateInterface
{
return $this->taxRate;
}
public function setTaxRate(?TaxRateInterface $taxRate): self
{
$this->taxRate = $taxRate;
return $this;
}
}

+ 118
- 119
Doctrine/Extension/ProductPropertyTrait.php 查看文件

@@ -4,128 +4,127 @@ 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;
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;
}
return $this;
}

}

+ 39
- 39
Doctrine/Extension/ReductionCartPropertyTrait.php 查看文件

@@ -7,57 +7,57 @@ use Doctrine\ORM\Mapping as ORM;
trait ReductionCartPropertyTrait
{

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

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

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


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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}


}

+ 119
- 117
Doctrine/Extension/ReductionPropertyTrait.php 查看文件

@@ -5,149 +5,151 @@ namespace Lc\CaracoleBundle\Doctrine\Extension;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Model\User\UserInterface;

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;
/**
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface")
*/
protected $users;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\GroupUserInterface")
*/
protected $groupUsers;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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(): ?MerchantInterface
{
return $this->merchant;
}

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

return $this;
}

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

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

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

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

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

return $this;
}

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

/**
* @return Collection|GroupUser[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
public function addGroupUser(GroupUserInterface $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
}

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

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

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

return $this;
}
return $this;
}


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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

}

+ 300
- 295
Model/Address/AddressModel.php 查看文件

@@ -3,377 +3,382 @@
namespace Lc\CaracoleBundle\Model\Address;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

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

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $pointSale;

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

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

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

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

/**
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\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;

public function __toString()
{
return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}
/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $firstname;

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

public function getSummaryShort()
{
return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}
/**
* @ORM\Column(type="string", length=31)
*/
protected $zip;

public function getSummary($withTitle = true)
{
$html = '';
/**
* @ORM\Column(type="string", length=255)
*/
protected $city;

if ($this->getTitle() && $withTitle) {
$html .= $this->getTitle() . '<br />';
}
/**
* @ORM\Column(type="string", length=255)
*/
protected $country;

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

if ($this->getLastname() || $this->getFirstname()) {
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />';
}
/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $siret;

if ($this->getAddress()) {
$html .= $this->getAddress() . '<br />';
}
/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $tva;

if ($this->getZip() || $this->getCity()) {
$html .= $this->getZip() . ' ' . $this->getCity() . '<br />';
}
/**
* @ORM\Column(type="array", nullable=true)
*/
protected $phone;

if ($this->getPhone()) {
foreach($this->getPhone() as $phone) {
$html .= 'Tél. ' . $phone.'<br />';
}
}
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

return $html;
}
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $pointSale;

public function getUser(): ?User
{
return $this->user;
}
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $merchant;

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

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

public function setUser(?User $user): self
{
$this->user = $user;
public function __toString()
{
return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}

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

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

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

public function getTitle(): ?string
{
return $this->title;
if ($this->getLastname() || $this->getFirstname()) {
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />';
}

public function setTitle(string $title): self
{
$this->title = $title;
if ($this->getAddress()) {
$html .= $this->getAddress() . '<br />';
}

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

public function getType(): ?string
{
return $this->type;
if ($this->getPhone()) {
foreach ($this->getPhone() as $phone) {
$html .= 'Tél. ' . $phone . '<br />';
}
}

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

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

public function getCivility(): ?bool
{
return $this->civility;
}
public function setUser(?UserInterface $user): self
{
$this->user = $user;

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

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

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

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

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

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

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

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

public function getAddress(): ?string
{
return $this->address;
}
public function setCivility(?bool $civility): self
{
$this->civility = $civility;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public function getPhone(): ?array
{
return $this->phone;
}
public function setCompany(?string $company): self
{
$this->company = $company;

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

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

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

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

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

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

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

public function setPointSale(PointSale $pointSale): self
{
$this->pointSale = $pointSale;
public function getPhone(): ?array
{
return $this->phone;
}

// set the owning side of the relation if necessary
if ($pointSale->getAddress() !== $this) {
$pointSale->setAddress($this);
}
public function setPhone(?array $phone): self
{
$this->phone = $phone;

return $this;
}
return $this;
}

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

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

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

return $this;
}

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

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

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

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

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

return $this;
public function setMerchant(MerchantInterface $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;
}
}

+ 32
- 31
Model/Common/TaxRateModel.php 查看文件

@@ -3,50 +3,51 @@
namespace Lc\CaracoleBundle\Model\Common;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

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

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

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


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

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}
}

+ 109
- 109
Model/Common/UnitModel.php 查看文件

@@ -3,118 +3,118 @@
namespace Lc\CaracoleBundle\Model\Common;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\AbstractEntity;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass
*/
abstract class UnitModel extends AbstractEntity
abstract class UnitModel extends AbstractLightEntity
{
/**
* @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="Lc\CaracoleBundle\Model\Common\UnitInterface")
* @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;
}
/**
* @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="Lc\CaracoleBundle\Model\Common\UnitInterface")
* @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;
}
}

+ 89
- 89
Model/Credit/CreditConfigModel.php 查看文件

@@ -9,93 +9,93 @@ use Doctrine\ORM\Mapping as ORM;
*/
abstract class CreditConfigModel
{
/**
* @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;
}
/**
* @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;
}
}

+ 177
- 168
Model/Credit/CreditHistoryModel.php 查看文件

@@ -2,183 +2,192 @@

namespace Lc\CaracoleBundle\Model\Credit;

use App\Entity\OrderPayment;
use App\Entity\OrderRefund;
use App\Entity\UserMerchant;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\PayoffTrait;
use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
use Lc\CaracoleBundle\Model\Order\OrderRefundInterface;
use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface;
use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class CreditHistoryModel extends AbstractEntity implements PayoffInterface
abstract class CreditHistoryModel extends AbstractLightEntity 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\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $userMerchant;

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

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

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

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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;
}
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\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $userMerchant;

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

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

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

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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;
}
}

+ 261
- 256
Model/File/DocumentModel.php 查看文件

@@ -7,282 +7,287 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Order\OrderRefundInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class DocumentModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class DocumentModel extends AbstractFullEntity 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\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Address\AddressInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchantAddress;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\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\CaracoleBundle\Model\Order\OrderShopInterface", mappedBy="documents")
* @ORM\JoinColumn(nullable=true)
*/
protected $orderShops;


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

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

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

public function __construct()
{
$this->orderShops = new ArrayCollection();
const TYPE_INVOICE = 'invoice';
const TYPE_QUOTATION = 'quotation';
const TYPE_PURCHASE_ORDER = 'purchase-order';
const TYPE_DELIVERY_NOTE = 'delivery-note';

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Address\AddressInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchantAddress;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\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\CaracoleBundle\Model\Order\OrderShopInterface", mappedBy="documents")
* @ORM\JoinColumn(nullable=true)
*/
protected $orderShops;


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

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

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

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

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

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

public function setMerchant(?MerchantInterface $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 __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 getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;

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

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

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(): ?AddressInterface
{
return $this->merchantAddress;
}

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

return $this;
}

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

public function setBuyerAddress(?AddressInterface $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|OrderShopInterface[]
*/
public function getOrderShops(): Collection
{
return $this->orderShops;
}

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

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

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

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

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

return $this;
}

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

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

return $this;
// set the owning side of the relation if necessary
if ($orderRefund->getDocument() !== $this) {
$orderRefund->setDocument($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;
}
return $this;
}
}

+ 9
- 8
Model/Merchant/MerchantConfigModel.php 查看文件

@@ -3,13 +3,14 @@
namespace Lc\CaracoleBundle\Model\Merchant;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\File\FileInterface;

/**
* @ORM\MappedSuperclass()
* @Vich\Uploadable
*/
abstract class MerchantConfigModel extends AbstractEntity
abstract class MerchantConfigModel extends AbstractLightEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="merchantConfigs")
@@ -28,18 +29,18 @@ abstract class MerchantConfigModel extends AbstractEntity
protected $value;

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

public static $availableOptions = [];

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

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

@@ -70,12 +71,12 @@ abstract class MerchantConfigModel extends AbstractEntity
return $this;
}

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

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

@@ -110,7 +111,7 @@ abstract class MerchantConfigModel extends AbstractEntity

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

public function getFieldType()

+ 383
- 374
Model/Merchant/MerchantModel.php 查看文件

@@ -5,388 +5,397 @@ namespace Lc\CaracoleBundle\Model\Merchant;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Model\Common\TaxRateInterface;
use Lc\CaracoleBundle\Model\Credit\CreditConfigInterface;
use Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Site\NewsInterface;
use Lc\CaracoleBundle\Model\Site\PageInterface;
use Lc\CaracoleBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class MerchantModel extends AbstractDocumentEntity
abstract class MerchantModel extends AbstractFullEntity
{
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditConfigInterface", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
protected $creditConfig;

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

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

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

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

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

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

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

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

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

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\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|MerchantConfigModel[]
*/
public function getMerchantConfigs(): Collection
{
return $this->merchantConfigs;
}

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

return $this;
}

public function removeMerchantConfig(MerchantConfigModel $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);
}
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditConfigInterface", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
protected $creditConfig;

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

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

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

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

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

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

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

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

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

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\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(): ?CreditConfigInterface
{
return $this->creditConfig;
}

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

return $this;
}

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

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

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

public function removeMerchantConfig(MerchantConfigInterface $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(): ?AddressInterface
{
return $this->address;
}

return $this;
}
public function setAddress(AddressInterface $address): self
{
$this->address = $address;

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

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

return $this;
}

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

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

return false;
}

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

/**
* @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;
}
public function addGroupUser(GroupUserInterface $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->setMerchant($this);
}

return $this;
}

public function removeGroupUser(GroupUserInterface $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;
}
}

+ 72
- 72
Model/Newsletter/NewsletterModel.php 查看文件

@@ -2,92 +2,92 @@

namespace Lc\CaracoleBundle\Model\Newsletter;

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\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class NewsletterModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class NewsletterModel extends AbstractFullEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="newsletters")
*/
protected $merchant;

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

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

public function __toString()
{
return $this->getTitle() ;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="newsletters")
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\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(): ?MerchantInterface
{
return $this->merchant;
}

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

return $this;
}

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

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

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

public function getMerchant(): ?Hub
{
return $this->merchant;
public function removeUser(UserInterface $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
$user->removeNewsletter($this);
}

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

return $this;
}
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 getIsMain(): ?bool
{
return $this->isMain;
}

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

return $this;
}

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

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

return $this;
}
return $this;
}
}

+ 5
- 6
Model/Order/OrderPaymentModel.php 查看文件

@@ -3,15 +3,14 @@
namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
use Lc\CaracoleBundle\Model\Order\OrderPayoffInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderPayoffInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderPayoffTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

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

use OrderPayoffTrait;
}

+ 0
- 7
Model/Order/OrderPayoffInterface.php 查看文件

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

namespace Lc\CaracoleBundle\Model\Order;

interface OrderPayoffInterface
{
}

+ 162
- 162
Model/Order/OrderProductModel.php 查看文件

@@ -2,201 +2,201 @@

namespace Lc\CaracoleBundle\Model\Order;

use Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalog;
use Lc\CaracoleBundle\Doctrine\Extension\PriceTrait;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface;
use Lc\CaracoleBundle\Model\Product\ProductInterface;

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

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\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\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface", cascade={"persist", "remove"})
*/
protected $orderProductReductionCatalog;

/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\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();
use PriceTrait;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\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\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface", cascade={"persist", "remove"})
*/
protected $orderProductReductionCatalog;

/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\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();
}
}
}

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 ;
}
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() ;
}
}
public function getOrderShop(): ?OrderShopInterface
{
return $this->orderShop;
}

// simple
if($productFamily->getBehaviorAddToCart() == 'simple') {
if($productFamily->getActiveProducts()) {
$title .= $titleProduct ;
if($productFamily->hasProductsWithVariousWeight()) {
$title .= ' - '.$product->getQuantityLabelInherited() ;
}
}
}
public function setOrderShop(?OrderShopInterface $orderShop): self
{
$this->orderShop = $orderShop;

return $title ;
}
return $this;
}

public function getOrderShop(): ?OrderShopModel
{
return $this->orderShop;
}
public function getProduct(): ?ProductInterface
{
return $this->product;
}

public function setOrderShop(?OrderShopModel $orderShop): self
{
$this->orderShop = $orderShop;
public function setProduct(?ProductInterface $product): self
{
$this->product = $product;

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
// set the owning side of the relation if necessary
if ($orderProductRefund->getOrderProduct() !== $this) {
$orderProductRefund->setOrderProduct($this);
}
public function getOrderProductRefund(): ?OrderProductRefundModel
{
return $this->orderProductRefund;
}

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

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

return $this;
}
return $this;
}

}

+ 16
- 16
Model/Order/OrderProductReductionCatalogModel.php 查看文件

@@ -3,29 +3,29 @@
namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;

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

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

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

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

return $this;
}
return $this;
}
}

+ 73
- 73
Model/Order/OrderProductRefundModel.php 查看文件

@@ -10,78 +10,78 @@ use Doctrine\ORM\Mapping as ORM;
*/
abstract class OrderProductRefundModel
{
/**
* @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\CaracoleBundle\Model\Order\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(): ?OrderProductModel
{
return $this->orderProduct;
}
public function setOrderProduct(OrderProductModel $orderProduct): self
{
$this->orderProduct = $orderProduct;
return $this;
}
/**
* @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\CaracoleBundle\Model\Order\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(): ?OrderProductInterface
{
return $this->orderProduct;
}
public function setOrderProduct(OrderProductInterface $orderProduct): self
{
$this->orderProduct = $orderProduct;
return $this;
}
}


+ 65
- 62
Model/Order/OrderReductionCartModel.php 查看文件

@@ -4,74 +4,77 @@ namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionCartPropertyInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionCartPropertyTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderReductionCartModel implements ReductionInterface, ReductionCartPropertyInterface
{
use ReductionTrait;
use ReductionCartPropertyTrait;
/**
* @ORM\Column(type="string", length=255)
*/
protected $title;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderReductionCarts")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Reduction\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(): ?OrderShopModel
{
return $this->orderShop;
}
public function setOrderShop(?OrderShopModel $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;
}
use ReductionTrait;
use ReductionCartPropertyTrait;
/**
* @ORM\Column(type="string", length=255)
*/
protected $title;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderReductionCarts")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Reduction\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(): ?OrderShopInterface
{
return $this->orderShop;
}
public function setOrderShop(?OrderShopInterface $orderShop): self
{
$this->orderShop = $orderShop;
return $this;
}
public function getReductionCart(): ?ReductionCartInterface
{
return $this->reductionCart;
}
public function setReductionCart(?ReductionCartInterface $reductionCart): self
{
$this->reductionCart = $reductionCart;
return $this;
}


}

+ 62
- 60
Model/Order/OrderReductionCreditModel.php 查看文件

@@ -3,91 +3,93 @@
namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;

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

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


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

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


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


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

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

}

+ 40
- 39
Model/Order/OrderRefundModel.php 查看文件

@@ -3,50 +3,51 @@
namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderPayoffInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderPayoffTrait;
use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderRefundModel extends AbstractEntity implements OrderPayoffInterface
abstract class OrderRefundModel extends AbstractLightEntity implements OrderPayoffInterface
{
use OrderPayoffTrait;
/**
* @ORM\Column(type="float", nullable=true)
*/
protected $deliveryRefundAmount;
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\File\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;
}
use OrderPayoffTrait;
/**
* @ORM\Column(type="float", nullable=true)
*/
protected $deliveryRefundAmount;
/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\File\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(): ?DocumentInterface
{
return $this->document;
}
public function setDocument(DocumentInterface $document): self
{
$this->document = $document;
return $this;
}
}


+ 528
- 514
Model/Order/OrderShopModel.php
文件差異過大導致無法顯示
查看文件


+ 0
- 8
Model/Order/OrderShopPriceUtilsInterface.php 查看文件

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

namespace Lc\CaracoleBundle\Model\Order ;

interface OrderShopPriceUtilsInterface
{

}

+ 75
- 71
Model/Order/OrderStatusHistoryModel.php 查看文件

@@ -4,81 +4,85 @@ namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;


/**
* @ORM\MappedSuperclass()
*/
abstract class OrderStatusHistoryModel extends AbstractEntity
abstract class OrderStatusHistoryModel extends AbstractLightEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

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

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

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

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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(): ?OrderShopModel
{
return $this->orderShop;
}

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

return $this;
}

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

public function setOrderStatus(?OrderStatusModel $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;
}
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", inversedBy="orderStatusHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

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

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

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

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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(): ?OrderShopInterface
{
return $this->orderShop;
}

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

return $this;
}

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

public function setOrderStatus(?OrderStatusInterface $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;
}
}

+ 121
- 121
Model/Order/OrderStatusModel.php 查看文件

@@ -11,135 +11,135 @@ use Doctrine\Common\Collections\Collection;
*/
abstract class OrderStatusModel
{
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\CaracoleBundle\Model\Order\OrderStatusInterface")
*/
protected $nextStatusAllowed;

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

public function __toString()
{
return $this->title. ' ['.$this->alias.']';
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\CaracoleBundle\Model\Order\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;
}

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 $this;
public function removeNextStatusAllowed(self $nextStatusAllowed): self
{
if ($this->nextStatusAllowed->contains($nextStatusAllowed)) {
$this->nextStatusAllowed->removeElement($nextStatusAllowed);
}

/**
* @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;
}

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

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

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

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

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

return $this;
}
return $this;
}


}

+ 70
- 69
Model/PointSale/PointSaleDayInfoModel.php 查看文件

@@ -3,78 +3,79 @@
namespace Lc\CaracoleBundle\Model\PointSale;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSaleDayInfoModel extends AbstractEntity
abstract class PointSaleDayInfoModel extends AbstractLightEntity
{
/**
* @ORM\Column(type="boolean")
*/
protected $active;
/**
* @ORM\Column(type="smallint")
*/
protected $day;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\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(): ?PointSaleModel
{
return $this->pointSale;
}
public function setPointSale(?PointSaleModel $pointSale): self
{
$this->pointSale = $pointSale;
return $this;
}
/**
* @ORM\Column(type="boolean")
*/
protected $active;
/**
* @ORM\Column(type="smallint")
*/
protected $day;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\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(): ?PointSaleInterface
{
return $this->pointSale;
}
public function setPointSale(?PointSaleInterface $pointSale): self
{
$this->pointSale = $pointSale;
return $this;
}
}

+ 161
- 156
Model/PointSale/PointSaleModel.php 查看文件

@@ -2,174 +2,179 @@

namespace Lc\CaracoleBundle\Model\PointSale;

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\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinTrait;
use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinInterface;
use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\User\UserPointSaleInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

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

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

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

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

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

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\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;
}
use OrderAmountMinTrait;

/**
* @return Collection|PointSaleDayInfoModel[]
*/
public function getPointSaleDayInfos(): Collection
{
return $this->pointSaleDayInfos;
/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="pointSales")
*/
protected $merchants;

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

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

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

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\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|MerchantInterface[]
*/
public function getMerchants(): Collection
{
return $this->merchants;
}

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

return $this;
}

public function removeMerchant(MerchantInterface $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|PointSaleDayInfoInterface[]
*/
public function getPointSaleDayInfos(): Collection
{
return $this->pointSaleDayInfos;
}

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

return $this;
}

public function removePointSaleDayInfo(PointSaleDayInfoInterface $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(): ?AddressInterface
{
return $this->address;
}

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

return $this;
}

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

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

return $this;
}

public function removeUserPointSale(UserPointSaleInterface $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);
}
}

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

return $this;
}

public function removePointSaleDayInfo(PointSaleDayInfoModel $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;
}
return $this;
}
}

+ 161
- 156
Model/Product/ProductCategoryModel.php 查看文件

@@ -6,194 +6,199 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Doctrine\Extension\TreeInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

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

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

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

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

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

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


/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\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() ;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="productCategories")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

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

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

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

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


/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\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));
}

return $this ;
public function addChildren(self $productCategory): self
{
if (!$this->childrens->contains($productCategory)) {
$this->childrens[] = $productCategory;
$productCategory->setParent($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));
}
return $this;
}

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);
}
}

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 $this;
}
/**
* @return Collection|ProductFamilyInterface[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

/**
* @return Collection|ProductFamilyModel[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
public function addProductFamily(ProductFamilyInterface $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->addProductCategory($this);
}

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

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

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

return $this;
}
return $this;
}

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

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

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

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

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

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

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

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

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

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

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

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

return $this;
}

}

+ 735
- 750
Model/Product/ProductFamilyModel.php
文件差異過大導致無法顯示
查看文件


+ 207
- 206
Model/Product/ProductModel.php 查看文件

@@ -3,219 +3,220 @@
namespace Lc\CaracoleBundle\Model\Product;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyTrait;
use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface;
use Lc\CaracoleBundle\Doctrine\Extension\SortableInterface;
use Lc\CaracoleBundle\Services\Price;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Extension\SortableInterface;
use Lc\SovBundle\Doctrine\Extension\SortableTrait;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProductModel extends AbstractEntity implements SortableInterface, ProductPropertyInterface, PriceInterface
abstract class ProductModel extends AbstractLightEntity implements SortableInterface, ProductPropertyInterface,
PriceInterface
{
use SortableTrait;
use ProductPropertyTrait;
use StatusTrait;
/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;
/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\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 ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
return $this->getProductFamily()->getAvailableQuantity();
break;
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $this->getAvailableQuantity();
break;
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return false;
break;
}
}
public function getTaxRateInherited()
{
return $this->getProductFamily()->getTaxRateInherited();
}
public function getProductFamily(): ?ProductFamilyModel
{
return $this->productFamily;
}
public function setProductFamily(?ProductFamilyModel $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;
}
use SortableTrait;
use ProductPropertyTrait;
use StatusTrait;
/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;
/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\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 ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
return $this->getProductFamily()->getAvailableQuantity();
break;
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
return $this->getAvailableQuantity();
break;
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return false;
break;
}
}
public function getTaxRateInherited()
{
return $this->getProductFamily()->getTaxRateInherited();
}
public function getProductFamily(): ?ProductFamilyInterface
{
return $this->productFamily;
}
public function setProductFamily(?ProductFamilyInterface $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;
}
}

+ 190
- 177
Model/Reduction/ReductionCartModel.php 查看文件

@@ -7,222 +7,235 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinInterface;
use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionCartPropertyInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionCartPropertyTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCartModel extends AbstractEntity implements ReductionPropertyInterface, ReductionInterface, ReductionCartPropertyInterface, FilterMerchantInterface, OrderAmountMinInterface, StatusInterface
abstract class ReductionCartModel extends AbstractLightEntity implements ReductionPropertyInterface, ReductionInterface,
ReductionCartPropertyInterface,
FilterMerchantInterface,
OrderAmountMinInterface, StatusInterface
{

const APPLIED_TO_DELIVERY = 'delivery';
const APPLIED_TO_ORDER_PRODUCTS = 'order-products';
const APPLIED_TO_DELIVERY = 'delivery';
const APPLIED_TO_ORDER_PRODUCTS = 'order-products';


use StatusTrait;
use OrderAmountMinTrait;
use ReductionTrait;
use ReductionCartPropertyTrait;
use ReductionPropertyTrait {
ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
}

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\PointSale\PointSaleInterface")
*/
protected $pointSales;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\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(): ?MerchantInterface
{
return $this->merchant;
}

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\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\PointSale\PointSaleInterface")
*/
protected $pointSales;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\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 setMerchant(?MerchantInterface $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 getCodes(): ?array
{
return $this->codes;
}

public function setCodes(?array $codes): self
{
$this->codes = $codes;

return $this;
}

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

public function getMerchant(): ?Merchant
{
return $this->merchant;
public function addPointSale(PointSaleInterface $pointSale): self
{
if (!$this->pointSales->contains($pointSale)) {
$this->pointSales[] = $pointSale;
}

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

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

return $this;
}

public function getCodes(): ?array
{
return $this->codes;
}
public function getAvailableQuantity(): ?int
{
return $this->availableQuantity;
}

public function setCodes(?array $codes): self
{
$this->codes = $codes;
public function setAvailableQuantity(int $availableQuantity): self
{
$this->availableQuantity = $availableQuantity;

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

public function removePointSale(PointSale $pointSale): self
{
if ($this->pointSales->contains($pointSale)) {
$this->pointSales->removeElement($pointSale);
}
/**
* @return Collection|self[]
*/
public function getUncombinables(): Collection
{
return $this->uncombinables;
}

return $this;
public function addUncombinable(self $uncombinable): self
{
if (!$this->uncombinables->contains($uncombinable)) {
$this->uncombinables[] = $uncombinable;
}

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

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

return $this;
public function removeUncombinables(self $uncombinable): self
{
if ($this->uncombinables->contains($uncombinable)) {
$this->uncombinables->removeElement($uncombinable);
}

public function getAvailableQuantityPerUser(): ?int
{
return $this->availableQuantityPerUser;
}
return $this;
}

public function setAvailableQuantityPerUser(int $availableQuantityPerUser): self
{
$this->availableQuantityPerUser = $availableQuantityPerUser;

return $this;
}
public function getUncombinableTypes(): ?array
{
return $this->uncombinableTypes;
}

/**
* @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 setUncombinableTypes(?array $uncombinableTypes): self
{
$this->uncombinableTypes = $uncombinableTypes;

return $this;
}

public function getUncombinableTypes(): ?array
{
return $this->uncombinableTypes;
}

public function setUncombinableTypes(?array $uncombinableTypes): self
{
$this->uncombinableTypes = $uncombinableTypes;
public function getAvailableQuantityPerCode(): ?int
{
return $this->availableQuantityPerCode;
}

return $this;
}
public function setAvailableQuantityPerCode(int $availableQuantityPerCode): self
{
$this->availableQuantityPerCode = $availableQuantityPerCode;

public function getAvailableQuantityPerCode(): ?int
{
return $this->availableQuantityPerCode;
}

public function setAvailableQuantityPerCode(int $availableQuantityPerCode): self
{
$this->availableQuantityPerCode = $availableQuantityPerCode;

return $this;
}
return $this;
}

}

+ 124
- 118
Model/Reduction/ReductionCatalogModel.php 查看文件

@@ -6,147 +6,153 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use phpDocumentor\Reflection\Types\Integer;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCatalogModel extends AbstractEntity implements ReductionCatalogInterface, ReductionPropertyInterface, FilterMerchantInterface, StatusInterface
abstract class ReductionCatalogModel extends AbstractLightEntity implements ReductionCatalogInterface,
ReductionPropertyInterface,
FilterMerchantInterface, StatusInterface
{
use StatusTrait;
use ReductionTrait;
use ReductionPropertyTrait{
ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
use StatusTrait;
use ReductionTrait;
use ReductionPropertyTrait {
ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
}

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

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

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $productFamilies;

/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $productFamily;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\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(): ?MerchantInterface
{
return $this->merchant;
}

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

return $this;
}


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

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

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

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

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $productFamilies;

/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $productFamily;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface")
*/
protected $productCategories;


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

public function getTitle(): ?string
{
return $this->title;
public function removeProductFamily(ProductFamilyInterface $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
}

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

return $this;
}

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

public function getMerchant(): ?Merchant
{
return $this->merchant;
}
public function setProductFamily(?ProductFamily $productFamily): self
{
$this->productFamily = $productFamily;

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

return $this;
}

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

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
public function addProductCategory(ProductCategoryInterface $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
}

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

return $this;
public function removeProductCategory(ProductCategoryInterface $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
}

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;
}
return $this;
}

}

+ 111
- 106
Model/Reduction/ReductionCreditModel.php 查看文件

@@ -6,153 +6,158 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionPropertyInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReductionCreditModel extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, StatusInterface
abstract class ReductionCreditModel extends AbstractLightEntity implements ReductionInterface, FilterMerchantInterface,
StatusInterface
{
const TYPE_CREDIT = 'credit';
const TYPE_GIFT = 'gift';
const TYPE_CREDIT = 'credit';
const TYPE_GIFT = 'gift';


use ReductionTrait;
use StatusTrait;
use ReductionTrait;
use StatusTrait;


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

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", inversedBy="reductionCredits")
*/
protected $users;
/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", inversedBy="reductionCredits")
*/
protected $users;


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

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

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
*/
protected $owner;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
*/
protected $owner;

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

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

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

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

return $this;
}
return $this;
}


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

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

return $this;
}
return $this;
}


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

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

return $this;
}
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 Collection|UserInterface[]
*/
public function getUsers(): Collection
{
return $this->users;
}

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

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

return $this;
public function removeUser(UserInterface $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;
public function getSended(): ?bool
{
return $this->sended;
}

return $this;
}
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;
public function getOwner(): ?UserInterface
{
return $this->owner;
}

return $this;
}
public function setOwner(?UserInterface $owner): self
{
$this->owner = $owner;

return $this;
}
}

+ 164
- 161
Model/Reminder/ReminderModel.php 查看文件

@@ -6,188 +6,191 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ReminderModel extends AbstractEntity implements FilterMerchantInterface
abstract class ReminderModel extends AbstractLightEntity implements FilterMerchantInterface
{
public $relatedPage;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\User\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 $relatedPage;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\User\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(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $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;

public function getEntityName(): ?string
{
return $this->entityName;
}

public function setEntityName(?string $entityName): self
{
$this->entityName = $entityName;

return $this;
}
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 getEntityId(): ?int
{
return $this->entityId;
}
public function setEntityId(?int $entityId): self
{
$this->entityId = $entityId;

public function setEntityId(?int $entityId): self
{
$this->entityId = $entityId;
return $this;
}

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

/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
public function addUser(UserInterface $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

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

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

public function getDone(): ?bool
{
return $this->done;
}
public function getDone(): ?bool
{
return $this->done;
}

public function setDone(?bool $done): self
{
$this->done = $done;
public function setDone(?bool $done): self
{
$this->done = $done;

return $this;
}
return $this;
}

}

+ 149
- 145
Model/Section/SectionModel.php 查看文件

@@ -2,171 +2,175 @@

namespace Lc\CaracoleBundle\Model\Section;

use App\Entity\Hub;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class SectionModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class SectionModel extends AbstractFullEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Product\ProductFamilyInterface", mappedBy="sections")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", mappedBy="section")
*/
protected $orderShops;


/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", mappedBy="section")
*/
protected $productCategories;

public function __construct()
{
$this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection();
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Product\ProductFamilyInterface", mappedBy="sections")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", mappedBy="section")
*/
protected $orderShops;


/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\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(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $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|ProductFamilyInterface[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

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

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 $this;
}

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
public function removeProductFamily(ProductFamilyInterface $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
$productFamily->removeSection($this);
}

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 $this;
}

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

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

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

public function removeOrderShop(OrderShopInterface $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);
}
}

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

return $this;
return $this;
}

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

public function addProductCategory(ProductCategoryInterface $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
$productCategory->setSection($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 $this;
}
public function removeProductCategory(ProductCategoryInterface $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getSection() === $this) {
$productCategory->setSection(null);
}
}

/**
* @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;
}
return $this;
}
}

+ 44
- 44
Model/Site/NewsModel.php 查看文件

@@ -2,67 +2,67 @@

namespace Lc\CaracoleBundle\Model\Site;

use App\Entity\Hub;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\AbstractDocumentEntity;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class NewsModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class NewsModel extends AbstractFullEntity implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="news")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="news")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $date;
/**
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
protected $date;

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

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

public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}
}

+ 42
- 41
Model/Site/PageModel.php 查看文件

@@ -2,52 +2,53 @@

namespace Lc\CaracoleBundle\Model\Site;

use App\Entity\Hub;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class PageModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class PageModel extends AbstractFullEntity implements FilterMerchantInterface
{
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $content;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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;
}
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $content;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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(): ?MerchantInterface
{
return $this->merchant;
}
public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;
return $this;
}
}

+ 93
- 91
Model/Ticket/TicketMessageModel.php 查看文件

@@ -3,101 +3,103 @@
namespace Lc\CaracoleBundle\Model\Ticket;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Ticket\TicketInterface;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketMessageModel extends AbstractEntity
abstract class TicketMessageModel extends AbstractLightEntity implements StatusInterface
{
use StatusTrait;
/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;
/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
/**
* @ORM\Column(type="text")
*/
protected $message;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Ticket\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;
}
use StatusTrait;
/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;
/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
/**
* @ORM\Column(type="text")
*/
protected $message;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Ticket\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;
}
}

+ 274
- 274
Model/Ticket/TicketModel.php 查看文件

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

namespace Lc\CaracoleBundle\Model\Ticket;

use App\Entity\TicketMessage;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -11,290 +9,292 @@ use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\CaracoleBundle\Model\User\UserInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketModel extends AbstractEntity implements FilterMerchantInterface
abstract class TicketModel extends AbstractLightEntity 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\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Order\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\CaracoleBundle\Model\Ticket\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
* @ORM\OrderBy({"id" = "ASC"})
*/
protected $ticketMessages;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", inversedBy="tickets")
*/
protected $user;

public function __construct()
{
$this->ticketMessages = new ArrayCollection();
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\CaracoleBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Order\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\CaracoleBundle\Model\Ticket\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
* @ORM\OrderBy({"id" = "ASC"})
*/
protected $ticketMessages;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\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 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|TicketMessageInterface[]
*/
public function getTicketMessages(): Collection
{
return $this->ticketMessages;
}

public function addTicketMessage(TicketMessageInterface $ticketMessage): self
{
if (!$this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages[] = $ticketMessage;
$ticketMessage->setTicket($this);
}

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;
return $this;
}

public function removeTicketMessage(TicketMessageInterface $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);
}
}

public function setVisitorEmail(?string $visitorEmail): self
{
$this->visitorEmail = $visitorEmail;
return $this;
}

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 getUser(): ?UserInterface
{
return $this->user;
}

public function addTicketMessage(TicketMessage $ticketMessage): self
{
if (!$this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages[] = $ticketMessage;
$ticketMessage->setTicket($this);
}
public function setUser(?UserInterface $user): self
{
$this->user = $user;

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;
}
return $this;
}
}

+ 51
- 48
Model/User/GroupUserModel.php 查看文件

@@ -6,74 +6,77 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Model\User\UserInterface;


/**
* @ORM\MappedSuperclass()
*/
abstract class GroupUserModel extends AbstractDocumentEntity implements FilterMerchantInterface
abstract class GroupUserModel extends AbstractFullEntity implements FilterMerchantInterface
{

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="groupUsers")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="groupUsers")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", mappedBy="groupUsers")
*/
protected $users;
/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", mappedBy="groupUsers")
*/
protected $users;


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


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

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

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

return $this;
}
return $this;
}

/**
* @return Collection|UserModel[]
*/
public function getUsers(): Collection
{
return $this->users;
public function addUser(UserModel $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

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

return $this;
return $this;
}

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

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

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

return $this;
}
return $this;
}


}

+ 0
- 8
Model/User/UserInterface.php 查看文件

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

namespace Lc\CaracoleBundle\Model\User;

interface UserInterface
{

}

+ 126
- 126
Model/User/UserMerchantModel.php 查看文件

@@ -2,12 +2,12 @@

namespace Lc\CaracoleBundle\Model\User;

use App\Entity\CreditHistory;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;

/**
* @ORM\MappedSuperclass()
@@ -15,136 +15,136 @@ use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
*/
abstract class UserMerchantModel implements FilterMerchantInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", inversedBy="userMerchants")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant", orphanRemoval=true)
*/
protected $creditHistories;

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

public function __construct()
{
$this->creditHistories = new ArrayCollection();
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserInterface", inversedBy="userMerchants")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\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\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant", orphanRemoval=true)
*/
protected $creditHistories;

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

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

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

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

return $this;
}

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

public function setMerchant(?MerchantInterface $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|CreditHistoryInterface[]
*/
public function getCreditHistories(): Collection
{
return $this->creditHistories;
}

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

public function getUser(): ?UserModel
{
return $this->user;
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);
}
}

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

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);
}
public function getActive(): ?bool
{
return $this->active;
}

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 setActive(bool $active): self
{
$this->active = $active;

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

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

return $this;
}
return $this;
}
}

+ 405
- 412
Model/User/UserModel.php 查看文件

@@ -2,9 +2,6 @@

namespace Lc\CaracoleBundle\Model\User;

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;
@@ -12,6 +9,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Model\User\User as SovUserModel;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
@@ -19,472 +17,467 @@ use Lc\CaracoleBundle\Model\Ticket\TicketInterface;
*/
abstract class UserModel 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\CaracoleBundle\Model\Merchant\MerchantInterface")
*/
protected $merchant;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", mappedBy="user", cascade={"persist"})
*/
protected $addresses;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Order\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\CaracoleBundle\Model\Newsletter\NewsletterInterface", inversedBy="users")
*/
protected $newsletters;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\GroupUserInterface", inversedBy="users")
*/
protected $groupUsers;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $favoriteProductFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserPointSaleInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userPointSales;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userMerchants;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Ticket\TicketInterface", mappedBy="user")
*/
protected $tickets;

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


/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\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);
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $phone;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
*/
protected $merchant;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", mappedBy="user", cascade={"persist"})
*/
protected $addresses;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Order\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\CaracoleBundle\Model\Newsletter\NewsletterInterface", inversedBy="users")
*/
protected $newsletters;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\User\GroupUserInterface", inversedBy="users")
*/
protected $groupUsers;

/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
*/
protected $favoriteProductFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserPointSaleInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userPointSales;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", mappedBy="user", orphanRemoval=true)
*/
protected $userMerchants;

/**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Ticket\TicketInterface", mappedBy="user")
*/
protected $tickets;

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


/**
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\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 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;
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);
}
}

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;
}

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

return $this;
}
public function addOrder(OrderShop $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setUser($this);
}

return $this;
}

public function getFirstname(): ?string
{
return $this->firstname;
}
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;
public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;

return $this;
}
return $this;
}

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

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

return $this;
}
return $this;
}

public function getGender(): ?bool
{
return $this->gender;
}
public function getGender(): ?bool
{
return $this->gender;
}

public function setGender(?bool $gender): self
{
$this->gender = $gender;

public function setGender(?bool $gender): self
{
$this->gender = $gender;
return $this;
}

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

/**
* @return Collection|Newsletter[]
*/
public function getNewsletters(): Collection
{
return $this->newsletters;
public function addNewsletter(Newsletter $newsletter): self
{
if (!$this->newsletters->contains($newsletter)) {
$this->newsletters[] = $newsletter;
}

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 $this;
/**
* @return Collection|GroupUserModel[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}

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

public function removeNewsletter(Newsletter $newsletter): self
{
if ($this->newsletters->contains($newsletter)) {
$this->newsletters->removeElement($newsletter);
}

return $this;
}
return $this;
}

/**
* @return Collection|GroupUserModel[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}
public function removeGroupUser(GroupUserModel $groupUser): self
{
if ($this->groupUsers->contains($groupUser)) {
$this->groupUsers->removeElement($groupUser);
$groupUser->removeUser($this);
}

public function addGroupUser(GroupUserModel $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->addUser($this);
}
return $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;
}

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

return $this;
public function removeFavoriteProductFamily(ProductFamily $favoriteProductFamily): self
{
if ($this->favoriteProductFamilies->contains($favoriteProductFamily)) {
$this->favoriteProductFamilies->removeElement($favoriteProductFamily);
}

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

public function addFavoriteProductFamily(ProductFamily $favoriteProductFamily): self
{
if (!$this->favoriteProductFamilies->contains($favoriteProductFamily)) {
$this->favoriteProductFamilies[] = $favoriteProductFamily;
}
/**
* @return Collection|UserPointSaleModel[]
*/
public function getUserPointSales(): Collection
{
return $this->userPointSales;
}

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

public function removeFavoriteProductFamily(ProductFamily $favoriteProductFamily): self
{
if ($this->favoriteProductFamilies->contains($favoriteProductFamily)) {
$this->favoriteProductFamilies->removeElement($favoriteProductFamily);
}
return $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 Collection|UserPointSaleModel[]
*/
public function getUserPointSales(): Collection
{
return $this->userPointSales;
}
return $this;
}

public function addUserPointSale(UserPointSale $userPointSale): self
{
if (!$this->userPointSales->contains($userPointSale)) {
$this->userPointSales[] = $userPointSale;
$userPointSale->setUser($this);
}
/**
* @return Collection|TicketInterface[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}

return $this;
public function addTicket(TicketInterface $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setUser($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 $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 Collection|TicketInterface[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}
return $this;
}

public function addTicket(TicketInterface $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setUser($this);
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}

return $this;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;

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;
}

return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}

public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;

return $this;
}
return $this;
}

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

public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
public function getTicketTypesNotification(): ?array
{
return $this->ticketTypesNotification;
}

return $this;
}
public function setTicketTypesNotification(?array $ticketTypesNotification): self
{
$this->ticketTypesNotification = $ticketTypesNotification;

return $this;
}

/**
* @return Collection|ReductionCredit[]
*/
public function getReductionCredits(): Collection
{
return $this->reductionCredits;
}

public function getTicketTypesNotification(): ?array
{
return $this->ticketTypesNotification;
public function addReductionCredit(ReductionCredit $reductionCredit): self
{
if (!$this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits[] = $reductionCredit;
$reductionCredit->addUser($this);
}

public function setTicketTypesNotification(?array $ticketTypesNotification): self
{
$this->ticketTypesNotification = $ticketTypesNotification;
return $this;
}

return $this;
public function removeReductionCredit(ReductionCredit $reductionCredit): self
{
if ($this->reductionCredits->contains($reductionCredit)) {
$this->reductionCredits->removeElement($reductionCredit);
$reductionCredit->removeUser($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;
}
return $this;
}

}

+ 6
- 4
Model/User/UserPointSaleModel.php 查看文件

@@ -3,6 +3,8 @@
namespace Lc\CaracoleBundle\Model\User;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass
@@ -26,24 +28,24 @@ abstract class UserPointSaleModel
*/
protected $comment;

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

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

return $this;
}

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

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


+ 115
- 113
Model/User/VisitorModel.php 查看文件

@@ -2,130 +2,132 @@

namespace Lc\CaracoleBundle\Model\User;

use App\Entity\OrderShop;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class VisitorModel
{
/**
* @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="Lc\CaracoleBundle\Model\Order\OrderShop", mappedBy="visitor")
*/
protected $orders;

public function __construct()
{
$this->orders = new ArrayCollection();
/**
* @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="Lc\CaracoleBundle\Model\Order\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|OrderShopInterface[]
*/
public function getOrders(): Collection
{
return $this->orders;
}

public function addOrder(OrderShopInterface $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setVisitor($this);
}

public function __toString()
{
return $this->getLastAccess()->format('d-m-y h:i') .'( visites :'.$this->totalVisit.')';
return $this;
}

public function removeOrder(OrderShopInterface $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);
}
}
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;
}
return $this;
}
}

Loading…
取消
儲存