diff options
Diffstat (limited to 'src/controller/Director.php')
-rw-r--r-- | src/controller/Director.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/controller/Director.php b/src/controller/Director.php index a2528ed..56a90cb 100644 --- a/src/controller/Director.php +++ b/src/controller/Director.php | |||
@@ -16,11 +16,11 @@ class Director | |||
16 | private Node $node; | 16 | private Node $node; |
17 | private Node $article; | 17 | private Node $article; |
18 | 18 | ||
19 | public function __construct(EntityManager $entityManager, bool $for_display = false) | 19 | public function __construct(EntityManager $entityManager, bool $get_menu = false) |
20 | { | 20 | { |
21 | $this->entityManager = $entityManager; | 21 | $this->entityManager = $entityManager; |
22 | if($for_display){ | 22 | if($get_menu){ |
23 | self::$menu_data = new Menu($entityManager); // Menu est un modèle mais pas une entité | 23 | self::$menu_data = new Menu($entityManager); |
24 | self::$page_path = new Path(); | 24 | self::$page_path = new Path(); |
25 | $this->page = self::$page_path->getLast(); | 25 | $this->page = self::$page_path->getLast(); |
26 | } | 26 | } |
@@ -137,4 +137,24 @@ class Director | |||
137 | $this->node = $section; | 137 | $this->node = $section; |
138 | return true; | 138 | return true; |
139 | } | 139 | } |
140 | |||
141 | public function findNodeByName(string $name): void | ||
142 | { | ||
143 | $bulk_data = $this->entityManager | ||
144 | ->createQuery('SELECT n FROM App\Entity\Node n WHERE n.name_node = :name') | ||
145 | ->setParameter('name', $name) | ||
146 | ->getResult(); | ||
147 | $this->node = $bulk_data[0]; | ||
148 | echo $this->page->getPageName() . ' '; | ||
149 | |||
150 | $bulk_data = $this->entityManager | ||
151 | ->createQuery('SELECT n FROM App\Entity\Node n WHERE n.parent = :parent AND n.page = :page') | ||
152 | ->setParameter('parent', $this->node) | ||
153 | ->setParameter('page', $this->page) | ||
154 | ->getResult(); | ||
155 | foreach($bulk_data as $child){ | ||
156 | $this->node->addChild($child); | ||
157 | echo $child->getName() . ' '; | ||
158 | } | ||
159 | } | ||
140 | } | 160 | } |