src/Entity/Formation.php line 18
<?php
namespace App\Entity;
use App\Repository\FormationRepository;
use DateTimeImmutable;
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 Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: FormationRepository::class)]
#[Vich\Uploadable]
class Formation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: "Ne peut être vide !")]
#[Assert\NotNull(message: "Ne peut être nul !")]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $slug = null;
#[ORM\Column(type: Types::TEXT)]
#[Assert\NotBlank(message: "Ne peut être vide !")]
#[Assert\NotNull(message: "Ne peut être nul !")]
private ?string $description = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: "Ne peut être vide !")]
#[Assert\NotNull(message: "Ne peut être nul !")]
private ?string $duree = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: "Ne peut être vide !")]
#[Assert\NotNull(message: "Ne peut être nul !")]
private ?string $niveauDifficulte = null;
#[ORM\Column]
private ?bool $isFree = null;
#[ORM\ManyToMany(targetEntity: Cours::class, inversedBy: 'formations')]
private Collection $cours;
#[ORM\ManyToMany(targetEntity: Eleve::class, inversedBy: 'CreatedAt')]
private Collection $eleves;
#[ORM\Column]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\Column]
private ?bool $isPublished = null;
#[ORM\Column(length: 255)]
private ?string $image = null;
#[Vich\UploadableField(mapping: "formations_path", fileNameProperty: "image")]
public ?File $imageFile = null;
public function __construct()
{
$this->cours = new ArrayCollection();
$this->eleves = new ArrayCollection();
$this->isFree = false;
$this->isPublished = false;
$this->createdAt = new DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getDuree(): ?string
{
return $this->duree;
}
public function setDuree(string $duree): self
{
$this->duree = $duree;
return $this;
}
public function getNiveauDifficulte(): ?string
{
return $this->niveauDifficulte;
}
public function setNiveauDifficulte(string $niveauDifficulte): self
{
$this->niveauDifficulte = $niveauDifficulte;
return $this;
}
public function isIsFree(): ?bool
{
return $this->isFree;
}
public function setIsFree(bool $isFree): self
{
$this->isFree = $isFree;
return $this;
}
/**
* @return Collection<int, Cours>
*/
public function getCours(): Collection
{
return $this->cours;
}
public function addCour(Cours $cour): self
{
if (!$this->cours->contains($cour)) {
$this->cours->add($cour);
}
return $this;
}
public function removeCour(Cours $cour): self
{
$this->cours->removeElement($cour);
return $this;
}
/**
* @return Collection<int, Eleve>
*/
public function getEleves(): Collection
{
return $this->eleves;
}
public function addElefe(Eleve $elefe): self
{
if (!$this->eleves->contains($elefe)) {
$this->eleves->add($elefe);
}
return $this;
}
public function removeElefe(Eleve $elefe): self
{
$this->eleves->removeElement($elefe);
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function isIsPublished(): ?bool
{
return $this->isPublished;
}
public function setIsPublished(bool $isPublished): self
{
$this->isPublished = $isPublished;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
}