src/Entity/Prescriber/Prescriber.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Prescriber;
  3. use App\Entity\ProspectOnStore;
  4. use App\Entity\User;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use App\Repository\Prescriber\PrescriberRepository;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=PrescriberRepository::class)
  11.  */
  12. class Prescriber
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private string $name;
  24.     /**
  25.      * @ORM\OneToOne(targetEntity=User::class, inversedBy="prescriber", cascade={"persist", "remove"})
  26.      * @ORM\JoinColumn(nullable=false)
  27.      */
  28.     private User $user;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity=ProspectOnStore::class, mappedBy="prescriber")
  31.      */
  32.     private Collection $prospectsOnStore;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity=PrescriberRemuneration::class, mappedBy="prescriber", orphanRemoval=true)
  35.      */
  36.     private Collection $remunerations;
  37.     public function __construct()
  38.     {
  39.         $this->prospectsOnStore = new ArrayCollection();
  40.         $this->remunerations = new ArrayCollection();
  41.     }
  42.     public function getLabel(): string
  43.     {
  44.         return 'Prescriber #'.$this->id;
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getUser(): ?User
  51.     {
  52.         return $this->user;
  53.     }
  54.     public function setUser(User $user): self
  55.     {
  56.         $this->user $user;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, ProspectOnStore>
  61.      */
  62.     public function getProspectsOnStore(): Collection
  63.     {
  64.         return $this->prospectsOnStore;
  65.     }
  66.     public function addProspectsOnStore(ProspectOnStore $prospectsOnStore): self
  67.     {
  68.         if (!$this->prospectsOnStore->contains($prospectsOnStore)) {
  69.             $this->prospectsOnStore[] = $prospectsOnStore;
  70.             $prospectsOnStore->setPrescriber($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeProspectsOnStore(ProspectOnStore $prospectsOnStore): self
  75.     {
  76.         if ($this->prospectsOnStore->removeElement($prospectsOnStore)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($prospectsOnStore->getPrescriber() === $this) {
  79.                 $prospectsOnStore->setPrescriber(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return mixed
  86.      */
  87.     public function getName()
  88.     {
  89.         return $this->name;
  90.     }
  91.     /**
  92.      * @param mixed $name
  93.      */
  94.     public function setName($name): void
  95.     {
  96.         $this->name $name;
  97.     }
  98.     /**
  99.      * @return Collection<int, PrescriberRemuneration>
  100.      */
  101.     public function getRemunerations(): Collection
  102.     {
  103.         return $this->remunerations;
  104.     }
  105.     public function addRemuneration(PrescriberRemuneration $prescriberRemuneration): self
  106.     {
  107.         if (!$this->remunerations->contains($prescriberRemuneration)) {
  108.             $this->remunerations[] = $prescriberRemuneration;
  109.             $prescriberRemuneration->setPrescriber($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeRemuneration(PrescriberRemuneration $prescriberRemuneration): self
  114.     {
  115.         if ($this->remunerations->removeElement($prescriberRemuneration)) {
  116.             // set the owning side to null (unless already changed)
  117.             if ($prescriberRemuneration->getPrescriber() === $this) {
  118.                 $prescriberRemuneration->setPrescriber(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123. }