<?php
namespace App\Entity;
use App\Repository\MetiersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MetiersRepository::class)]
class Metiers
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 50)]
private $libelle;
#[ORM\ManyToMany(targetEntity: Missions::class, mappedBy: 'metier')]
private $missions;
public function __construct()
{
$this->missions = 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, Missions>
*/
public function getMissions(): Collection
{
return $this->missions;
}
public function addMission(Missions $mission): self
{
if (!$this->missions->contains($mission)) {
$this->missions[] = $mission;
$mission->addMetier($this);
}
return $this;
}
public function removeMission(Missions $mission): self
{
if ($this->missions->removeElement($mission)) {
$mission->removeMetier($this);
}
return $this;
}
}