<?php
namespace App\Entity;
use App\Repository\CategoriesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategoriesRepository::class)
*/
class Categories
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Libelle;
/**
* @ORM\OneToMany(targetEntity=Annonces::class, mappedBy="Categories")
*/
private $annonces;
/**
* @ORM\OneToMany(targetEntity=Alertes::class, mappedBy="Categories")
*/
private $alertes;
public function __construct()
{
$this->annonces = new ArrayCollection();
$this->alertes = 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, Annonces>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonces $annonce): self
{
if (!$this->annonces->contains($annonce)) {
$this->annonces[] = $annonce;
$annonce->setCategories($this);
}
return $this;
}
public function removeAnnonce(Annonces $annonce): self
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getCategories() === $this) {
$annonce->setCategories(null);
}
}
return $this;
}
/**
* @return Collection<int, Alertes>
*/
public function getAlertes(): Collection
{
return $this->alertes;
}
public function addAlerte(Alertes $alerte): self
{
if (!$this->alertes->contains($alerte)) {
$this->alertes[] = $alerte;
$alerte->setCategories($this);
}
return $this;
}
public function removeAlerte(Alertes $alerte): self
{
if ($this->alertes->removeElement($alerte)) {
// set the owning side to null (unless already changed)
if ($alerte->getCategories() === $this) {
$alerte->setCategories(null);
}
}
return $this;
}
}