Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

OrderStatus.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_PAID_ONLINE = 'paid-online' ;
  16. const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ;
  17. const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ;
  18. const ALIAS_WAITING_DELIVERY = 'waiting-delivery' ;
  19. const ALIAS_DONE = 'done' ;
  20. const ALIAS_CANCELED = 'canceled' ;
  21. const ALIAS_CANCELED_WAITING_REFUND = 'canceled-waiting-refund' ;
  22. const ALIAS_REFUND = 'refund' ;
  23. /**
  24. * @ORM\Column(type="string", length=255)
  25. */
  26. protected $title;
  27. /**
  28. * @ORM\Column(type="text", nullable=true)
  29. */
  30. protected $description;
  31. /**
  32. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusInterface")
  33. */
  34. protected $nextStatusAllowed;
  35. /**
  36. * @ORM\Column(type="string", length=255)
  37. */
  38. protected $alias;
  39. public function __toString()
  40. {
  41. return $this->title. ' ['.$this->alias.']';
  42. }
  43. public function __construct()
  44. {
  45. $this->nextStatusAllowed = new ArrayCollection();
  46. }
  47. public function getTitle(): ?string
  48. {
  49. return $this->title;
  50. }
  51. public function setTitle(string $title): self
  52. {
  53. $this->title = $title;
  54. return $this;
  55. }
  56. public function getDescription(): ?string
  57. {
  58. return $this->description;
  59. }
  60. public function setDescription(?string $description): self
  61. {
  62. $this->description = $description;
  63. return $this;
  64. }
  65. /**
  66. * @return Collection|self[]
  67. */
  68. public function getNextStatusAllowed(): Collection
  69. {
  70. return $this->nextStatusAllowed;
  71. }
  72. public function addNextStatusAllowed(self $nextStatusAllowed): self
  73. {
  74. if (!$this->nextStatusAllowed->contains($nextStatusAllowed)) {
  75. $this->nextStatusAllowed[] = $nextStatusAllowed;
  76. }
  77. return $this;
  78. }
  79. public function removeNextStatusAllowed(self $nextStatusAllowed): self
  80. {
  81. if ($this->nextStatusAllowed->contains($nextStatusAllowed)) {
  82. $this->nextStatusAllowed->removeElement($nextStatusAllowed);
  83. }
  84. return $this;
  85. }
  86. public function getAlias(): ?string
  87. {
  88. return $this->alias;
  89. }
  90. public function setAlias(string $alias): self
  91. {
  92. $this->alias = $alias;
  93. return $this;
  94. }
  95. }