<?php
namespace App\Entity;
use App\Repository\CategorieElearningRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CategorieElearningRepository::class)]
class CategorieElearning
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $libelle = null;
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: FormationElearning::class,cascade: ['remove'])]
private Collection $formationElearnings;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
public function __construct()
{
$this->formationElearnings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(?string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
/**
* @return Collection<int, FormationElearning>
*/
public function getFormationElearnings(): Collection
{
return $this->formationElearnings;
}
public function addFormationElearning(FormationElearning $formationElearning): self
{
if (!$this->formationElearnings->contains($formationElearning)) {
$this->formationElearnings->add($formationElearning);
$formationElearning->setCategorie($this);
}
return $this;
}
public function removeFormationElearning(FormationElearning $formationElearning): self
{
if ($this->formationElearnings->removeElement($formationElearning)) {
// set the owning side to null (unless already changed)
if ($formationElearning->getCategorie() === $this) {
$formationElearning->setCategorie(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
}