From df3612ed7e6691530503f79483d2fdbc032d01b8 Mon Sep 17 00:00:00 2001 From: polo-pc-greta Date: Thu, 27 Mar 2025 10:13:03 +0100 Subject: mise en ligne github --- src/model/entities/Page.php | 97 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/model/entities/Page.php (limited to 'src/model/entities/Page.php') diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php new file mode 100644 index 0000000..d7d8098 --- /dev/null +++ b/src/model/entities/Page.php @@ -0,0 +1,97 @@ +name_page = $name; + $this->end_of_path = $eop; + $this->reachable = $reachable; + $this->in_menu = $in_menu; + $this->parent = $parent; + $this->children = new ArrayCollection(); + } + + // getters + /*public function getId(): int + { + return $this->id_page; + }*/ + public function getPageName(): string + { + return $this->name_page; + } + public function getPagePath(): string + { + return $this->page_path; + } + public function getEndOfPath(): string + { + return $this->end_of_path; + } + public function getInMenu(): bool + { + return $this->in_menu; + } + public function getParent(): ?Page + { + return $this->parent; + } + public function getChildren(): Collection + { + return $this->children; + } + + public function fillChildrenPagePath(string $parent_path = ''): void + { + $this->page_path = $parent_path != '' ? $parent_path . '/' . $this->end_of_path : $this->end_of_path; + foreach($this->getChildren() as $page){ + $page->fillChildrenPagePath($this->page_path); + } + } + + public function addChild(self $child): void + { + $this->children[] = $child; + } +} -- cgit v1.2.3