src/Entity/TypeAdherent.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TypeAdherentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassTypeAdherentRepository::class)]
  8. #[ORM\Table(name'type_adherents')]
  9. class TypeAdherent
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue(strategy'AUTO')]
  13.     #[ORM\Column(type'integer'options: ['unsigned' => true])]
  14.     private ?int $id null;
  15.     #[ORM\Column]
  16.     private ?int $niveau null;
  17.     #[ORM\Column(length50)]
  18.     private ?string $intitule null;
  19.     #[ORM\OneToMany(mappedBy'typeAdherent'targetEntityUser::class)]
  20.     private Collection $users;
  21.     public function __toString(): string
  22.     {
  23.         return $this->intitule;
  24.     }
  25.     public function __construct()
  26.     {
  27.         $this->users = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getNiveau(): ?int
  34.     {
  35.         return $this->niveau;
  36.     }
  37.     public function setNiveau(int $niveau): void
  38.     {
  39.         $this->niveau $niveau;
  40.     }
  41.     public function getIntitule(): ?string
  42.     {
  43.         return $this->intitule;
  44.     }
  45.     public function setIntitule(string $intitule): void
  46.     {
  47.         $this->intitule $intitule;
  48.     }
  49.     /**
  50.      * @return Collection<int, User>
  51.      */
  52.     public function getUsers(): Collection
  53.     {
  54.         return $this->users;
  55.     }
  56.     public function addUser(User $user): void
  57.     {
  58.         if (!$this->users->contains($user)) {
  59.             $this->users->add($user);
  60.             $user->setTypeAdherent($this);
  61.         }
  62.     }
  63.     public function removeUser(User $user): void
  64.     {
  65.         if ($this->users->removeElement($user)) {
  66.             // set the owning side to null (unless already changed)
  67.             if ($user->getTypeAdherent() === $this) {
  68.                 $user->setTypeAdherent(null);
  69.             }
  70.         }
  71.     }
  72. }