src/Entity/StatutUser.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\StatutUserRepository")
  8.  */
  9. class StatutUser
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $statutUser;
  21.     /**
  22.      * @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="statut")
  23.      */
  24.     private $users;
  25.    
  26.     public function __construct()
  27.     {
  28.         $this->users = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getStatutUser(): ?string
  35.     {
  36.         return $this->statutUser;
  37.     }
  38.     public function setStatutUser(string $statutUser): self
  39.     {
  40.         $this->statutUser $statutUser;
  41.         return $this;
  42.     }
  43.     /**
  44.      * @return Collection|User[]
  45.      */
  46.     public function getUsers(): Collection
  47.     {
  48.         return $this->users;
  49.     }
  50.     public function addUser(User $user): self
  51.     {
  52.         if (!$this->users->contains($user)) {
  53.             $this->users[] = $user;
  54.             $user->setStatut($this);
  55.         }
  56.         return $this;
  57.     }
  58.     public function removeUser(User $user): self
  59.     {
  60.         if ($this->users->contains($user)) {
  61.             $this->users->removeElement($user);
  62.             // set the owning side to null (unless already changed)
  63.             if ($user->getStatut() === $this) {
  64.                 $user->setStatut(null);
  65.             }
  66.         }
  67.         return $this;
  68.     }
  69.    
  70. }