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

3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php
  2. namespace Lc\SovBundle\Model\Ticket;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Lc\SovBundle\Doctrine\EntityInterface;
  8. use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
  9. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  10. use Lc\SovBundle\Model\User\UserInterface;
  11. /**
  12. * @ORM\MappedSuperclass()
  13. */
  14. abstract class TicketModel extends AbstractLightEntity implements TicketInterface, EntityInterface
  15. {
  16. const TYPE_TECHNICAL_PROBLEM = 'technical-problem';
  17. const TYPE_GENERAL_QUESTION = 'general-question';
  18. const TICKET_STATUS_OPEN = 'open';
  19. const TICKET_STATUS_BEING_PROCESSED = 'being-processed';
  20. const TICKET_STATUS_CLOSED = 'closed';
  21. /**
  22. * @ORM\Column(type="string", length=32)
  23. */
  24. protected $type;
  25. /**
  26. * @ORM\Column(type="string", length=32)
  27. */
  28. protected $status = self::TICKET_STATUS_OPEN;
  29. /**
  30. * @ORM\Column(type="string", length=255)
  31. */
  32. protected $subject;
  33. /**
  34. * @ORM\Column(type="array", nullable=true)
  35. */
  36. protected $tags = [];
  37. /**
  38. * @ORM\Column(type="string", length=64, nullable=true)
  39. */
  40. protected $visitorFirstname;
  41. /**
  42. * @ORM\Column(type="string", length=64, nullable=true)
  43. */
  44. protected $visitorLastname;
  45. /**
  46. * @ORM\Column(type="string", length=128, nullable=true)
  47. */
  48. protected $visitorEmail;
  49. /**
  50. * @ORM\Column(type="string", length=255, nullable=true)
  51. */
  52. protected $visitorToken;
  53. /**
  54. * @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true, cascade={"persist", "remove"})
  55. * @ORM\OrderBy({"id" = "ASC"})
  56. */
  57. protected $ticketMessages;
  58. /**
  59. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="tickets")
  60. */
  61. protected $user;
  62. public function __construct()
  63. {
  64. $this->ticketMessages = new ArrayCollection();
  65. }
  66. public function getType(): ?string
  67. {
  68. return $this->type;
  69. }
  70. public function setType(string $type): self
  71. {
  72. $this->type = $type;
  73. return $this;
  74. }
  75. public function getStatus(): ?string
  76. {
  77. return $this->status;
  78. }
  79. public function setStatus(string $status): self
  80. {
  81. $this->status = $status;
  82. return $this;
  83. }
  84. public function getSubject(): ?string
  85. {
  86. return $this->subject;
  87. }
  88. public function setSubject(string $subject): self
  89. {
  90. $this->subject = $subject;
  91. return $this;
  92. }
  93. public function getTags(): ?array
  94. {
  95. return $this->tags;
  96. }
  97. public function setTags(?array $tags): self
  98. {
  99. $this->tags = $tags;
  100. return $this;
  101. }
  102. public function getVisitorFirstname(): ?string
  103. {
  104. return $this->visitorFirstname;
  105. }
  106. public function setVisitorFirstname(?string $visitorFirstname): self
  107. {
  108. $this->visitorFirstname = $visitorFirstname;
  109. return $this;
  110. }
  111. public function getVisitorLastname(): ?string
  112. {
  113. return $this->visitorLastname;
  114. }
  115. public function setVisitorLastname(?string $visitorLastname): self
  116. {
  117. $this->visitorLastname = $visitorLastname;
  118. return $this;
  119. }
  120. public function getVisitorEmail(): ?string
  121. {
  122. return $this->visitorEmail;
  123. }
  124. public function setVisitorEmail(?string $visitorEmail): self
  125. {
  126. $this->visitorEmail = $visitorEmail;
  127. return $this;
  128. }
  129. public function getVisitorToken(): ?string
  130. {
  131. return $this->visitorToken;
  132. }
  133. public function setVisitorToken(?string $visitorToken): self
  134. {
  135. $this->visitorToken = $visitorToken;
  136. return $this;
  137. }
  138. /**
  139. * @return Collection|TicketMessageInterface[]
  140. */
  141. public function getTicketMessages(): Collection
  142. {
  143. return $this->ticketMessages;
  144. }
  145. public function addTicketMessage(TicketMessageInterface $ticketMessage): self
  146. {
  147. if (!$this->ticketMessages->contains($ticketMessage)) {
  148. $this->ticketMessages[] = $ticketMessage;
  149. $ticketMessage->setTicket($this);
  150. }
  151. return $this;
  152. }
  153. public function removeTicketMessage(TicketMessageInterface $ticketMessage): self
  154. {
  155. if ($this->ticketMessages->contains($ticketMessage)) {
  156. $this->ticketMessages->removeElement($ticketMessage);
  157. // set the owning side to null (unless already changed)
  158. if ($ticketMessage->getTicket() === $this) {
  159. $ticketMessage->setTicket(null);
  160. }
  161. }
  162. return $this;
  163. }
  164. public function getUser(): ?UserInterface
  165. {
  166. return $this->user;
  167. }
  168. public function setUser(?UserInterface $user): self
  169. {
  170. $this->user = $user;
  171. return $this;
  172. }
  173. }