src/Entity/Gos/CooperatorGroup.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\Cooperator;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\CooperatorGroupRepository")
  9.  */
  10. class CooperatorGroup
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Uniqskills\Cooperator", inversedBy="cooperatorGroups")
  24.      */
  25.     private $cooperator;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Term", mappedBy="cooperatorGroup")
  28.      */
  29.     private $terms;
  30.     public function __construct()
  31.     {
  32.         $this->cooperator = new ArrayCollection();
  33.         $this->terms = new ArrayCollection();
  34.     }
  35.     public function __toString()
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection|Cooperator[]
  54.      */
  55.     public function getCooperator(): Collection
  56.     {
  57.         return $this->cooperator;
  58.     }
  59.     public function addCooperator(Cooperator $cooperator): self
  60.     {
  61.         if (!$this->cooperator->contains($cooperator)) {
  62.             $this->cooperator[] = $cooperator;
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeCooperator(Cooperator $cooperator): self
  67.     {
  68.         if ($this->cooperator->contains($cooperator)) {
  69.             $this->cooperator->removeElement($cooperator);
  70.         }
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return Collection|Term[]
  75.      */
  76.     public function getTerms(): Collection
  77.     {
  78.         return $this->terms;
  79.     }
  80.     public function addTerm(Term $term): self
  81.     {
  82.         if (!$this->terms->contains($term)) {
  83.             $this->terms[] = $term;
  84.             $term->setCooperatorGroup($this);
  85.         }
  86.         return $this;
  87.     }
  88.     public function removeTerm(Term $term): self
  89.     {
  90.         if ($this->terms->contains($term)) {
  91.             $this->terms->removeElement($term);
  92.             // set the owning side to null (unless already changed)
  93.             if ($term->getCooperatorGroup() === $this) {
  94.                 $term->setCooperatorGroup(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99. }