src/Entity/Group.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GroupRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=GroupRepository::class)
  9.  * @ORM\Table(name="`group`")
  10.  */
  11. class Group
  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, nullable=true)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="integer", nullable=true)
  25.      */
  26.     private $year;
  27.     /**
  28.      * @ORM\Column(type="string", length=10, nullable=true)
  29.      */
  30.     private $code;
  31.     /**
  32.      * @ORM\Column(type="string", length=500, nullable=true)
  33.      */
  34.     private $member_list;
  35.     /**
  36.      * @ORM\Column(type="text", nullable=true)
  37.      */
  38.     private $observations;
  39.     /**
  40.      * @ORM\Column(type="text", nullable=true)
  41.      */
  42.     private $address;
  43.     /**
  44.      * @ORM\Column(type="string", length=100, nullable=true)
  45.      */
  46.     private $email;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=GroupUser::class, mappedBy="group_id", orphanRemoval=true, fetch="EAGER")
  49.      */
  50.     private $groupUsers;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="coordinator_groups")
  53.      */
  54.     private $coordinator;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=Project::class, mappedBy="owner_group")
  57.      */
  58.     private $group_projects;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=Location::class, mappedBy="owner_group", fetch="EAGER")
  61.      */
  62.     private $locations;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=Supralocation::class, mappedBy="owner_group")
  65.      */
  66.     private $supralocations;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=CustomFieldConfig::class, mappedBy="owner_group")
  69.      */
  70.     private $customFieldConfigs;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity=Institution::class, inversedBy="groups")
  73.      */
  74.     private $institution;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=Register::class, mappedBy="owner_group")
  77.      */
  78.     private $registers;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity=Ring::class, mappedBy="owner_group")
  81.      */
  82.     private $rings;
  83.     public function __construct()
  84.     {
  85.         $this->groupUsers = new ArrayCollection();
  86.         $this->group_projects = new ArrayCollection();
  87.         $this->locations = new ArrayCollection();
  88.         $this->supralocations = new ArrayCollection();
  89.         $this->customFieldConfigs = new ArrayCollection();
  90.         $this->registers = new ArrayCollection();
  91.         $this->rings = new ArrayCollection();
  92.     }
  93.     public function __toString()
  94.     {
  95.         return "[" $this->code "] " $this->name;
  96.     }
  97.     public function getId(): ?int
  98.     {
  99.         return $this->id;
  100.     }
  101.     public function getName(): ?string
  102.     {
  103.         return $this->name;
  104.     }
  105.     public function setName(?string $name): self
  106.     {
  107.         $this->name $name;
  108.         return $this;
  109.     }
  110.     public function getYear(): ?int
  111.     {
  112.         return $this->year;
  113.     }
  114.     public function setYear(?int $year): self
  115.     {
  116.         $this->year $year;
  117.         return $this;
  118.     }
  119.     public function getCode(): ?string
  120.     {
  121.         return $this->code;
  122.     }
  123.     public function setCode(?string $code): self
  124.     {
  125.         $this->code $code;
  126.         return $this;
  127.     }
  128.     public function getMemberList(): ?string
  129.     {
  130.         return $this->member_list;
  131.     }
  132.     public function setMemberList(?string $member_list): self
  133.     {
  134.         $this->member_list $member_list;
  135.         return $this;
  136.     }
  137.     public function getObservations(): ?string
  138.     {
  139.         return $this->observations;
  140.     }
  141.     public function setObservations(?string $observations): self
  142.     {
  143.         $this->observations $observations;
  144.         return $this;
  145.     }
  146.     public function getAddress(): ?string
  147.     {
  148.         return $this->address;
  149.     }
  150.     public function setAddress(?string $address): self
  151.     {
  152.         $this->address $address;
  153.         return $this;
  154.     }
  155.     public function getEmail(): ?string
  156.     {
  157.         return $this->email;
  158.     }
  159.     public function setEmail(?string $email): self
  160.     {
  161.         $this->email $email;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return Collection<int, GroupUser>
  166.      */
  167.     public function getGroupUsers(): Collection
  168.     {
  169.         return $this->groupUsers;
  170.     }
  171.     public function addGroupUser(GroupUser $groupUser): self
  172.     {
  173.         if (!$this->groupUsers->contains($groupUser)) {
  174.             $this->groupUsers[] = $groupUser;
  175.             $groupUser->setGroupId($this);
  176.         }
  177.         return $this;
  178.     }
  179.     public function removeGroupUser(GroupUser $groupUser): self
  180.     {
  181.         if ($this->groupUsers->removeElement($groupUser)) {
  182.             // set the owning side to null (unless already changed)
  183.             if ($groupUser->getGroupId() === $this) {
  184.                 $groupUser->setGroupId(null);
  185.             }
  186.         }
  187.         return $this;
  188.     }
  189.     public function getCoordinator(): ?User
  190.     {
  191.         return $this->coordinator;
  192.     }
  193.     public function setCoordinator(?User $coordinator): self
  194.     {
  195.         $this->coordinator $coordinator;
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection<int, Project>
  200.      */
  201.     public function getGroupProjects(): Collection
  202.     {
  203.         return $this->group_projects;
  204.     }
  205.     public function addGroupProject(Project $groupProject): self
  206.     {
  207.         if (!$this->group_projects->contains($groupProject)) {
  208.             $this->group_projects[] = $groupProject;
  209.             $groupProject->setOwnerGroup($this);
  210.         }
  211.         return $this;
  212.     }
  213.     public function removeGroupProject(Project $groupProject): self
  214.     {
  215.         if ($this->group_projects->removeElement($groupProject)) {
  216.             // set the owning side to null (unless already changed)
  217.             if ($groupProject->getOwnerGroup() === $this) {
  218.                 $groupProject->setOwnerGroup(null);
  219.             }
  220.         }
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return Collection<int, Location>
  225.      */
  226.     public function getLocations(): Collection
  227.     {
  228.         return $this->locations;
  229.     }
  230.     public function addLocation(Location $location): self
  231.     {
  232.         if (!$this->locations->contains($location)) {
  233.             $this->locations[] = $location;
  234.             $location->setOwnerGroup($this);
  235.         }
  236.         return $this;
  237.     }
  238.     public function removeLocation(Location $location): self
  239.     {
  240.         if ($this->locations->removeElement($location)) {
  241.             // set the owning side to null (unless already changed)
  242.             if ($location->getOwnerGroup() === $this) {
  243.                 $location->setOwnerGroup(null);
  244.             }
  245.         }
  246.         return $this;
  247.     }
  248.     /**
  249.      * @return Collection<int, Supralocation>
  250.      */
  251.     public function getSupralocations(): Collection
  252.     {
  253.         return $this->supralocations;
  254.     }
  255.     public function addSupralocation(Supralocation $supralocation): self
  256.     {
  257.         if (!$this->supralocations->contains($supralocation)) {
  258.             $this->supralocations[] = $supralocation;
  259.             $supralocation->setOwnerGroup($this);
  260.         }
  261.         return $this;
  262.     }
  263.     public function removeSupralocation(Supralocation $supralocation): self
  264.     {
  265.         if ($this->supralocations->removeElement($supralocation)) {
  266.             // set the owning side to null (unless already changed)
  267.             if ($supralocation->getOwnerGroup() === $this) {
  268.                 $supralocation->setOwnerGroup(null);
  269.             }
  270.         }
  271.         return $this;
  272.     }
  273.     /**
  274.      * @return Collection<int, CustomFieldConfig>
  275.      */
  276.     public function getCustomFieldConfigs(): Collection
  277.     {
  278.         return $this->customFieldConfigs;
  279.     }
  280.     public function addCustomFieldConfig(CustomFieldConfig $customFieldConfig): self
  281.     {
  282.         if (!$this->customFieldConfigs->contains($customFieldConfig)) {
  283.             $this->customFieldConfigs[] = $customFieldConfig;
  284.             $customFieldConfig->setOwnerGroup($this);
  285.         }
  286.         return $this;
  287.     }
  288.     public function removeCustomFieldConfig(CustomFieldConfig $customFieldConfig): self
  289.     {
  290.         if ($this->customFieldConfigs->removeElement($customFieldConfig)) {
  291.             // set the owning side to null (unless already changed)
  292.             if ($customFieldConfig->getOwnerGroup() === $this) {
  293.                 $customFieldConfig->setOwnerGroup(null);
  294.             }
  295.         }
  296.         return $this;
  297.     }
  298.     public function getInstitution(): ?Institution
  299.     {
  300.         return $this->institution;
  301.     }
  302.     public function setInstitution(?Institution $institution): self
  303.     {
  304.         $this->institution $institution;
  305.         return $this;
  306.     }
  307.     /**
  308.      * @return Collection<int, Register>
  309.      */
  310.     public function getRegisters(): Collection
  311.     {
  312.         return $this->registers;
  313.     }
  314.     public function addRegister(Register $register): self
  315.     {
  316.         if (!$this->registers->contains($register)) {
  317.             $this->registers[] = $register;
  318.             $register->setOwnerGroup($this);
  319.         }
  320.         return $this;
  321.     }
  322.     public function removeRegister(Register $register): self
  323.     {
  324.         if ($this->registers->removeElement($register)) {
  325.             // set the owning side to null (unless already changed)
  326.             if ($register->getOwnerGroup() === $this) {
  327.                 $register->setOwnerGroup(null);
  328.             }
  329.         }
  330.         return $this;
  331.     }
  332.     /**
  333.      * @return Collection<int, Ring>
  334.      */
  335.     public function getRings(): Collection
  336.     {
  337.         return $this->rings;
  338.     }
  339.     public function addRing(Ring $ring): self
  340.     {
  341.         if (!$this->rings->contains($ring)) {
  342.             $this->rings[] = $ring;
  343.             $ring->setOwnerGroup($this);
  344.         }
  345.         return $this;
  346.     }
  347.     public function removeRing(Ring $ring): self
  348.     {
  349.         if ($this->rings->removeElement($ring)) {
  350.             // set the owning side to null (unless already changed)
  351.             if ($ring->getOwnerGroup() === $this) {
  352.                 $ring->setOwnerGroup(null);
  353.             }
  354.         }
  355.         return $this;
  356.     }
  357. }