Ticket.php 7.8KB

hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use App\Entity\TicketMessage;
  4. use App\Entity\User;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Lc\ShopBundle\Context\FilterMerchantInterface;
  9. use Lc\ShopBundle\Context\MerchantInterface;
  10. use Lc\ShopBundle\Context\OrderShopInterface;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use Lc\ShopBundle\Context\UserInterface;
  13. /**
  14. * @ORM\MappedSuperclass()
  15. */
  16. abstract class Ticket extends AbstractEntity implements FilterMerchantInterface
  17. {
  18. const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable' ;
  19. const TYPE_PRODUCT_ERROR = 'product-error' ;
  20. const TYPE_TECHNICAL_PROBLEM = 'technical-problem' ;
  21. const TYPE_GENERAL_QUESTION = 'general-question' ;
  22. const TICKET_STATUS_OPEN = 'open' ;
  23. const TICKET_STATUS_BEING_PROCESSED = 'being-processed' ;
  24. const TICKET_STATUS_CLOSED = 'closed' ;
  25. use StatusTrait;
  26. /**
  27. * @Gedmo\Blameable(on="create")
  28. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  29. * @ORM\JoinColumn(nullable=true)
  30. */
  31. protected $createdBy;
  32. /**
  33. * @Gedmo\Blameable(on="update")
  34. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  35. * @ORM\JoinColumn(nullable=true)
  36. */
  37. protected $updatedBy;
  38. /**
  39. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
  40. * @ORM\JoinColumn(nullable=false)
  41. */
  42. protected $merchant;
  43. /**
  44. * @ORM\Column(type="string", length=32)
  45. */
  46. protected $type;
  47. /**
  48. * @ORM\Column(type="text", nullable=true)
  49. */
  50. protected $typeHelp;
  51. /**
  52. * @ORM\Column(type="string", length=32)
  53. */
  54. protected $ticketStatus;
  55. /**
  56. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="tickets")
  57. */
  58. protected $orderShop;
  59. /**
  60. * @ORM\Column(type="string", length=255)
  61. */
  62. protected $subject;
  63. /**
  64. * @ORM\Column(type="array", nullable=true)
  65. */
  66. protected $tags = [];
  67. /**
  68. * @ORM\Column(type="string", length=64, nullable=true)
  69. */
  70. protected $visitorFirstname;
  71. /**
  72. * @ORM\Column(type="string", length=64, nullable=true)
  73. */
  74. protected $visitorLastname;
  75. /**
  76. * @ORM\Column(type="string", length=128, nullable=true)
  77. */
  78. protected $visitorEmail;
  79. /**
  80. * @ORM\Column(type="string", length=255, nullable=true)
  81. */
  82. protected $visitorToken;
  83. /**
  84. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
  85. */
  86. protected $ticketMessages;
  87. /**
  88. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="tickets")
  89. */
  90. protected $user;
  91. public function __construct()
  92. {
  93. $this->ticketMessages = new ArrayCollection();
  94. }
  95. public function getMerchant(): ?MerchantInterface
  96. {
  97. return $this->merchant;
  98. }
  99. public function setMerchant(?MerchantInterface $merchant): self
  100. {
  101. $this->merchant = $merchant;
  102. return $this;
  103. }
  104. public function getType(): ?string
  105. {
  106. return $this->type;
  107. }
  108. public function setType(string $type): self
  109. {
  110. $this->type = $type;
  111. return $this;
  112. }
  113. public function getTypeLabel(): string
  114. {
  115. return 'field.Ticket.typeOptions.'.$this->getType() ;
  116. }
  117. public function getTypeHelp(): ?string
  118. {
  119. return $this->typeHelp;
  120. }
  121. public function setTypeHelp(?string $typeHelp): self
  122. {
  123. $this->typeHelp = $typeHelp;
  124. return $this;
  125. }
  126. public function getTicketStatus(): ?string
  127. {
  128. return $this->ticketStatus;
  129. }
  130. public function setTicketStatus(string $ticketStatus): self
  131. {
  132. $this->ticketStatus = $ticketStatus;
  133. return $this;
  134. }
  135. public function getTicketStatusLabel(): string
  136. {
  137. return 'field.Ticket.ticketStatusOptions.'.$this->getTicketStatus() ;
  138. }
  139. public function getOrderShop(): ?OrderShopInterface
  140. {
  141. return $this->orderShop;
  142. }
  143. public function setOrderShop(?OrderShopInterface $orderShop): self
  144. {
  145. $this->orderShop = $orderShop;
  146. return $this;
  147. }
  148. public function getSubject(): ?string
  149. {
  150. return $this->subject;
  151. }
  152. public function setSubject(string $subject): self
  153. {
  154. $this->subject = $subject;
  155. return $this;
  156. }
  157. public function getTags(): ?array
  158. {
  159. return $this->tags;
  160. }
  161. public function setTags(?array $tags): self
  162. {
  163. $this->tags = $tags;
  164. return $this;
  165. }
  166. public function getVisitorFirstname(): ?string
  167. {
  168. return $this->visitorFirstname;
  169. }
  170. public function setVisitorFirstname(?string $visitorFirstname): self
  171. {
  172. $this->visitorFirstname = $visitorFirstname;
  173. return $this;
  174. }
  175. public function getVisitorLastname(): ?string
  176. {
  177. return $this->visitorLastname;
  178. }
  179. public function setVisitorLastname(?string $visitorLastname): self
  180. {
  181. $this->visitorLastname = $visitorLastname;
  182. return $this;
  183. }
  184. public function getVisitorEmail(): ?string
  185. {
  186. return $this->visitorEmail;
  187. }
  188. public function setVisitorEmail(?string $visitorEmail): self
  189. {
  190. $this->visitorEmail = $visitorEmail;
  191. return $this;
  192. }
  193. public function getVisitorToken(): ?string
  194. {
  195. return $this->visitorToken;
  196. }
  197. public function setVisitorToken(?string $visitorToken): self
  198. {
  199. $this->visitorToken = $visitorToken;
  200. return $this;
  201. }
  202. /**
  203. * @return Collection|TicketMessage[]
  204. */
  205. public function getTicketMessages(): Collection
  206. {
  207. return $this->ticketMessages;
  208. }
  209. public function addTicketMessage(TicketMessage $ticketMessage): self
  210. {
  211. if (!$this->ticketMessages->contains($ticketMessage)) {
  212. $this->ticketMessages[] = $ticketMessage;
  213. $ticketMessage->setTicket($this);
  214. }
  215. return $this;
  216. }
  217. public function removeTicketMessage(TicketMessage $ticketMessage): self
  218. {
  219. if ($this->ticketMessages->contains($ticketMessage)) {
  220. $this->ticketMessages->removeElement($ticketMessage);
  221. // set the owning side to null (unless already changed)
  222. if ($ticketMessage->getTicket() === $this) {
  223. $ticketMessage->setTicket(null);
  224. }
  225. }
  226. return $this;
  227. }
  228. public function getUser(): ?UserInterface
  229. {
  230. return $this->user;
  231. }
  232. public function setUser(?UserInterface $user): self
  233. {
  234. $this->user = $user;
  235. return $this;
  236. }
  237. }