<?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\CategorieRepository")
*/
class Categorie
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $libelle_categorie;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Evenement", mappedBy="categorie", orphanRemoval=true)
*/
private $evenements;
public function __construct()
{
$this->evenements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelleCategorie(): ?string
{
return $this->libelle_categorie;
}
public function setLibelleCategorie(string $libelle_categorie): self
{
$this->libelle_categorie = $libelle_categorie;
return $this;
}
/**
* @return Collection|Evenement[]
*/
public function getEvenements(): Collection
{
return $this->evenements;
}
public function addEvenement(Evenement $evenement): self
{
if (!$this->evenements->contains($evenement)) {
$this->evenements[] = $evenement;
$evenement->setCategorie($this);
}
return $this;
}
public function removeEvenement(Evenement $evenement): self
{
if ($this->evenements->contains($evenement)) {
$this->evenements->removeElement($evenement);
// set the owning side to null (unless already changed)
if ($evenement->getCategorie() === $this) {
$evenement->setCategorie(null);
}
}
return $this;
}
}