src/Entity/Projet.php line 19
<?phpnamespace App\Entity;use App\Entity\Traits\Timestamp;use App\Repository\ProjetRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;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: ProjetRepository::class)]#[ORM\HasLifecycleCallbacks]#[Vich\Uploadable]class Projet{use Timestamp;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column(length: 255)]private ?string $slug = 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: 'projets', fileNameProperty: 'image')]private $imageFile;#[ORM\Column(length: 255, nullable: true)]private ?string $image = null;#[ORM\Column(length: 255, nullable: true)]private ?string $lien = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column]private ?bool $online = null;#[ORM\ManyToOne(inversedBy: 'projets')]#[ORM\JoinColumn(nullable: true)]private ?Categorie $categorie = null;#[ORM\Column(nullable: true)]private ?float $version = null;#[ORM\OneToMany(mappedBy: 'projets', targetEntity: Media::class, cascade: ['persist'])]private Collection $medias;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $dateSortie = null;public function __construct(){$this->medias = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): static{$this->name = $name;return $this;}public function getSlug(): ?string{return $this->slug;}public function setSlug(string $slug): static{$this->slug = $slug;return $this;}public function getImage(): ?string{return $this->image;}public function setImage(?string $image): static{$this->image = $image;return $this;}public function getLien(): ?string{return $this->lien;}public function setLien(?string $lien): static{$this->lien = $lien;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): static{$this->description = $description;return $this;}public function isOnline(): ?bool{return $this->online;}public function setOnline(bool $online): static{$this->online = $online;return $this;}public function getCategorie(): ?Categorie{return $this->categorie;}public function setCategorie(?Categorie $categorie): self{$this->categorie = $categorie;return $this;}public function __toString(){return $this->getName();}/*** @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;}public function getVersion(): ?float{return $this->version;}public function setVersion(?float $version): self{$this->version = $version;return $this;}/*** @return Collection<int, Media>*/public function getMedias(): Collection{return $this->medias;}public function addMedia(Media $media): self{if (!$this->medias->contains($media)) {$this->medias->add($media);$media->setProjets($this);}return $this;}public function removeMedia(Media $media): self{if ($this->medias->removeElement($media)) {// set the owning side to null (unless already changed)if ($media->getProjets() === $this) {$media->setProjets(null);}}return $this;}public function getDateSortie(): ?\DateTimeInterface{return $this->dateSortie;}public function setDateSortie(?\DateTimeInterface $dateSortie): self{$this->dateSortie = $dateSortie;return $this;}}