src/Entity/ArchiveComplaint.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ArchiveComplaintRepository;
  4. use DateTime;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. #[ORM\Entity(repositoryClassArchiveComplaintRepository::class)]
  11. #[ORM\Table(name'archive_complaint')]
  12. #[Vich\Uploadable]
  13. class ArchiveComplaint {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(typeTypes::INTEGER)]
  17.     private ?int $id;
  18.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  19.     private ?DateTime $createdAt;
  20.     #[ORM\Column(typeTypes::BOOLEAN)]
  21.     private bool $isDeleted false;
  22.     #[ORM\Column(typeTypes::STRINGlength255nullabletrue)]
  23.     private ?string $complaintQualification;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  25.     private ?DateTime $complaintDate;
  26.     #[ORM\Column(typeTypes::STRINGlength255nullabletrue)]
  27.     private ?string $archiveComplaintFileName;
  28.     #[ORM\Column(typeTypes::INTEGER nullabletrue)]
  29.     private ?int $archiveComplaintFileSize;
  30.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  31.     private ?DateTime $archiveComplaintFileUpdatedAt;
  32.     #[ORM\ManyToOne(targetEntityItemsListComplaint::class, inversedBy'archiveComplaints')]
  33.     #[ORM\JoinColumn(nullabletrue)]
  34.     private ?ItemsListComplaint $itemsListComplaint;
  35.     #[ORM\ManyToOne(targetEntityVehicle::class, inversedBy'archiveComplaints')]
  36.     #[ORM\JoinColumn(nullabletrue)]
  37.     private ?Vehicle $vehicle;
  38.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'archiveComplaints')]
  39.     #[ORM\JoinColumn(nullabletrue)]
  40.     private User $user;
  41.     /**
  42.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  43.      */
  44.     #[Vich\UploadableField(mapping'archiveComplaint'fileNameProperty'archiveComplaintFileName'size'archiveComplaintFileSize')]
  45.     private ?File $archiveComplaintFile;
  46.     public function __construct() {
  47.         $this->createdAt = new DateTime();
  48.     }
  49.     public function __toString() {
  50.         return "#" $this->id " - " $this->createdAt->format("d/m/Y H:i");
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function setCreatedAt(DateTime $createdAt): static
  57.     {
  58.         $this->createdAt $createdAt;
  59.         return $this;
  60.     }
  61.     public function getCreatedAt(): ?DateTime
  62.     {
  63.         return $this->createdAt;
  64.     }
  65.     public function setIsDeleted(bool $isDeleted): static
  66.     {
  67.         $this->isDeleted $isDeleted;
  68.         return $this;
  69.     }
  70.     public function getIsDeleted(): bool
  71.     {
  72.         return $this->isDeleted;
  73.     }
  74.     public function setComplaintQualification(string $complaintQualification): static
  75.     {
  76.         $this->complaintQualification $complaintQualification;
  77.         return $this;
  78.     }
  79.     public function getComplaintQualification(): ?string
  80.     {
  81.         return $this->complaintQualification;
  82.     }
  83.     public function setComplaintDate(DateTime $complaintDate): static
  84.     {
  85.         $this->complaintDate $complaintDate;
  86.         return $this;
  87.     }
  88.     public function getComplaintDate(): ?DateTime
  89.     {
  90.         return $this->complaintDate;
  91.     }
  92.     public function setArchiveComplaintFileName(string $archiveComplaintFileName): static
  93.     {
  94.         $this->archiveComplaintFileName $archiveComplaintFileName;
  95.         return $this;
  96.     }
  97.     public function getArchiveComplaintFileName(): ?string
  98.     {
  99.         return $this->archiveComplaintFileName;
  100.     }
  101.     public function setArchiveComplaintFileSize(int $archiveComplaintFileSize): static {
  102.         $this->archiveComplaintFileSize $archiveComplaintFileSize;
  103.         return $this;
  104.     }
  105.     public function getArchiveComplaintFileSize(): ?int
  106.     {
  107.         return $this->archiveComplaintFileSize;
  108.     }
  109.     public function setArchiveComplaintFileUpdatedAt(DateTime $archiveComplaintFileUpdatedAt): static {
  110.         $this->archiveComplaintFileUpdatedAt $archiveComplaintFileUpdatedAt;
  111.         return $this;
  112.     }
  113.     public function getArchiveComplaintFileUpdatedAt(): ?DateTime
  114.     {
  115.         return $this->archiveComplaintFileUpdatedAt;
  116.     }
  117.     public function setItemsListComplaint(?ItemsListComplaint $itemsListComplaint null): static
  118.     {
  119.         $this->itemsListComplaint $itemsListComplaint;
  120.         return $this;
  121.     }
  122.     public function getItemsListComplaint(): ?ItemsListComplaint
  123.     {
  124.         return $this->itemsListComplaint;
  125.     }
  126.     public function setVehicle(?Vehicle $vehicle null): static
  127.     {
  128.         $this->vehicle $vehicle;
  129.         return $this;
  130.     }
  131.     public function getVehicle(): ?Vehicle
  132.     {
  133.         return $this->vehicle;
  134.     }
  135.     public function setUser(?User $user): static {
  136.         $this->user $user;
  137.         return $this;
  138.     }
  139.     public function getUser(): ?User {
  140.         return $this->user;
  141.     }
  142.     /**
  143.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  144.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  145.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  146.      * must be able to accept an instance of 'File' as the bundle will inject one here
  147.      * during Doctrine hydration.
  148.      */
  149.     public function setArchiveComplaintFile(File|UploadedFile $image null) {
  150.         $this->archiveComplaintFile $image;
  151.         if (null !== $image) {
  152.             $this->archiveComplaintFileUpdatedAt = new DateTime();
  153.         }
  154.     }
  155.     public function getArchiveComplaintFile(): ?File
  156.     {
  157.         return $this->archiveComplaintFile;
  158.     }
  159. }