src/Entity/Media.php line 16
<?phpnamespace App\Entity;use App\Entity\Traits\Timestamp;use App\Repository\MediaRepository;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;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: MediaRepository::class)]#[ORM\HasLifecycleCallbacks]#[Vich\Uploadable]class Media{use Timestamp;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;/*** @var File|null**/#[Assert\Image(maxSize: '50M', maxSizeMessage: 'Image trop volumineuse maximum 10Mb')]#[Assert\Image(mimeTypes: ["image/jpeg", "image/jpg", "image/png"], mimeTypesMessage: "Mauvais format d'image (jpeg, jpg et png)")]#[Vich\UploadableField(mapping: 'medias', fileNameProperty: 'image')]private $imageFile;#[ORM\Column(length: 255, nullable: true)]private ?string $image = null;#[ORM\ManyToOne(inversedBy: 'medias')]private ?Projet $projets = null;public function getId(): ?int{return $this->id;}public function getImage(): ?string{return $this->image;}public function setImage(?string $image): self{$this->image = $image;return $this;}public function getProjets(): ?Projet{return $this->projets;}public function setProjets(?Projet $projets): self{$this->projets = $projets;return $this;}/*** @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile*/public function setImageFile(?File $imageFile = null): void{$this->imageFile = $imageFile;if (null !== $imageFile) {// 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->setUpdated(new \DateTimeImmutable());}}public function getImageFile(): ?File{return $this->imageFile;}}