src/Entity/Ticket.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TicketRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\Entity(repositoryClass=TicketRepository::class)
  12. * @Vich\Uploadable
  13. */
  14. class Ticket
  15. {
  16. const STATUS_EN_COURS = "En cours";
  17. const STATUS_FERMER = "Fermer";
  18. const STATUS_ATTENTE = "En attente retour client";
  19. /**
  20. * @ORM\Id
  21. * @ORM\GeneratedValue
  22. * @ORM\Column(type="integer")
  23. */
  24. private $id;
  25. /**
  26. * @ORM\Column(type="string", length=255, nullable=true)
  27. */
  28. private $title;
  29. /**
  30. * @ORM\Column(type="text", nullable=true)
  31. */
  32. private $description;
  33. /**
  34. * @ORM\Column(type="string", length=512, nullable=true)
  35. */
  36. private $url;
  37. /**
  38. * @ORM\Column(type="string", length=255, nullable=true)
  39. */
  40. private $nomEnfant;
  41. /**
  42. * @ORM\Column(type="string", length=255, nullable=true)
  43. */
  44. private $nomParent;
  45. /**
  46. * @ORM\Column(type="string", length=255, nullable=true)
  47. */
  48. private $tag;
  49. /**
  50. * @ORM\Column(type="string", length=255, nullable=true)
  51. */
  52. private $pj;
  53. /**
  54. * @Vich\UploadableField(mapping="frontend_image", fileNameProperty="pj")
  55. *
  56. * @var File|null
  57. */
  58. private $imgFile;
  59. /**
  60. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="ticket")
  61. */
  62. private $personneAssocie;
  63. /**
  64. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="ticket")
  65. */
  66. private $createdBy;
  67. /**
  68. * @ORM\Column(type="string", length=512, nullable=true)
  69. */
  70. private $status;
  71. /**
  72. * @ORM\OneToMany(targetEntity=TicketComment::class, mappedBy="ticket", cascade={"persist", "remove"})
  73. * @ORM\OrderBy({"creationDate" = "ASC"})
  74. */
  75. private $comments;
  76. /**
  77. * @ORM\Column(type="datetime")
  78. */
  79. private $creationDate;
  80. public function __construct()
  81. {
  82. $this->creationDate = new \Datetime();
  83. $this->comments = new ArrayCollection();
  84. }
  85. public function getId(): ?int
  86. {
  87. return $this->id;
  88. }
  89. public function getTitle(): ?string
  90. {
  91. return $this->title;
  92. }
  93. public function setTitle(?string $title): self
  94. {
  95. $this->title = $title;
  96. return $this;
  97. }
  98. public function getDescription(): ?string
  99. {
  100. return $this->description;
  101. }
  102. public function setDescription(?string $description): self
  103. {
  104. $this->description = $description;
  105. return $this;
  106. }
  107. public function getUrl(): ?string
  108. {
  109. return $this->url;
  110. }
  111. public function setUrl(?string $url): self
  112. {
  113. $this->url = $url;
  114. return $this;
  115. }
  116. public function getNomEnfant(): ?string
  117. {
  118. return $this->nomEnfant;
  119. }
  120. public function setNomEnfant(?string $nomEnfant): self
  121. {
  122. $this->nomEnfant = $nomEnfant;
  123. return $this;
  124. }
  125. public function getNomParent(): ?string
  126. {
  127. return $this->nomParent;
  128. }
  129. public function setNomParent(?string $nomParent): self
  130. {
  131. $this->nomParent = $nomParent;
  132. return $this;
  133. }
  134. public function getTag(): ?string
  135. {
  136. return $this->tag;
  137. }
  138. public function setTag(?string $tag): self
  139. {
  140. $this->tag = $tag;
  141. return $this;
  142. }
  143. public function getPj(): ?string
  144. {
  145. return $this->pj;
  146. }
  147. public function setPj(?string $pj): self
  148. {
  149. $this->pj = $pj;
  150. return $this;
  151. }
  152. /**
  153. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  154. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  155. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  156. * must be able to accept an instance of 'File' as the bundle will inject one here
  157. * during Doctrine hydration.
  158. *
  159. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  160. */
  161. public function setImgFile(?File $imageFile = null)
  162. {
  163. $this->imgFile = $imageFile;
  164. return true;
  165. }
  166. public function getImgFile(): ?File
  167. {
  168. return $this->imgFile;
  169. }
  170. public function getPersonneAssocie(): ?Contact
  171. {
  172. return $this->personneAssocie;
  173. }
  174. public function setPersonneAssocie(?Contact $personneAssocie): self
  175. {
  176. $this->personneAssocie = $personneAssocie;
  177. return $this;
  178. }
  179. public function getCreatedBy(): ?User
  180. {
  181. return $this->createdBy;
  182. }
  183. public function setCreatedBy(?User $createdBy): self
  184. {
  185. $this->createdBy = $createdBy;
  186. return $this;
  187. }
  188. public function getStatus(): ?string
  189. {
  190. return $this->status;
  191. }
  192. public function setStatus(?string $status): self
  193. {
  194. $this->status = $status;
  195. return $this;
  196. }
  197. public function getCreationDate(): ?\DateTimeInterface
  198. {
  199. return $this->creationDate;
  200. }
  201. public function setCreationDate(\DateTimeInterface $creationDate): self
  202. {
  203. $this->creationDate = $creationDate;
  204. return $this;
  205. }
  206. /**
  207. * @return Collection|TicketComment[]
  208. */
  209. public function getComments(): Collection
  210. {
  211. return $this->comments;
  212. }
  213. public function addComment(TicketComment $comment): self
  214. {
  215. if (!$this->comments->contains($comment)) {
  216. $this->comments[] = $comment;
  217. $comment->setTicket($this);
  218. }
  219. return $this;
  220. }
  221. }