From b76547767ae897b6de752c56e2cef6079ca4abcb Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 11 Jun 2026 01:35:57 +0200 Subject: =?UTF-8?q?classe=20EmailForm=20=C3=A0=20Email=20et=20d=C3=A9tacha?= =?UTF-8?q?ble=20de=20Node?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/Node.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/model/entities/Node.php') 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 #[ORM\OneToOne(targetEntity: NodeData::class, mappedBy: "node", cascade: ['persist', 'remove'])] private ?NodeData $node_data = null; + #[ORM\OneToOne(targetEntity: EmailForm::class, mappedBy: "node", cascade: ['persist'])] // pas de remove, les e-mails sont associés au EmailForm + private ?EmailForm $email_form = null; // attributs non destinés à doctrine private array $children = []; // tableau de Node private ?self $adopted = null; // = "new" est un enfant de "main" lorsque la page est "article" - public function __construct(string $name = '', int $position = 0, ?self $parent = null, ?Page $page = null, ?Article $article = null) - { + public function __construct(string $name = '', int $position = 0, ?self $parent = null, ?Page $page = null, ?Article $article = null){ $this->name_node = $name; $this->position = $position; $this->parent = $parent; @@ -105,9 +106,10 @@ class Node { $this->article = $article; }*/ - public function getNodeData(): ?NodeData + // une interface serait cool! + public function getNodeData(): NodeData|EmailForm|null { - return $this->node_data; + return $this->name_node === 'form' ? $this->email_form : $this->node_data; } public function getChildren(): array { -- cgit v1.2.3