src/Entity/Person.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Person\Referrer;
  4. use App\Entity\Special\VotingInfo;
  5. use App\Repository\PersonRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=PersonRepository::class)
  11.  */
  12. class Person
  13. {
  14.     const COORDINATOR 'coordinator';
  15.     const OPERATOR 'operator';
  16.     const PROMOTER 'promoter';
  17.     const PROMOTED 'promoted';
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private $fullName;
  28.     /**
  29.      * @ORM\Column(type="string", length=1024)
  30.      */
  31.     private $address;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, unique=true, name="person_key")
  34.      */
  35.     private $key;
  36.     /**
  37.      * @ORM\Column(type="string", length=255)
  38.      */
  39.     private $number;
  40.     /**
  41.      * @ORM\Column(type="string", length=255)
  42.      */
  43.     private $cellPhone;
  44.     /**
  45.      * @ORM\ManyToMany(targetEntity=HelpProgram::class, mappedBy="persons")
  46.      */
  47.     private $helpPrograms;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=PersonLog::class, mappedBy="person")
  50.      */
  51.     private $personLogs;
  52.     /**
  53.      * @ORM\Column(type="string", length=255)
  54.      */
  55.     private $classification;
  56.     /**
  57.      * @ORM\Column(type="text", nullable=true)
  58.      */
  59.     private $observations;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="persons")
  62.      * @ORM\JoinColumn(nullable=false)
  63.      */
  64.     private $captureUser;
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity=Section::class, inversedBy="persons")
  67.      * @ORM\JoinColumn(nullable=false)
  68.      */
  69.     private $section;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="people")
  72.      */
  73.     private $parent;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity=Person::class, mappedBy="parent")
  76.      */
  77.     private $people;
  78.     /**
  79.      * @ORM\ManyToOne(targetEntity=ExternalDataBase::class, inversedBy="people")
  80.      */
  81.     private $externalDB;
  82.     /**
  83.      * @ORM\Column(type="integer", nullable=true)
  84.      */
  85.     private $committedPeople;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $votingBooth;
  90.     /**
  91.      * @ORM\ManyToOne(targetEntity=Suburb::class, inversedBy="people")
  92.      */
  93.     private $subUrb;
  94.     /**
  95.      * @ORM\ManyToOne(targetEntity=VotingBooth::class, inversedBy="persons")
  96.      */
  97.     private $vBooth;
  98.     /**
  99.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="coordinators")
  100.      */
  101.     private $specialUser;
  102.     /**
  103.      * @ORM\ManyToOne(targetEntity=CuttingSchedule::class, inversedBy="persons")
  104.      */
  105.     private $cuttingSchedule;
  106.     /**
  107.      * @ORM\OneToMany(targetEntity=VotingInfo::class, mappedBy="person")
  108.      */
  109.     private $votingInfos;
  110.     /**
  111.      * @ORM\Column(type="boolean")
  112.      */
  113.     private $verified;
  114.     /**
  115.      * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="linkPeople")
  116.      */
  117.     private $parentLink;
  118.     /**
  119.      * @ORM\OneToMany(targetEntity=Person::class, mappedBy="parentLink")
  120.      */
  121.     private $linkPeople;
  122.     /**
  123.      * @ORM\Column(type="boolean", nullable=true)
  124.      */
  125.     private $personVoted;
  126.     /**
  127.      * @ORM\ManyToOne(targetEntity=Referrer::class, inversedBy="referrals")
  128.      */
  129.     private $referrer;
  130.     public function __construct()
  131.     {
  132.         $this->helpPrograms = new ArrayCollection();
  133.         $this->personLogs = new ArrayCollection();
  134.         $this->people = new ArrayCollection();
  135.         $this->votingInfos = new ArrayCollection();
  136.         $this->linkPeople = new ArrayCollection();
  137.     }
  138.     public function getId(): ?int
  139.     {
  140.         return $this->id;
  141.     }
  142.     public function getFullName(): ?string
  143.     {
  144.         return $this->fullName;
  145.     }
  146.     public function setFullName(string $fullName): self
  147.     {
  148.         $this->fullName $fullName;
  149.         return $this;
  150.     }
  151.     public function getAddress(): ?string
  152.     {
  153.         return $this->address;
  154.     }
  155.     public function setAddress(string $address): self
  156.     {
  157.         $this->address $address;
  158.         return $this;
  159.     }
  160.     public function getKey(): ?string
  161.     {
  162.         return $this->key;
  163.     }
  164.     public function setKey(string $key): self
  165.     {
  166.         $this->key $key;
  167.         return $this;
  168.     }
  169.     public function getNumber(): ?string
  170.     {
  171.         return $this->number;
  172.     }
  173.     public function setNumber(string $number): self
  174.     {
  175.         $this->number $number;
  176.         return $this;
  177.     }
  178.     public function getCellPhone(): ?string
  179.     {
  180.         return $this->cellPhone;
  181.     }
  182.     public function setCellPhone(string $cellPhone): self
  183.     {
  184.         $this->cellPhone $cellPhone;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return Collection<int, HelpProgram>
  189.      */
  190.     public function getHelpPrograms(): Collection
  191.     {
  192.         return $this->helpPrograms;
  193.     }
  194.     public function addHelpProgram(HelpProgram $helpProgram): self
  195.     {
  196.         if (!$this->helpPrograms->contains($helpProgram)) {
  197.             $this->helpPrograms[] = $helpProgram;
  198.             $helpProgram->addPerson($this);
  199.         }
  200.         return $this;
  201.     }
  202.     public function removeHelpProgram(HelpProgram $helpProgram): self
  203.     {
  204.         if ($this->helpPrograms->removeElement($helpProgram)) {
  205.             $helpProgram->removePerson($this);
  206.         }
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return Collection<int, PersonLog>
  211.      */
  212.     public function getPersonLogs(): Collection
  213.     {
  214.         return $this->personLogs;
  215.     }
  216.     public function addPersonLog(PersonLog $personLog): self
  217.     {
  218.         if (!$this->personLogs->contains($personLog)) {
  219.             $this->personLogs[] = $personLog;
  220.             $personLog->setPerson($this);
  221.         }
  222.         return $this;
  223.     }
  224.     public function removePersonLog(PersonLog $personLog): self
  225.     {
  226.         if ($this->personLogs->removeElement($personLog)) {
  227.             // set the owning side to null (unless already changed)
  228.             if ($personLog->getPerson() === $this) {
  229.                 $personLog->setPerson(null);
  230.             }
  231.         }
  232.         return $this;
  233.     }
  234.     public function getClassification(): ?string
  235.     {
  236.         return $this->classification;
  237.     }
  238.     public function setClassification(string $classification): self
  239.     {
  240.         $this->classification $classification;
  241.         return $this;
  242.     }
  243.     public function getObservations(): ?string
  244.     {
  245.         return $this->observations;
  246.     }
  247.     public function setObservations(?string $observations): self
  248.     {
  249.         $this->observations $observations;
  250.         return $this;
  251.     }
  252.     public function getCaptureUser(): ?User
  253.     {
  254.         return $this->captureUser;
  255.     }
  256.     public function setCaptureUser(?User $captureUser): self
  257.     {
  258.         $this->captureUser $captureUser;
  259.         return $this;
  260.     }
  261.     public function getSection(): ?Section
  262.     {
  263.         return $this->section;
  264.     }
  265.     public function setSection(?Section $section): self
  266.     {
  267.         $this->section $section;
  268.         return $this;
  269.     }
  270.     public function getParent(): ?self
  271.     {
  272.         return $this->parent;
  273.     }
  274.     public function getParentText(): string
  275.     {
  276.         $result '';
  277.         if ($this->getParent()) {
  278.             if ($this->classification == self::OPERATOR) {
  279.                 $result 'Coordinador: ' $this->getParent()->getFullName();
  280.             } elseif ($this->classification == self::PROMOTER) {
  281.                 $result 'Operador: ' $this->getParent()->getFullName();
  282.             } elseif ($this->classification == self::PROMOTED) {
  283.                 $result 'Promotor: ' $this->getParent()->getFullName();
  284.             }
  285.         }
  286.         return $result;
  287.     }
  288.     public function setParent(?self $parent): self
  289.     {
  290.         $this->parent $parent;
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection<int, self>
  295.      */
  296.     public function getPeople(): Collection
  297.     {
  298.         return $this->people;
  299.     }
  300.     public function addPerson(self $person): self
  301.     {
  302.         if (!$this->people->contains($person)) {
  303.             $this->people[] = $person;
  304.             $person->setParent($this);
  305.         }
  306.         return $this;
  307.     }
  308.     public function removePerson(self $person): self
  309.     {
  310.         if ($this->people->removeElement($person)) {
  311.             // set the owning side to null (unless already changed)
  312.             if ($person->getParent() === $this) {
  313.                 $person->setParent(null);
  314.             }
  315.         }
  316.         return $this;
  317.     }
  318.     public function getExternalDB(): ?ExternalDataBase
  319.     {
  320.         return $this->externalDB;
  321.     }
  322.     public function setExternalDB(?ExternalDataBase $externalDB): self
  323.     {
  324.         $this->externalDB $externalDB;
  325.         return $this;
  326.     }
  327.     public function getCommittedPeople(): ?int
  328.     {
  329.         return $this->committedPeople;
  330.     }
  331.     public function setCommittedPeople(?int $committedPeople): self
  332.     {
  333.         $this->committedPeople $committedPeople;
  334.         return $this;
  335.     }
  336.     public function getVotingBooth(): ?string
  337.     {
  338.         return $this->votingBooth;
  339.     }
  340.     public function setVotingBooth(?string $votingBooth): self
  341.     {
  342.         $this->votingBooth $votingBooth;
  343.         return $this;
  344.     }
  345.     public function getSubUrb(): ?Suburb
  346.     {
  347.         return $this->subUrb;
  348.     }
  349.     public function setSubUrb(?Suburb $subUrb): self
  350.     {
  351.         $this->subUrb $subUrb;
  352.         return $this;
  353.     }
  354.     public function getVBooth(): ?VotingBooth
  355.     {
  356.         return $this->vBooth;
  357.     }
  358.     public function setVBooth(?VotingBooth $vBooth): self
  359.     {
  360.         $this->vBooth $vBooth;
  361.         return $this;
  362.     }
  363.     public function getSpecialUser(): ?User
  364.     {
  365.         return $this->specialUser;
  366.     }
  367.     public function setSpecialUser(?User $specialUser): self
  368.     {
  369.         $this->specialUser $specialUser;
  370.         return $this;
  371.     }
  372.     public function getCuttingSchedule(): ?CuttingSchedule
  373.     {
  374.         return $this->cuttingSchedule;
  375.     }
  376.     public function setCuttingSchedule(?CuttingSchedule $cuttingSchedule): self
  377.     {
  378.         $this->cuttingSchedule $cuttingSchedule;
  379.         return $this;
  380.     }
  381.     /**
  382.      * @return Collection<int, VotingInfo>
  383.      */
  384.     public function getVotingInfos(): Collection
  385.     {
  386.         return $this->votingInfos;
  387.     }
  388.     public function addVotingInfo(VotingInfo $votingInfo): self
  389.     {
  390.         if (!$this->votingInfos->contains($votingInfo)) {
  391.             $this->votingInfos[] = $votingInfo;
  392.             $votingInfo->setPerson($this);
  393.         }
  394.         return $this;
  395.     }
  396.     public function removeVotingInfo(VotingInfo $votingInfo): self
  397.     {
  398.         if ($this->votingInfos->removeElement($votingInfo)) {
  399.             // set the owning side to null (unless already changed)
  400.             if ($votingInfo->getPerson() === $this) {
  401.                 $votingInfo->setPerson(null);
  402.             }
  403.         }
  404.         return $this;
  405.     }
  406.     public function isVerified(): ?bool
  407.     {
  408.         return $this->verified;
  409.     }
  410.     public function setVerified(bool $verified): self
  411.     {
  412.         $this->verified $verified;
  413.         return $this;
  414.     }
  415.     public function getParentLink(): ?self
  416.     {
  417.         return $this->parentLink;
  418.     }
  419.     public function setParentLink(?self $parentLink): self
  420.     {
  421.         $this->parentLink $parentLink;
  422.         return $this;
  423.     }
  424.     /**
  425.      * @return Collection<int, self>
  426.      */
  427.     public function getLinkPeople(): Collection
  428.     {
  429.         return $this->linkPeople;
  430.     }
  431.     public function addLinkPerson(self $linkPerson): self
  432.     {
  433.         if (!$this->linkPeople->contains($linkPerson)) {
  434.             $this->linkPeople[] = $linkPerson;
  435.             $linkPerson->setParentLink($this);
  436.         }
  437.         return $this;
  438.     }
  439.     public function removeLinkPerson(self $linkPerson): self
  440.     {
  441.         if ($this->linkPeople->removeElement($linkPerson)) {
  442.             // set the owning side to null (unless already changed)
  443.             if ($linkPerson->getParentLink() === $this) {
  444.                 $linkPerson->setParentLink(null);
  445.             }
  446.         }
  447.         return $this;
  448.     }
  449.     public function isPersonVoted(): ?bool
  450.     {
  451.         return $this->personVoted;
  452.     }
  453.     public function setPersonVoted(?bool $personVoted): self
  454.     {
  455.         $this->personVoted $personVoted;
  456.         return $this;
  457.     }
  458.     public function getReferrer(): ?Referrer
  459.     {
  460.         return $this->referrer;
  461.     }
  462.     public function setReferrer(?Referrer $referrer): self
  463.     {
  464.         $this->referrer $referrer;
  465.         return $this;
  466.     }
  467. }