<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\CategorieFormationRepository::class)]
class CategorieFormation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $titre;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\ManyToMany(targetEntity: \App\Entity\Formation::class, mappedBy: 'categorie')]
private $formations;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
public function __construct()
{
$this->formations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection|Formation[]
*/
public function getFormations(): Collection
{
return $this->formations;
}
public function addFormation(Formation $formation): self
{
if (!$this->formations->contains($formation)) {
$this->formations[] = $formation;
$formation->addCategorie($this);
}
return $this;
}
public function removeFormation(Formation $formation): self
{
if ($this->formations->contains($formation)) {
$this->formations->removeElement($formation);
$formation->removeCategorie($this);
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
}