<?phpnamespace App\Entity\Gos;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Repository\Gos\ShortUrlDictionaryRepository") */class ShortUrlDictionary{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $value; /** * @ORM\OneToMany( * targetEntity="ShortUrlDictionary", * mappedBy="parent", * cascade={"persist", "remove"}) * ) * **/ private $children; /** * @ORM\ManyToOne(targetEntity="ShortUrlDictionary", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") **/ private $parent; public function __construct() { $this->children = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getValue(): ?string { return $this->value; } public function setValue(string $value): self { $this->value = $value; return $this; } /** * @return Collection|ShortUrlDictionary[] */ public function getChildren(): Collection { return $this->children; } public function addChild(ShortUrlDictionary $child): self { if (!$this->children->contains($child)) { $this->children[] = $child; $child->setParent($this); } return $this; } public function removeChild(ShortUrlDictionary $child): self { if ($this->children->contains($child)) { $this->children->removeElement($child); // set the owning side to null (unless already changed) if ($child->getParent() === $this) { $child->setParent(null); } } return $this; } public function getParent(): ?self { return $this->parent; } public function setParent(?self $parent): self { $this->parent = $parent; return $this; }}