Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

4 роки тому
4 роки тому
4 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. /**
  7. * @ORM\MappedSuperclass()
  8. */
  9. abstract class OrderStatus
  10. {
  11. const ALIAS_CART = 'cart' ;
  12. const ALIAS_CART_CANCELED = 'cart-canceled' ;
  13. const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ;
  14. const ALIAS_WAITING_PAYMENT_CREDIT = 'waiting-payment-credit' ;
  15. const ALIAS_WAITING_BANK_RETURN = 'waiting-bank-return' ;
  16. const ALIAS_PAID_ONLINE = 'paid-online' ;
  17. const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ;
  18. const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ;
  19. const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ;
  20. const ALIAS_WAITING_DELIVERY_WITH_PAYMENT = 'waiting-delivery-with-payment' ;
  21. const ALIAS_DELIVERED_WITHOUT_PAYMENT = 'delivered-without-payment' ;
  22. const ALIAS_DONE = 'done' ;
  23. const ALIAS_CANCELED = 'canceled' ;
  24. const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund' ;
  25. const ALIAS_REFUND = 'refund' ;
  26. //TODO : AJOUTER un champ valid ds orderSTATUS
  27. static $statusAliasAsValid = [
  28. self::ALIAS_PAID_ONLINE,
  29. self::ALIAS_PAID_BY_CREDIT,
  30. self::ALIAS_WAITING_DELIVERY,
  31. self::ALIAS_WAITING_BANK_RETURN,
  32. self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
  33. self::ALIAS_DELIVERED_WITHOUT_PAYMENT,
  34. self::ALIAS_DONE
  35. ] ;
  36. static $statusAliasWaitingDelivery = [
  37. self::ALIAS_WAITING_DELIVERY,
  38. self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
  39. ];
  40. static $statusAliasAsCart = [
  41. self::ALIAS_CART,
  42. self::ALIAS_WAITING_PAYMENT_ONLINE,
  43. self::ALIAS_WAITING_PAYMENT_CREDIT,
  44. self::ALIAS_ERROR_PAYMENT_ONLINE
  45. ];
  46. /**
  47. * @ORM\Column(type="string", length=255)
  48. */
  49. protected $title;
  50. /**
  51. * @ORM\Column(type="text", nullable=true)
  52. */
  53. protected $description;
  54. /**
  55. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface")
  56. */
  57. protected $nextStatusAllowed;
  58. /**
  59. * @ORM\Column(type="string", length=255)
  60. */
  61. protected $alias;
  62. public function __toString()
  63. {
  64. return $this->title. ' ['.$this->alias.']';
  65. }
  66. public function __construct()
  67. {
  68. $this->nextStatusAllowed = new ArrayCollection();
  69. }
  70. public function getTitle(): ?string
  71. {
  72. return $this->title;
  73. }
  74. public function setTitle(string $title): self
  75. {
  76. $this->title = $title;
  77. return $this;
  78. }
  79. public function getDescription(): ?string
  80. {
  81. return $this->description;
  82. }
  83. public function setDescription(?string $description): self
  84. {
  85. $this->description = $description;
  86. return $this;
  87. }
  88. /**
  89. * @return Collection|self[]
  90. */
  91. public function getNextStatusAllowed(): Collection
  92. {
  93. return $this->nextStatusAllowed;
  94. }
  95. public function addNextStatusAllowed(self $nextStatusAllowed): self
  96. {
  97. if (!$this->nextStatusAllowed->contains($nextStatusAllowed)) {
  98. $this->nextStatusAllowed[] = $nextStatusAllowed;
  99. }
  100. return $this;
  101. }
  102. public function removeNextStatusAllowed(self $nextStatusAllowed): self
  103. {
  104. if ($this->nextStatusAllowed->contains($nextStatusAllowed)) {
  105. $this->nextStatusAllowed->removeElement($nextStatusAllowed);
  106. }
  107. return $this;
  108. }
  109. public function getAlias(): ?string
  110. {
  111. return $this->alias;
  112. }
  113. public function setAlias(string $alias): self
  114. {
  115. $this->alias = $alias;
  116. return $this;
  117. }
  118. }