src/Entity/AccountingDocument.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AccountingDocumentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[ORM\Entity(repositoryClassAccountingDocumentRepository::class)]
  8. #[Vich\Uploadable]
  9. class AccountingDocument
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column]
  16.     private ?\DateTimeImmutable $addedAt null;
  17.     #[ORM\Column(nullabletrue)]
  18.     private ?\DateTimeImmutable $updatedAt null;
  19.     #[ORM\Column]
  20.     private ?int $isActive 1;
  21.     #[Vich\UploadableField(mapping'document'fileNameProperty'fileName')]
  22.     private ?File $file null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $fileName null;
  25.     // AccountingDocument entity
  26.     #[ORM\ManyToOne(inversedBy'accounting_document')]
  27.     private ?User $user null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $title null;
  30.     public function __construct()
  31.     {
  32.         $this->setAddedAt(new \DateTimeImmutable());
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getUser(): ?User
  39.     {
  40.         return $this->user;
  41.     }
  42.     public function getAddedAt(): ?\DateTimeImmutable
  43.     {
  44.         return $this->addedAt;
  45.     }
  46.     public function setAddedAt(\DateTimeImmutable $addedAt): self
  47.     {
  48.         $this->addedAt $addedAt;
  49.         return $this;
  50.     }
  51.     public function getUpdatedAt(): ?\DateTimeImmutable
  52.     {
  53.         return $this->updatedAt;
  54.     }
  55.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  56.     {
  57.         $this->updatedAt $updatedAt;
  58.         return $this;
  59.     }
  60.     public function getIsActive(): ?int
  61.     {
  62.         return $this->isActive;
  63.     }
  64.     public function setIsActive(int $isActive): self
  65.     {
  66.         $this->isActive $isActive;
  67.         return $this;
  68.     }
  69.     public function getFileName(): ?string
  70.     {
  71.         return $this->fileName;
  72.     }
  73.     public function setFileName(string $fileName): self
  74.     {
  75.         $this->fileName $fileName;
  76.         return $this;
  77.     }
  78.     public function setFile(?File $file null): void
  79.     {
  80.         $this->file $file;
  81.         if (null !== $file) {
  82.             $this->updatedAt = new \DateTimeImmutable('now');
  83.         }
  84.     }
  85.     public function getFile(): ?File
  86.     {
  87.         return $this->file;
  88.     }
  89.     public function setUser(?User $user): self
  90.     {
  91.         $this->user $user;
  92.         return $this;
  93.     }
  94.     public function getTitle(): ?string
  95.     {
  96.         return $this->title;
  97.     }
  98.     public function setTitle(string $title): self
  99.     {
  100.         $this->title $title;
  101.         return $this;
  102.     }
  103. }