src/Entity/Person/Referrer.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Person;
  3. use App\Entity\Person;
  4. use App\Repository\Person\ReferrerRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ReferrerRepository::class)
  10.  */
  11. class Referrer
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $ineKey;
  23.     /**
  24.      * @ORM\Column(type="string", length=1024)
  25.      */
  26.     private $fullName;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=Person::class, mappedBy="referrer")
  29.      */
  30.     private $referrals;
  31.     public function __construct()
  32.     {
  33.         $this->referrals = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getIneKey(): ?string
  40.     {
  41.         return $this->ineKey;
  42.     }
  43.     public function setIneKey(string $ineKey): self
  44.     {
  45.         $this->ineKey $ineKey;
  46.         return $this;
  47.     }
  48.     public function getFullName(): ?string
  49.     {
  50.         return $this->fullName;
  51.     }
  52.     public function setFullName(string $fullName): self
  53.     {
  54.         $this->fullName $fullName;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection<int, Person>
  59.      */
  60.     public function getReferrals(): Collection
  61.     {
  62.         return $this->referrals;
  63.     }
  64.     public function addReferral(Person $referral): self
  65.     {
  66.         if (!$this->referrals->contains($referral)) {
  67.             $this->referrals[] = $referral;
  68.             $referral->setReferrer($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeReferral(Person $referral): self
  73.     {
  74.         if ($this->referrals->removeElement($referral)) {
  75.             // set the owning side to null (unless already changed)
  76.             if ($referral->getReferrer() === $this) {
  77.                 $referral->setReferrer(null);
  78.             }
  79.         }
  80.         return $this;
  81.     }
  82. }