src/Entity/CuttingSchedule.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Special\VotingInfo;
  4. use App\Repository\CuttingScheduleRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CuttingScheduleRepository::class)
  10.  */
  11. class CuttingSchedule
  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 $hour;
  23.     /**
  24.      * @ORM\OneToMany(targetEntity=Person::class, mappedBy="cuttingSchedule")
  25.      */
  26.     private $persons;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=VotingInfo::class, mappedBy="CuttingSchedule")
  29.      */
  30.     private $votingInfos;
  31.     public function __construct()
  32.     {
  33.         $this->persons = new ArrayCollection();
  34.         $this->votingInfos = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getHour(): ?string
  41.     {
  42.         return $this->hour;
  43.     }
  44.     public function setHour(string $hour): self
  45.     {
  46.         $this->hour $hour;
  47.         return $this;
  48.     }
  49.     /**
  50.      * @return Collection<int, Person>
  51.      */
  52.     public function getPersons(): Collection
  53.     {
  54.         return $this->persons;
  55.     }
  56.     public function addPerson(Person $person): self
  57.     {
  58.         if (!$this->persons->contains($person)) {
  59.             $this->persons[] = $person;
  60.             $person->setCuttingSchedule($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removePerson(Person $person): self
  65.     {
  66.         if ($this->persons->removeElement($person)) {
  67.             // set the owning side to null (unless already changed)
  68.             if ($person->getCuttingSchedule() === $this) {
  69.                 $person->setCuttingSchedule(null);
  70.             }
  71.         }
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection<int, VotingInfo>
  76.      */
  77.     public function getVotingInfos(): Collection
  78.     {
  79.         return $this->votingInfos;
  80.     }
  81.     public function addVotingInfo(VotingInfo $votingInfo): self
  82.     {
  83.         if (!$this->votingInfos->contains($votingInfo)) {
  84.             $this->votingInfos[] = $votingInfo;
  85.             $votingInfo->setCuttingSchedule($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeVotingInfo(VotingInfo $votingInfo): self
  90.     {
  91.         if ($this->votingInfos->removeElement($votingInfo)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($votingInfo->getCuttingSchedule() === $this) {
  94.                 $votingInfo->setCuttingSchedule(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99. }