<?php
namespace App\Entity;
use App\Repository\ArchiveComplaintRepository;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: ArchiveComplaintRepository::class)]
#[ORM\Table(name: 'archive_complaint')]
#[Vich\Uploadable]
class ArchiveComplaint {
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?DateTime $createdAt;
#[ORM\Column(type: Types::BOOLEAN)]
private bool $isDeleted = false;
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $complaintQualification;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?DateTime $complaintDate;
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $archiveComplaintFileName;
#[ORM\Column(type: Types::INTEGER , nullable: true)]
private ?int $archiveComplaintFileSize;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?DateTime $archiveComplaintFileUpdatedAt;
#[ORM\ManyToOne(targetEntity: ItemsListComplaint::class, inversedBy: 'archiveComplaints')]
#[ORM\JoinColumn(nullable: true)]
private ?ItemsListComplaint $itemsListComplaint;
#[ORM\ManyToOne(targetEntity: Vehicle::class, inversedBy: 'archiveComplaints')]
#[ORM\JoinColumn(nullable: true)]
private ?Vehicle $vehicle;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'archiveComplaints')]
#[ORM\JoinColumn(nullable: true)]
private User $user;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*/
#[Vich\UploadableField(mapping: 'archiveComplaint', fileNameProperty: 'archiveComplaintFileName', size: 'archiveComplaintFileSize')]
private ?File $archiveComplaintFile;
public function __construct() {
$this->createdAt = new DateTime();
}
public function __toString() {
return "#" . $this->id . " - " . $this->createdAt->format("d/m/Y H:i");
}
public function getId(): ?int
{
return $this->id;
}
public function setCreatedAt(DateTime $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedAt(): ?DateTime
{
return $this->createdAt;
}
public function setIsDeleted(bool $isDeleted): static
{
$this->isDeleted = $isDeleted;
return $this;
}
public function getIsDeleted(): bool
{
return $this->isDeleted;
}
public function setComplaintQualification(string $complaintQualification): static
{
$this->complaintQualification = $complaintQualification;
return $this;
}
public function getComplaintQualification(): ?string
{
return $this->complaintQualification;
}
public function setComplaintDate(DateTime $complaintDate): static
{
$this->complaintDate = $complaintDate;
return $this;
}
public function getComplaintDate(): ?DateTime
{
return $this->complaintDate;
}
public function setArchiveComplaintFileName(string $archiveComplaintFileName): static
{
$this->archiveComplaintFileName = $archiveComplaintFileName;
return $this;
}
public function getArchiveComplaintFileName(): ?string
{
return $this->archiveComplaintFileName;
}
public function setArchiveComplaintFileSize(int $archiveComplaintFileSize): static {
$this->archiveComplaintFileSize = $archiveComplaintFileSize;
return $this;
}
public function getArchiveComplaintFileSize(): ?int
{
return $this->archiveComplaintFileSize;
}
public function setArchiveComplaintFileUpdatedAt(DateTime $archiveComplaintFileUpdatedAt): static {
$this->archiveComplaintFileUpdatedAt = $archiveComplaintFileUpdatedAt;
return $this;
}
public function getArchiveComplaintFileUpdatedAt(): ?DateTime
{
return $this->archiveComplaintFileUpdatedAt;
}
public function setItemsListComplaint(?ItemsListComplaint $itemsListComplaint = null): static
{
$this->itemsListComplaint = $itemsListComplaint;
return $this;
}
public function getItemsListComplaint(): ?ItemsListComplaint
{
return $this->itemsListComplaint;
}
public function setVehicle(?Vehicle $vehicle = null): static
{
$this->vehicle = $vehicle;
return $this;
}
public function getVehicle(): ?Vehicle
{
return $this->vehicle;
}
public function setUser(?User $user): static {
$this->user = $user;
return $this;
}
public function getUser(): ?User {
return $this->user;
}
/**
* 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.
*/
public function setArchiveComplaintFile(File|UploadedFile $image = null) {
$this->archiveComplaintFile = $image;
if (null !== $image) {
$this->archiveComplaintFileUpdatedAt = new DateTime();
}
}
public function getArchiveComplaintFile(): ?File
{
return $this->archiveComplaintFile;
}
}