<?phpnamespace App\Entity;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: "App\Repository\ComplaintXPhotoRepository")]#[ORM\Table(name: "complaint_x_photo")]class ComplaintXPhoto{ #[ORM\Column(type: "boolean")] private bool $isDeleted = false; #[ORM\Column(type: "datetime")] private DateTime $createdAt; #[ORM\Column(type: "integer")] #[ORM\Id] #[ORM\GeneratedValue(strategy: "AUTO")] private ?int $id; #[ORM\ManyToOne(targetEntity: ComplaintX::class, inversedBy: "complaintXPhotos")] #[ORM\JoinColumn(nullable: false)] private ComplaintX $complaintX; /** * @Vich\UploadableField(mapping="complaintXPhoto", fileNameProperty="complaintXPhotoFileName", size="complaintXPhotoFileSize") */ private File $complaintXPhotoFile; #[ORM\Column(type: "string", length: 255, nullable: true)] private ?string $complaintXPhotoFileName; #[ORM\Column(type: "integer", nullable: true)] private ?int $complaintXPhotoFileSize; #[ORM\Column(type: "datetime", nullable: true)] private DateTime $complaintXPhotoFileUpdatedAt; public function __construct() { $this->createdAt = new DateTime(); } public function __toString() { return "#" . $this->id . " - " . $this->complaintXPhotoFileName; } /** * 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 setComplaintXPhotoFile(File $image = null) { $this->complaintXPhotoFile = $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->complaintXPhotoFileUpdatedAt = new \DateTime(); } } public function getComplaintXPhotoFile() { return $this->complaintXPhotoFile; } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set createdAt * * @param DateTime $createdAt * * @return ComplaintXPhoto */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Set complaintXPhotoFileName * * @param string $complaintXPhotoFileName * * @return ComplaintXPhoto */ public function setComplaintXPhotoFileName($complaintXPhotoFileName) { $this->complaintXPhotoFileName = $complaintXPhotoFileName; return $this; } /** * Get complaintXPhotoFileName * * @return string */ public function getComplaintXPhotoFileName() { return $this->complaintXPhotoFileName; } /** * Set complaintXPhotoFileSize * * @param integer $complaintXPhotoFileSize * * @return ComplaintXPhoto */ public function setComplaintXPhotoFileSize($complaintXPhotoFileSize) { $this->complaintXPhotoFileSize = $complaintXPhotoFileSize; return $this; } /** * Get complaintXPhotoFileSize * * @return integer */ public function getComplaintXPhotoFileSize() { return $this->complaintXPhotoFileSize; } /** * Set complaintXPhotoFileUpdatedAt * * @param DateTime $complaintXPhotoFileUpdatedAt * * @return ComplaintXPhoto */ public function setComplaintXPhotoFileUpdatedAt($complaintXPhotoFileUpdatedAt) { $this->complaintXPhotoFileUpdatedAt = $complaintXPhotoFileUpdatedAt; return $this; } /** * Get complaintXPhotoFileUpdatedAt * * @return DateTime */ public function getComplaintXPhotoFileUpdatedAt() { return $this->complaintXPhotoFileUpdatedAt; } /** * Set complaintX * * @param \App\Entity\ComplaintX $complaintX * * @return ComplaintXPhoto */ 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 ComplaintXPhoto */ public function setIsDeleted($isDeleted) { $this->isDeleted = $isDeleted; return $this; } /** * Get isDeleted * * @return boolean */ public function getIsDeleted() { return $this->isDeleted; }}