<?php
namespace App\Entity;
use App\Repository\AccountingDocumentRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: AccountingDocumentRepository::class)]
#[Vich\Uploadable]
class AccountingDocument
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?\DateTimeImmutable $addedAt = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\Column]
private ?int $isActive = 1;
#[Vich\UploadableField(mapping: 'document', fileNameProperty: 'fileName')]
private ?File $file = null;
#[ORM\Column(length: 255)]
private ?string $fileName = null;
// AccountingDocument entity
#[ORM\ManyToOne(inversedBy: 'accounting_document')]
private ?User $user = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
public function __construct()
{
$this->setAddedAt(new \DateTimeImmutable());
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function getAddedAt(): ?\DateTimeImmutable
{
return $this->addedAt;
}
public function setAddedAt(\DateTimeImmutable $addedAt): self
{
$this->addedAt = $addedAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getIsActive(): ?int
{
return $this->isActive;
}
public function setIsActive(int $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getFileName(): ?string
{
return $this->fileName;
}
public function setFileName(string $fileName): self
{
$this->fileName = $fileName;
return $this;
}
public function setFile(?File $file = null): void
{
$this->file = $file;
if (null !== $file) {
$this->updatedAt = new \DateTimeImmutable('now');
}
}
public function getFile(): ?File
{
return $this->file;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
}