src/Entity/Operator.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OperatorRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassOperatorRepository::class)]
  8. class Operator extends User
  9. {
  10.     #[ORM\OneToOne(targetEntityOperatorInfo::class, mappedBy'owner'cascade: ['persist''remove'])]
  11.     private $operatorInfo;
  12.     #[ORM\Column(type'boolean'nullabletrueoptions: ['default' => false])]
  13.     private $isMobile false;
  14.     #[ORM\OneToMany(targetEntityCoachInfo::class, mappedBy'createdByOperator')]
  15.     private Collection $createdCoachInfos;
  16.     #[ORM\OneToMany(targetEntityClubInfo::class, mappedBy'createdByOperator')]
  17.     private Collection $createdClubInfos;
  18.     #[ORM\OneToMany(targetEntityPartnership::class, mappedBy'operator')]
  19.     private $partnerships;
  20.     public function __construct()
  21.     {
  22.         parent::__construct();
  23.         $this->createdCoachInfos = new ArrayCollection();
  24.         $this->createdClubInfos = new ArrayCollection();
  25.         $this->partnerships = new ArrayCollection();
  26.     }
  27.     public function getOperatorInfo(): ?OperatorInfo
  28.     {
  29.         return $this->operatorInfo;
  30.     }
  31.     public function setOperatorInfo(OperatorInfo $operatorInfo): self
  32.     {
  33.         // set the owning side of the relation if necessary
  34.         if ($operatorInfo->getOwner() !== $this) {
  35.             $operatorInfo->setOwner($this);
  36.         }
  37.         $this->operatorInfo $operatorInfo;
  38.         return $this;
  39.     }
  40.     public function getIsMobile(): ?bool
  41.     {
  42.         return $this->isMobile;
  43.     }
  44.     public function setIsMobile(?bool $isMobile): self
  45.     {
  46.         $this->isMobile $isMobile;
  47.         return $this;
  48.     }
  49.     public function getCreatedCoachInfos(): Collection
  50.     {
  51.         return $this->createdCoachInfos;
  52.     }
  53.     public function addCreatedCoachInfo(CoachInfo $coachInfo): self
  54.     {
  55.         if (!$this->createdCoachInfos->contains($coachInfo)) {
  56.             $this->createdCoachInfos[] = $coachInfo;
  57.             $coachInfo->setCreatedByOperator($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removeCreatedCoachInfo(CoachInfo $coachInfo): self
  62.     {
  63.         if ($this->createdCoachInfos->removeElement($coachInfo)) {
  64.             if ($coachInfo->getCreatedByOperator() === $this) {
  65.                 $coachInfo->setCreatedByOperator(null);
  66.             }
  67.         }
  68.         return $this;
  69.     }
  70.     public function getCreatedClubInfos(): Collection
  71.     {
  72.         return $this->createdClubInfos;
  73.     }
  74.     public function addCreatedClubInfo(ClubInfo $clubInfo): self
  75.     {
  76.         if (!$this->createdClubInfos->contains($clubInfo)) {
  77.             $this->createdClubInfos[] = $clubInfo;
  78.             $clubInfo->setCreatedByOperator($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removeCreatedClubInfo(ClubInfo $clubInfo): self
  83.     {
  84.         if ($this->createdClubInfos->removeElement($clubInfo)) {
  85.             if ($clubInfo->getCreatedByOperator() === $this) {
  86.                 $clubInfo->setCreatedByOperator(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection|Partnership[]
  93.      */
  94.     public function getPartnerships(): Collection
  95.     {
  96.         return $this->partnerships;
  97.     }
  98.     public function addPartnership(Partnership $partnership): self
  99.     {
  100.         if (!$this->partnerships->contains($partnership)) {
  101.             $this->partnerships[] = $partnership;
  102.             $partnership->setOperator($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removePartnership(Partnership $partnership): self
  107.     {
  108.         if ($this->partnerships->removeElement($partnership)) {
  109.             // set the owning side to null (unless already changed)
  110.             if ($partnership->getOperator() === $this) {
  111.                 $partnership->setOperator(null);
  112.             }
  113.         }
  114.         return $this;
  115.     }
  116. }