<?php
namespace App\Entity;
use App\Repository\LangueRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LangueRepository::class)]
class Langue
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $langue = null;
#[ORM\OneToMany(mappedBy: 'Langue', targetEntity: Membre::class)]
private Collection $membres;
public function __construct()
{
$this->membres = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLangue(): ?string
{
return $this->langue;
}
public function setLangue(string $langue): self
{
$this->langue = $langue;
return $this;
}
public function __toString(): string
{
return $this->getLangue();
}
/**
* @return Collection<int, Membre>
*/
public function getMembres(): Collection
{
return $this->membres;
}
public function addMembre(Membre $membre): self
{
if (!$this->membres->contains($membre)) {
$this->membres->add($membre);
$membre->setLangue($this);
}
return $this;
}
public function removeMembre(Membre $membre): self
{
if ($this->membres->removeElement($membre)) {
// set the owning side to null (unless already changed)
if ($membre->getLangue() === $this) {
$membre->setLangue(null);
}
}
return $this;
}
}