<?php
namespace App\Entity;
use App\Repository\NomActiviteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: NomActiviteRepository::class)]
class NomActivite
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\OneToMany(mappedBy: 'nomactivite', targetEntity: Activite::class)]
private Collection $activites;
public function __construct()
{
$this->activites = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Activite>
*/
public function getActivites(): Collection
{
return $this->activites;
}
public function addActivite(Activite $activite): self
{
if (!$this->activites->contains($activite)) {
$this->activites->add($activite);
$activite->setNomactivite($this);
}
return $this;
}
public function removeActivite(Activite $activite): self
{
if ($this->activites->removeElement($activite)) {
// set the owning side to null (unless already changed)
if ($activite->getNomactivite() === $this) {
$activite->setNomactivite(null);
}
}
return $this;
}
public function __toString(): string
{
return $this->getNom();
}
}