summaryrefslogtreecommitdiff
path: root/src/view/MainBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/MainBuilder.php')
-rw-r--r--src/view/MainBuilder.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/view/MainBuilder.php b/src/view/MainBuilder.php
index a44570b..ea7b8c3 100644
--- a/src/view/MainBuilder.php
+++ b/src/view/MainBuilder.php
@@ -1,6 +1,7 @@
1<?php 1<?php
2// src/view/MainBuilder.php 2// src/view/MainBuilder.php
3 3
4use App\Entity\Article;
4use App\Entity\Node; 5use App\Entity\Node;
5 6
6class MainBuilder extends AbstractBuilder 7class MainBuilder extends AbstractBuilder
@@ -10,11 +11,22 @@ class MainBuilder extends AbstractBuilder
10 $this->html .= "<main>\n"; 11 $this->html .= "<main>\n";
11 12
12 if(Director::$page_path->getLast()->getEndOfPath() === 'article'){ 13 if(Director::$page_path->getLast()->getEndOfPath() === 'article'){
13 if($node->getTempChild() == null){ 14 // pas censé arriver
14 $new = new Node; 15 if(!isset($_GET['id'])){
16 header('Location: ' . new URL);
17 die;
18 }
19
20 if($node->getAdoptedChild() == null){
21 // on pourrait raccourcir ça
22 $timestamp = time(); // int
23 $date = new \DateTime;
24 $date->setTimestamp($timestamp); // \DateTime
25 $article = new Article('', $date);
26 $new = new Node('new', 'i' . (string)$timestamp, [], 0, null, null, $article);
15 } 27 }
16 else{ 28 else{
17 $new = $node->getTempChild(); 29 $new = $node->getAdoptedChild();
18 } 30 }
19 //$builder_name = $this->snakeToPascalCase($new->getName()) . 'Builder'; 31 //$builder_name = $this->snakeToPascalCase($new->getName()) . 'Builder';
20 $builder_name = 'NewBuilder'; 32 $builder_name = 'NewBuilder';