<?phpnamespace App\Entity;use App\Repository\TicketCommentRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * @ORM\Entity(repositoryClass=TicketCommentRepository::class) * @Vich\Uploadable */class TicketComment{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id = null; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\Column(type="string", length=255, nullable=true) */ private ?string $pj = null; /** * @Vich\UploadableField(mapping="frontend_image", fileNameProperty="pj") * @var File|null */ private $imgFile; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="TicketComment") */ private $user; /** * @ORM\ManyToOne(targetEntity=Ticket::class, inversedBy="comments", fetch="EAGER", cascade={"persist"}) * @ORM\JoinColumn(nullable=false) */ private $ticket; /** * @ORM\Column(type="datetime") */ private \DateTimeInterface $creationDate; public function __construct() { $this->creationDate = new \Datetime(); } public function getId(): ?int { return $this->id; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getPj(): ?string { return $this->pj; } public function setPj(?string $pj): self { $this->pj = $pj; return $this; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile */ public function setImgFile(?File $imageFile = null) { $this->imgFile = $imageFile; return true; } public function getImgFile(): ?File { return $this->imgFile; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getTicket(): ?Ticket { return $this->ticket; } public function setTicket(?Ticket $ticket): self { $this->ticket = $ticket; return $this; } public function getCreationDate(): ?\DateTimeInterface { return $this->creationDate; } public function setCreationDate(\DateTimeInterface $creationDate): self { $this->creationDate = $creationDate; return $this; }}