<?php
namespace App\Entity;
use App\Repository\Icd10CauseSubGroupRepository;
use Doctrine\Common\Collections\{ ArrayCollection, Collection };
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: Icd10CauseSubGroupRepository::class), ORM\Table(name: 'icd10_cause_sub_groups')]
class Icd10CauseSubGroup implements \Stringable
{
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\OneToMany(targetEntity: Icd10Disease::class, mappedBy: 'causeSubGroup')]
private $icd10Diseases;
#[ORM\ManyToOne(targetEntity: Icd10CauseGroup::class, inversedBy: 'icd10CauseSubGroups')]
#[ORM\JoinColumn(name: 'cause_group_id', nullable: false)]
private $causeGroup;
public function __construct()
{
$this->icd10Diseases = new ArrayCollection();
}
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 getCauseGroup(): ?Icd10CauseGroup
{
return $this->causeGroup;
}
public function setCauseGroup(?Icd10CauseGroup $causeGroup): self
{
$this->causeGroup = $causeGroup;
return $this;
}
/**
* @return Collection|Icd10Disease[]
*/
public function getIcd10Diseases(): Collection
{
return $this->icd10Diseases;
}
public function addIcd10Disease(Icd10Disease $icd10Disease): self
{
if (!$this->icd10Diseases->contains($icd10Disease)) {
$this->icd10Diseases[] = $icd10Disease;
$icd10Disease->setCauseSubGroup($this);
}
return $this;
}
public function removeIcd10Disease(Icd10Disease $icd10Disease): self
{
if ($this->icd10Diseases->contains($icd10Disease)) {
$this->icd10Diseases->removeElement($icd10Disease);
if ($icd10Disease->getCauseSubGroup() === $this) {
$icd10Disease->setCauseSubGroup(null);
}
}
return $this;
}
public function __toString(): string
{
return (string) $this->getName();
}
}