<?php
namespace App\Entity;
use App\Repository\TypeAdherentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TypeAdherentRepository::class)]
#[ORM\Table(name: 'type_adherents')]
class TypeAdherent
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
private ?int $id = null;
#[ORM\Column]
private ?int $niveau = null;
#[ORM\Column(length: 50)]
private ?string $intitule = null;
#[ORM\OneToMany(mappedBy: 'typeAdherent', targetEntity: User::class)]
private Collection $users;
public function __toString(): string
{
return $this->intitule;
}
public function __construct()
{
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNiveau(): ?int
{
return $this->niveau;
}
public function setNiveau(int $niveau): void
{
$this->niveau = $niveau;
}
public function getIntitule(): ?string
{
return $this->intitule;
}
public function setIntitule(string $intitule): void
{
$this->intitule = $intitule;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): void
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setTypeAdherent($this);
}
}
public function removeUser(User $user): void
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getTypeAdherent() === $this) {
$user->setTypeAdherent(null);
}
}
}
}