aboutsummaryrefslogtreecommitdiff
path: root/src/model/entities/Node.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-06-11 01:35:57 +0200
committerpolo <ordipolo@gmx.fr>2026-06-11 01:35:57 +0200
commitb76547767ae897b6de752c56e2cef6079ca4abcb (patch)
treed76006e86198189c949b36b2c284067b9603e3fc /src/model/entities/Node.php
parentae217a6e4b0c29346381e2a410fd7810cb33ce3f (diff)
downloadcms-b76547767ae897b6de752c56e2cef6079ca4abcb.tar.gz
cms-b76547767ae897b6de752c56e2cef6079ca4abcb.tar.bz2
cms-b76547767ae897b6de752c56e2cef6079ca4abcb.zip
classe EmailForm à Email et détachable de Node
Diffstat (limited to 'src/model/entities/Node.php')
-rw-r--r--src/model/entities/Node.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php
index 71c159d..c3e4ec3 100644
--- a/src/model/entities/Node.php
+++ b/src/model/entities/Node.php
@@ -45,13 +45,14 @@ class Node
45 #[ORM\OneToOne(targetEntity: NodeData::class, mappedBy: "node", cascade: ['persist', 'remove'])] 45 #[ORM\OneToOne(targetEntity: NodeData::class, mappedBy: "node", cascade: ['persist', 'remove'])]
46 private ?NodeData $node_data = null; 46 private ?NodeData $node_data = null;
47 47
48 #[ORM\OneToOne(targetEntity: EmailForm::class, mappedBy: "node", cascade: ['persist'])] // pas de remove, les e-mails sont associés au EmailForm
49 private ?EmailForm $email_form = null;
48 50
49 // attributs non destinés à doctrine 51 // attributs non destinés à doctrine
50 private array $children = []; // tableau de Node 52 private array $children = []; // tableau de Node
51 private ?self $adopted = null; // = "new" est un enfant de "main" lorsque la page est "article" 53 private ?self $adopted = null; // = "new" est un enfant de "main" lorsque la page est "article"
52 54
53 public function __construct(string $name = '', int $position = 0, ?self $parent = null, ?Page $page = null, ?Article $article = null) 55 public function __construct(string $name = '', int $position = 0, ?self $parent = null, ?Page $page = null, ?Article $article = null){
54 {
55 $this->name_node = $name; 56 $this->name_node = $name;
56 $this->position = $position; 57 $this->position = $position;
57 $this->parent = $parent; 58 $this->parent = $parent;
@@ -105,9 +106,10 @@ class Node
105 { 106 {
106 $this->article = $article; 107 $this->article = $article;
107 }*/ 108 }*/
108 public function getNodeData(): ?NodeData 109 // une interface serait cool!
110 public function getNodeData(): NodeData|EmailForm|null
109 { 111 {
110 return $this->node_data; 112 return $this->name_node === 'form' ? $this->email_form : $this->node_data;
111 } 113 }
112 public function getChildren(): array 114 public function getChildren(): array
113 { 115 {