<?php
namespace App\Entity;
use App\Repository\GroupRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=GroupRepository::class)
* @ORM\Table(name="`group`")
*/
class Group
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $year;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $member_list;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $observations;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $email;
/**
* @ORM\OneToMany(targetEntity=GroupUser::class, mappedBy="group_id", orphanRemoval=true, fetch="EAGER")
*/
private $groupUsers;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="coordinator_groups")
*/
private $coordinator;
/**
* @ORM\OneToMany(targetEntity=Project::class, mappedBy="owner_group")
*/
private $group_projects;
/**
* @ORM\OneToMany(targetEntity=Location::class, mappedBy="owner_group", fetch="EAGER")
*/
private $locations;
/**
* @ORM\OneToMany(targetEntity=Supralocation::class, mappedBy="owner_group")
*/
private $supralocations;
/**
* @ORM\OneToMany(targetEntity=CustomFieldConfig::class, mappedBy="owner_group")
*/
private $customFieldConfigs;
/**
* @ORM\ManyToOne(targetEntity=Institution::class, inversedBy="groups")
*/
private $institution;
/**
* @ORM\OneToMany(targetEntity=Register::class, mappedBy="owner_group")
*/
private $registers;
/**
* @ORM\OneToMany(targetEntity=Ring::class, mappedBy="owner_group")
*/
private $rings;
public function __construct()
{
$this->groupUsers = new ArrayCollection();
$this->group_projects = new ArrayCollection();
$this->locations = new ArrayCollection();
$this->supralocations = new ArrayCollection();
$this->customFieldConfigs = new ArrayCollection();
$this->registers = new ArrayCollection();
$this->rings = new ArrayCollection();
}
public function __toString()
{
return "[" . $this->code . "] " . $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): self
{
$this->year = $year;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getMemberList(): ?string
{
return $this->member_list;
}
public function setMemberList(?string $member_list): self
{
$this->member_list = $member_list;
return $this;
}
public function getObservations(): ?string
{
return $this->observations;
}
public function setObservations(?string $observations): self
{
$this->observations = $observations;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return Collection<int, GroupUser>
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}
public function addGroupUser(GroupUser $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->setGroupId($this);
}
return $this;
}
public function removeGroupUser(GroupUser $groupUser): self
{
if ($this->groupUsers->removeElement($groupUser)) {
// set the owning side to null (unless already changed)
if ($groupUser->getGroupId() === $this) {
$groupUser->setGroupId(null);
}
}
return $this;
}
public function getCoordinator(): ?User
{
return $this->coordinator;
}
public function setCoordinator(?User $coordinator): self
{
$this->coordinator = $coordinator;
return $this;
}
/**
* @return Collection<int, Project>
*/
public function getGroupProjects(): Collection
{
return $this->group_projects;
}
public function addGroupProject(Project $groupProject): self
{
if (!$this->group_projects->contains($groupProject)) {
$this->group_projects[] = $groupProject;
$groupProject->setOwnerGroup($this);
}
return $this;
}
public function removeGroupProject(Project $groupProject): self
{
if ($this->group_projects->removeElement($groupProject)) {
// set the owning side to null (unless already changed)
if ($groupProject->getOwnerGroup() === $this) {
$groupProject->setOwnerGroup(null);
}
}
return $this;
}
/**
* @return Collection<int, Location>
*/
public function getLocations(): Collection
{
return $this->locations;
}
public function addLocation(Location $location): self
{
if (!$this->locations->contains($location)) {
$this->locations[] = $location;
$location->setOwnerGroup($this);
}
return $this;
}
public function removeLocation(Location $location): self
{
if ($this->locations->removeElement($location)) {
// set the owning side to null (unless already changed)
if ($location->getOwnerGroup() === $this) {
$location->setOwnerGroup(null);
}
}
return $this;
}
/**
* @return Collection<int, Supralocation>
*/
public function getSupralocations(): Collection
{
return $this->supralocations;
}
public function addSupralocation(Supralocation $supralocation): self
{
if (!$this->supralocations->contains($supralocation)) {
$this->supralocations[] = $supralocation;
$supralocation->setOwnerGroup($this);
}
return $this;
}
public function removeSupralocation(Supralocation $supralocation): self
{
if ($this->supralocations->removeElement($supralocation)) {
// set the owning side to null (unless already changed)
if ($supralocation->getOwnerGroup() === $this) {
$supralocation->setOwnerGroup(null);
}
}
return $this;
}
/**
* @return Collection<int, CustomFieldConfig>
*/
public function getCustomFieldConfigs(): Collection
{
return $this->customFieldConfigs;
}
public function addCustomFieldConfig(CustomFieldConfig $customFieldConfig): self
{
if (!$this->customFieldConfigs->contains($customFieldConfig)) {
$this->customFieldConfigs[] = $customFieldConfig;
$customFieldConfig->setOwnerGroup($this);
}
return $this;
}
public function removeCustomFieldConfig(CustomFieldConfig $customFieldConfig): self
{
if ($this->customFieldConfigs->removeElement($customFieldConfig)) {
// set the owning side to null (unless already changed)
if ($customFieldConfig->getOwnerGroup() === $this) {
$customFieldConfig->setOwnerGroup(null);
}
}
return $this;
}
public function getInstitution(): ?Institution
{
return $this->institution;
}
public function setInstitution(?Institution $institution): self
{
$this->institution = $institution;
return $this;
}
/**
* @return Collection<int, Register>
*/
public function getRegisters(): Collection
{
return $this->registers;
}
public function addRegister(Register $register): self
{
if (!$this->registers->contains($register)) {
$this->registers[] = $register;
$register->setOwnerGroup($this);
}
return $this;
}
public function removeRegister(Register $register): self
{
if ($this->registers->removeElement($register)) {
// set the owning side to null (unless already changed)
if ($register->getOwnerGroup() === $this) {
$register->setOwnerGroup(null);
}
}
return $this;
}
/**
* @return Collection<int, Ring>
*/
public function getRings(): Collection
{
return $this->rings;
}
public function addRing(Ring $ring): self
{
if (!$this->rings->contains($ring)) {
$this->rings[] = $ring;
$ring->setOwnerGroup($this);
}
return $this;
}
public function removeRing(Ring $ring): self
{
if ($this->rings->removeElement($ring)) {
// set the owning side to null (unless already changed)
if ($ring->getOwnerGroup() === $this) {
$ring->setOwnerGroup(null);
}
}
return $this;
}
}