<?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\ContactItemRepository") */class ContactItem{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="text") */ private $description; /** * @ORM\Column(type="string", length=255) */ private $breadcrumb; /** * @ORM\OneToMany( * targetEntity="ContactItem", * mappedBy="parent", * cascade={"persist", "remove"}) * ) * **/ private $children; /** * @ORM\ManyToOne(targetEntity="ContactItem", 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 getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function getBreadcrumb(): ?string { return $this->breadcrumb; } public function setBreadcrumb(string $breadcrumb): self { $this->breadcrumb = $breadcrumb; return $this; } /** * @return Collection|ContactItem[] */ public function getChildren(): Collection { return $this->children; } public function addChild(ContactItem $child): self { if (!$this->children->contains($child)) { $this->children[] = $child; $child->setParent($this); } return $this; } public function removeChild(ContactItem $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; }}