src/Entity/User.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=UserRepository::class)
  9.  */
  10. class User
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nom;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Service::class, mappedBy="user")
  24.      */
  25.     private $services;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $email;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $phone;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $raison;
  38.     public function __construct()
  39.     {
  40.         $this->services = new ArrayCollection();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getNom(): ?string
  47.     {
  48.         return $this->nom;
  49.     }
  50.     public function setNom(string $nom): self
  51.     {
  52.         $this->nom $nom;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, Service>
  57.      */
  58.     public function getServices(): Collection
  59.     {
  60.         return $this->services;
  61.     }
  62.     public function addService(Service $service): self
  63.     {
  64.         if (!$this->services->contains($service)) {
  65.             $this->services[] = $service;
  66.             $service->setUser($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeService(Service $service): self
  71.     {
  72.         if ($this->services->removeElement($service)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($service->getUser() === $this) {
  75.                 $service->setUser(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function getEmail(): ?string
  81.     {
  82.         return $this->email;
  83.     }
  84.     public function setEmail(string $email): self
  85.     {
  86.         $this->email $email;
  87.         return $this;
  88.     }
  89.     public function getPhone(): ?string
  90.     {
  91.         return $this->phone;
  92.     }
  93.     public function setPhone(string $phone): self
  94.     {
  95.         $this->phone $phone;
  96.         return $this;
  97.     }
  98.     public function getRaison(): ?string
  99.     {
  100.         return $this->raison;
  101.     }
  102.     public function setRaison(string $raison): self
  103.     {
  104.         $this->raison $raison;
  105.         return $this;
  106.     }
  107. }