blocks = new ArrayCollection(); $this->nodes = 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 getTemplate(): ?string { return $this->template; } public function setTemplate(?string $template): self { $this->template = $template; return $this; } /** * @return Collection|Block[] */ public function getBlocks(): Collection { return $this->blocks; } public function addBlock(Block $block): self { if (!$this->blocks->contains($block)) { $this->blocks[] = $block; $block->setPage($this); } return $this; } public function removeBlock(Block $block): self { if ($this->blocks->removeElement($block)) { // set the owning side to null (unless already changed) if ($block->getPage() === $this) { $block->setPage(null); } } return $this; } public function buildForm(FormBuilderInterface $builder) { } public function getBlock($name) { foreach ($this->getBlocks() as $block) { if ($block->getName() === $name) { return $block; } } $block = new Block(); $block->setName($name); $block->setPage($this); return $block; } public function setBlock(Block $block): self { foreach ($this->blocks->toArray() as $key => $value) { if ($value->getName() === $block->getName()) { $this->blocks->remove($key); $this->blocks->add($block); return $this; } } $this->blocks->add($block); return $this; } public function getMetaTitle(): ?string { return $this->metaTitle; } public function setMetaTitle(?string $metaTitle): self { $this->metaTitle = $metaTitle; return $this; } public function getMetaDescrition(): ?string { return $this->metaDescrition; } public function setMetaDescrition(?string $metaDescrition): self { $this->metaDescrition = $metaDescrition; return $this; } public function getOgTitle(): ?string { return $this->ogTitle; } public function setOgTitle(?string $ogTitle): self { $this->ogTitle = $ogTitle; return $this; } public function getOgDescription(): ?string { return $this->ogDescription; } public function setOgDescription(?string $ogDescription): self { $this->ogDescription = $ogDescription; return $this; } /** * @return Collection|Node[] */ public function getNodes(): Collection { return $this->nodes; } public function addNode(Node $node): self { if (!$this->nodes->contains($node)) { $this->nodes[] = $node; $node->setPage($this); } return $this; } public function removeNode(Node $node): self { if ($this->nodes->removeElement($node)) { // set the owning side to null (unless already changed) if ($node->getPage() === $this) { $node->setPage(null); } } return $this; } }