<?phpnamespace App\Entity;use App\Repository\ComplaintXDocumentRepository;use DateTime;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * @Vich\Uploadable */#[ORM\Entity(repositoryClass: ComplaintXDocumentRepository::class)]#[ORM\Table(name: 'complaint_x_document')]class ComplaintXDocument{ #[ORM\Column(type: 'boolean')] private bool $isDeleted = false; #[ORM\Column(type: 'datetime')] private DateTime $createdAt; #[ORM\ManyToOne(targetEntity: ComplaintX::class, inversedBy: 'complaintXDocuments')] #[ORM\JoinColumn(nullable: false)] private ComplaintX $complaintX; #[ORM\Column(type: "integer")] #[ORM\Id] #[ORM\GeneratedValue(strategy: "AUTO")] private ?int $id; /** * @Vich\UploadableField(mapping="complaintXDocument", fileNameProperty="complaintXDocumentFileName", size="complaintXDocumentFileSize") */ private ?File $complaintXDocumentFile; #[ORM\Column(type: 'string', length: 255, nullable: true)] private ?string $complaintXDocumentFileName; #[ORM\Column(type: 'integer', nullable: true)] private ?int $complaintXDocumentFileSize; #[ORM\Column(type: 'datetime', nullable: true)] private ?DateTime $complaintXDocumentFileUpdatedAt; public function __construct() { $this->createdAt = new DateTime(); } public function __toString() { return "#" . $this->id . " - " . $this->complaintXDocumentFileName; } /** * 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 $image */ public function setComplaintXDocumentFile(File $image = null) { $this->complaintXDocumentFile = $image; if (null !== $image) { // It is required that at least one field changes if you are using doctrine // otherwise the event listeners won't be called and the file is lost $this->complaintXDocumentFileUpdatedAt = new \DateTime(); } } public function getComplaintXDocumentFile() { return $this->complaintXDocumentFile; } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set createdAt * * @param DateTime $createdAt * * @return ComplaintXDocument */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Set complaintXDocumentFileName * * @param string $complaintXDocumentFileName * * @return ComplaintXDocument */ public function setComplaintXDocumentFileName($complaintXDocumentFileName) { $this->complaintXDocumentFileName = $complaintXDocumentFileName; return $this; } /** * Get complaintXDocumentFileName * * @return string */ public function getComplaintXDocumentFileName() { return $this->complaintXDocumentFileName; } /** * Set complaintXDocumentFileSize * * @param integer $complaintXDocumentFileSize * * @return ComplaintXDocument */ public function setComplaintXDocumentFileSize($complaintXDocumentFileSize) { $this->complaintXDocumentFileSize = $complaintXDocumentFileSize; return $this; } /** * Get complaintXDocumentFileSize * * @return integer */ public function getComplaintXDocumentFileSize() { return $this->complaintXDocumentFileSize; } /** * Set complaintXDocumentFileUpdatedAt * * @param DateTime $complaintXDocumentFileUpdatedAt * * @return ComplaintXDocument */ public function setComplaintXDocumentFileUpdatedAt($complaintXDocumentFileUpdatedAt) { $this->complaintXDocumentFileUpdatedAt = $complaintXDocumentFileUpdatedAt; return $this; } /** * Get complaintXDocumentFileUpdatedAt * * @return DateTime */ public function getComplaintXDocumentFileUpdatedAt() { return $this->complaintXDocumentFileUpdatedAt; } /** * Set complaintX * * @param \App\Entity\ComplaintX $complaintX * * @return ComplaintXDocument */ public function setComplaintX(\App\Entity\ComplaintX $complaintX) { $this->complaintX = $complaintX; return $this; } /** * Get complaintX * * @return \App\Entity\ComplaintX */ public function getComplaintX() { return $this->complaintX; } /** * Set isDeleted * * @param boolean $isDeleted * * @return ComplaintXDocument */ public function setIsDeleted($isDeleted) { $this->isDeleted = $isDeleted; return $this; } /** * Get isDeleted * * @return boolean */ public function getIsDeleted() { return $this->isDeleted; }}