aboutsummaryrefslogtreecommitdiff
path: root/src/model/entities/NodeData.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-12-23 15:20:48 +0100
committerpolo <ordipolo@gmx.fr>2025-12-23 15:20:48 +0100
commit774437d3196878388e294a3833a73e900000b5e4 (patch)
tree5d8449beee8b492fe553460f3c4f1027e8cd123a /src/model/entities/NodeData.php
parent8393acd0366ee3408db103ba29e8686bab127f42 (diff)
downloadcms-774437d3196878388e294a3833a73e900000b5e4.tar.gz
cms-774437d3196878388e294a3833a73e900000b5e4.tar.bz2
cms-774437d3196878388e294a3833a73e900000b5e4.zip
choix durée stockage e-mails, relation entités Email <=> NodeData
Diffstat (limited to 'src/model/entities/NodeData.php')
-rw-r--r--src/model/entities/NodeData.php38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php
index 4c07a69..d2f10ba 100644
--- a/src/model/entities/NodeData.php
+++ b/src/model/entities/NodeData.php
@@ -44,8 +44,11 @@ class NodeData
44 #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: NodeDataAsset::class, cascade: ['persist', 'remove'])] 44 #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: NodeDataAsset::class, cascade: ['persist', 'remove'])]
45 private Collection $nda_collection; 45 private Collection $nda_collection;
46 46
47 /*#[ORM\OneToMany(mappedBy: 'node_data', targetEntity: Email::class, cascade: ['persist', 'remove'])] // => noeud "form", inutilisé et conflit avec le tableau $emails
48 private Collection $emails;*/
49
47 private int $nb_pages = 1; 50 private int $nb_pages = 1;
48 private array $emails = []; // noeud show_emails uniquement 51 private array $emails = []; // => noeud "show_emails"
49 52
50 public function __construct(array $data, Node $node, Collection $nda_collection = new ArrayCollection, ?string $presentation = null, ?bool $chrono_order = null) 53 public function __construct(array $data, Node $node, Collection $nda_collection = new ArrayCollection, ?string $presentation = null, ?bool $chrono_order = null)
51 { 54 {
@@ -70,7 +73,7 @@ class NodeData
70 { 73 {
71 $this->data = $data; 74 $this->data = $data;
72 }*/ 75 }*/
73 public function updateData(string $key, string|bool|array $value = ''): void 76 public function updateData(string $key, string|int|bool|array $value = ''): void
74 { 77 {
75 if($value !== ''){ 78 if($value !== ''){
76 $this->data[$key] = $value; 79 $this->data[$key] = $value;
@@ -153,39 +156,12 @@ class NodeData
153 } 156 }
154 return $nda->getAsset() ?? null; 157 return $nda->getAsset() ?? null;
155 } 158 }
156 /*public function addNodeDataAsset(NodeDataAsset $nda): self
157 {
158 if(!$this->nda_collection->contains($nda)){ // sécurité contrainte UNIQUE
159 $this->nda_collection->add($nda);
160 }
161 return $this;
162 }*/
163 /*public function removeNodeDataAsset(NodeDataAsset $nda): self // inutile on peut faire: $node_data->getNodeDataAssets()->removeElement($nda);
164 {
165 $this->nda_collection->removeElement($nda);
166 // pas de synchro dans NodeDataAsset, les champs de cette table ne sont pas nullables
167 return $this;
168 }*/
169
170 // LE setter, sélectionne l'asset à utiliser en remplaçant l'entrée dans NodeDataAsset en fonction du rôle
171 // à mettre théoriquement dans une classe metier dans "service"
172 /*public function replaceAssetForRole(string $role, Asset $asset): void
173 {
174 foreach($this->nda_collection as $nda){
175 if($nda->getRole() === $role){
176 $this->removeNodeDataAsset($nda);
177 break;
178 }
179 }
180 $this->new_nda = new NodeDataAsset($this, $asset, $role);
181 $this->addNodeDataAsset($this->new_nda);
182 }*/
183 159
184 public function getEmails(): array 160 public function getEmails(): array // appelée dans ShowEmailsBuilder
185 { 161 {
186 return $this->emails; 162 return $this->emails;
187 } 163 }
188 public function setEmails(array $emails): void 164 public function setEmails(array $emails): void // appelée dans Model
189 { 165 {
190 $this->emails = $emails; 166 $this->emails = $emails;
191 } 167 }