<?php
namespace App\Entity;
use App\Repository\HelpProgramParentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=HelpProgramParentRepository::class)
*/
class HelpProgramParent
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=HelpProgram::class, mappedBy="parent")
*/
private $helpPrograms;
public function __construct()
{
$this->helpPrograms = 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;
}
/**
* @return Collection<int, HelpProgram>
*/
public function getHelpPrograms(): Collection
{
return $this->helpPrograms;
}
public function addHelpProgram(HelpProgram $helpProgram): self
{
if (!$this->helpPrograms->contains($helpProgram)) {
$this->helpPrograms[] = $helpProgram;
$helpProgram->setParent($this);
}
return $this;
}
public function removeHelpProgram(HelpProgram $helpProgram): self
{
if ($this->helpPrograms->removeElement($helpProgram)) {
// set the owning side to null (unless already changed)
if ($helpProgram->getParent() === $this) {
$helpProgram->setParent(null);
}
}
return $this;
}
}