src/Entity/Icd10CauseGroup.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\Icd10CauseGroupRepository;
  4. use Doctrine\Common\Collections\{ ArrayCollectionCollection };
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassIcd10CauseGroupRepository::class), ORM\Table(name'icd10_cause_groups')]
  7. class Icd10CauseGroup implements \Stringable
  8. {
  9.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  10.     private $id;
  11.     #[ORM\Column(type'string'length255)]
  12.     private $name;
  13.     #[ORM\OneToMany(targetEntityIcd10CauseSubGroup::class, mappedBy'causeGroup')]
  14.     private $icd10CauseSubGroups;
  15.     #[ORM\OneToMany(targetEntityIcd10Disease::class, mappedBy'causeGroup')]
  16.     private $icd10Diseases;
  17.     public function __construct()
  18.     {
  19.         $this->icd10CauseSubGroups = new ArrayCollection();
  20.         $this->icd10Diseases = new ArrayCollection();
  21.     }
  22.     public function getId(): ?int
  23.     {
  24.         return $this->id;
  25.     }
  26.     public function getName(): ?string
  27.     {
  28.         return $this->name;
  29.     }
  30.     public function setName(string $name): self
  31.     {
  32.         $this->name $name;
  33.         return $this;
  34.     }
  35.     /**
  36.      * @return Collection|Icd10CauseSubGroup[]
  37.      */
  38.     public function getIcd10CauseSubGroups(): Collection
  39.     {
  40.         return $this->icd10CauseSubGroups;
  41.     }
  42.     public function addIcd10CauseSubGroup(Icd10CauseSubGroup $icd10CauseSubGroup): self
  43.     {
  44.         if (!$this->icd10CauseSubGroups->contains($icd10CauseSubGroup)) {
  45.             $this->icd10CauseSubGroups[] = $icd10CauseSubGroup;
  46.             $icd10CauseSubGroup->setCauseGroup($this);
  47.         }
  48.         return $this;
  49.     }
  50.     public function removeIcd10CauseSubGroup(Icd10CauseSubGroup $icd10CauseSubGroup): self
  51.     {
  52.         if ($this->icd10CauseSubGroups->contains($icd10CauseSubGroup)) {
  53.             $this->icd10CauseSubGroups->removeElement($icd10CauseSubGroup);
  54.             if ($icd10CauseSubGroup->getCauseGroup() === $this) {
  55.                 $icd10CauseSubGroup->setCauseGroup(null);
  56.             }
  57.         }
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection|Icd10Disease[]
  62.      */
  63.     public function getIcd10Diseases(): Collection
  64.     {
  65.         return $this->icd10Diseases;
  66.     }
  67.     public function addIcd10Disease(Icd10Disease $icd10Disease): self
  68.     {
  69.         if (!$this->icd10Diseases->contains($icd10Disease)) {
  70.             $this->icd10Diseases[] = $icd10Disease;
  71.             $icd10Disease->setCauseGroup($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeIcd10Disease(Icd10Disease $icd10Disease): self
  76.     {
  77.         if ($this->icd10Diseases->contains($icd10Disease)) {
  78.             $this->icd10Diseases->removeElement($icd10Disease);
  79.             if ($icd10Disease->getCauseGroup() === $this) {
  80.                 $icd10Disease->setCauseGroup(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85.     public function __toString(): string
  86.     {
  87.         return (string) $this->getName();
  88.     }
  89. }