Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.bachtale.com_1719306535
/
htdocs
/
src
/
Entity
/
//srv/data/trash/vhost_www.bachtale.com_1719306535/htdocs/src/Entity/Ressource.php
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\HttpFoundation\File\File; use Vich\UploaderBundle\Mapping\Annotation as Vich; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\HttpFoundation\File\UploadedFile; use Vich\UploaderBundle\Mapping\Annotation\UploadableField; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\RessourceRepository") * @Vich\Uploadable * @UniqueEntity( * fields = {"name"}, * message = "Le nom que vous avez indiqué est déjà utilisé !" * ) */ class Ressource { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) * * @var string */ private $name; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * @Vich\UploadableField(mapping="document_files", fileNameProperty="documentName") * @Assert\File( * maxSize = "2048k", * mimeTypes = {"application/pdf", "application/x-pdf", "image/jpg", "image/jpeg", "image/png" }, * mimeTypesMessage = "Veuillez ajouter un fichier de type pdf, jpg, jpeg ou png valide" * ) * * * @var File */ private $documentFile; /** * @ORM\Column(type="string", length=255, nullable=true) * * @var string */ private $documentName; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime") */ private $updatedAt; public function __construct() { $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(?string $name): void { $this->name = $name; } public function getDocumentName(): ?string { return $this->documentName; } public function setDocumentName(?string $documentName): void { $this->documentName = $documentName; } /** * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $documentFile * */ public function setDocumentFile(?File $documentFile = null): void { $this->documentFile = $documentFile; if (null !== $documentFile) { // It is required that at least one field changes if you are using doctrine // otherwise the event listeners won't be called and the file is lost $this->updatedAt = new \DateTimeImmutable(); } } public function getDocumentFile(): ?File { return $this->documentFile; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } }