src/Entity/Ressource.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RessourceRepository;
  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(repositoryClassRessourceRepository::class)]
  8. #[Vich\Uploadable]
  9. class Ressource
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[Vich\UploadableField(mapping'ressource'fileNameProperty'fileName')]
  16.     private ?File $file null;
  17.     
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private ?string $fileName null;
  20.     #[ORM\Column]
  21.     private ?\DateTimeImmutable $addedAt null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?\DateTimeImmutable $updatedAt null;
  24.     #[ORM\Column]
  25.     private ?int $isActive 1;
  26.     #[ORM\ManyToOne(inversedBy'ressource')]
  27.     private ?Project $project null;
  28.     #[ORM\ManyToOne(inversedBy'ressources')]
  29.     private ?RessourceDirectory $directory 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 getFileName(): ?string
  39.     {
  40.         return $this->fileName;
  41.     }
  42.     public function setFileName(?string $fileName): self
  43.     {
  44.         $this->fileName $fileName;
  45.         return $this;
  46.     }
  47.     public function getAddedAt(): ?\DateTimeImmutable
  48.     {
  49.         return $this->addedAt;
  50.     }
  51.     public function setAddedAt(\DateTimeImmutable $addedAt): self
  52.     {
  53.         $this->addedAt $addedAt;
  54.         return $this;
  55.     }
  56.     public function getUpdatedAt(): ?\DateTimeImmutable
  57.     {
  58.         return $this->updatedAt;
  59.     }
  60.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  61.     {
  62.         $this->updatedAt $updatedAt;
  63.         return $this;
  64.     }
  65.     public function getIsActive(): ?int
  66.     {
  67.         return $this->isActive;
  68.     }
  69.     public function setIsActive(int $isActive): self
  70.     {
  71.         $this->isActive $isActive;
  72.         return $this;
  73.     }
  74.     public function setFile(?File $file null): void
  75.     {
  76.         $this->file $file;
  77.         if (null !== $file) {
  78.             $this->updatedAt = new \DateTimeImmutable('now');
  79.         }
  80.     }
  81.     public function getFile(): ?File
  82.     {
  83.         return $this->file;
  84.     }
  85.     public function getProject(): ?Project
  86.     {
  87.         return $this->project;
  88.     }
  89.     public function setProject(?Project $project): self
  90.     {
  91.         $this->project $project;
  92.         return $this;
  93.     }
  94.     public function getDirectory(): ?RessourceDirectory
  95.     {
  96.         return $this->directory;
  97.     }
  98.     public function setDirectory(?RessourceDirectory $directory): self
  99.     {
  100.         $this->directory $directory;
  101.         return $this;
  102.     }
  103. }