src/Entity/TicketComment.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TicketCommentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8. * @ORM\Entity(repositoryClass=TicketCommentRepository::class)
  9. * @Vich\Uploadable
  10. */
  11. class TicketComment
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private ?int $id = null;
  19. /**
  20. * @ORM\Column(type="text", nullable=true)
  21. */
  22. private $description;
  23. /**
  24. * @ORM\Column(type="string", length=255, nullable=true)
  25. */
  26. private ?string $pj = null;
  27. /**
  28. * @Vich\UploadableField(mapping="frontend_image", fileNameProperty="pj")
  29. * @var File|null
  30. */
  31. private $imgFile;
  32. /**
  33. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="TicketComment")
  34. */
  35. private $user;
  36. /**
  37. * @ORM\ManyToOne(targetEntity=Ticket::class, inversedBy="comments", fetch="EAGER", cascade={"persist"})
  38. * @ORM\JoinColumn(nullable=false)
  39. */
  40. private $ticket;
  41. /**
  42. * @ORM\Column(type="datetime")
  43. */
  44. private \DateTimeInterface $creationDate;
  45. public function __construct()
  46. {
  47. $this->creationDate = new \Datetime();
  48. }
  49. public function getId(): ?int
  50. {
  51. return $this->id;
  52. }
  53. public function getDescription(): ?string
  54. {
  55. return $this->description;
  56. }
  57. public function setDescription(?string $description): self
  58. {
  59. $this->description = $description;
  60. return $this;
  61. }
  62. public function getPj(): ?string
  63. {
  64. return $this->pj;
  65. }
  66. public function setPj(?string $pj): self
  67. {
  68. $this->pj = $pj;
  69. return $this;
  70. }
  71. /**
  72. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  73. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  74. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  75. * must be able to accept an instance of 'File' as the bundle will inject one here
  76. * during Doctrine hydration.
  77. *
  78. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  79. */
  80. public function setImgFile(?File $imageFile = null)
  81. {
  82. $this->imgFile = $imageFile;
  83. return true;
  84. }
  85. public function getImgFile(): ?File
  86. {
  87. return $this->imgFile;
  88. }
  89. public function getUser(): ?User
  90. {
  91. return $this->user;
  92. }
  93. public function setUser(?User $user): self
  94. {
  95. $this->user = $user;
  96. return $this;
  97. }
  98. public function getTicket(): ?Ticket
  99. {
  100. return $this->ticket;
  101. }
  102. public function setTicket(?Ticket $ticket): self
  103. {
  104. $this->ticket = $ticket;
  105. return $this;
  106. }
  107. public function getCreationDate(): ?\DateTimeInterface
  108. {
  109. return $this->creationDate;
  110. }
  111. public function setCreationDate(\DateTimeInterface $creationDate): self
  112. {
  113. $this->creationDate = $creationDate;
  114. return $this;
  115. }
  116. }