diff options
Diffstat (limited to 'src/model/entities')
-rw-r--r-- | src/model/entities/Article.php | 2 | ||||
-rw-r--r-- | src/model/entities/NodeData.php | 12 | ||||
-rw-r--r-- | src/model/entities/Presentation.php | 31 |
3 files changed, 45 insertions, 0 deletions
diff --git a/src/model/entities/Article.php b/src/model/entities/Article.php index 14028ec..5412497 100644 --- a/src/model/entities/Article.php +++ b/src/model/entities/Article.php | |||
@@ -1,5 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | // src/model/entities/Article.php | 2 | // src/model/entities/Article.php |
3 | // | ||
4 | // entité commune pour les "post" (articles simples) et les "news" (complexes avec titre, aperçu et contenu) | ||
3 | 5 | ||
4 | declare(strict_types=1); | 6 | declare(strict_types=1); |
5 | 7 | ||
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php index 758ccb7..c835727 100644 --- a/src/model/entities/NodeData.php +++ b/src/model/entities/NodeData.php | |||
@@ -24,6 +24,10 @@ class NodeData | |||
24 | #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node", onDelete: "CASCADE")] | 24 | #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node", onDelete: "CASCADE")] |
25 | private Node $node; | 25 | private Node $node; |
26 | 26 | ||
27 | #[ORM\ManyToOne(targetEntity: Presentation::class)] | ||
28 | #[ORM\JoinColumn(name: "presentation_id", referencedColumnName: "id_presentation", nullable: true)] | ||
29 | private Presentation $presentation; | ||
30 | |||
27 | #[ORM\Column(type: "json")] | 31 | #[ORM\Column(type: "json")] |
28 | private array $data; | 32 | private array $data; |
29 | 33 | ||
@@ -47,6 +51,14 @@ class NodeData | |||
47 | { | 51 | { |
48 | return $this->id_node_data; | 52 | return $this->id_node_data; |
49 | } | 53 | } |
54 | public function getPresentation(): Presentation | ||
55 | { | ||
56 | return $this->presentation; | ||
57 | } | ||
58 | public function setPresentation(Presentation $presentation): void | ||
59 | { | ||
60 | $this->presentation = $presentation; | ||
61 | } | ||
50 | public function getData(): array | 62 | public function getData(): array |
51 | { | 63 | { |
52 | return $this->data; | 64 | return $this->data; |
diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php new file mode 100644 index 0000000..73b6a6a --- /dev/null +++ b/src/model/entities/Presentation.php | |||
@@ -0,0 +1,31 @@ | |||
1 | <?php | ||
2 | // src/model/entities/Presentation.php | ||
3 | |||
4 | declare(strict_types=1); | ||
5 | |||
6 | namespace App\Entity; | ||
7 | |||
8 | use Doctrine\ORM\Mapping as ORM; | ||
9 | |||
10 | #[ORM\Entity] | ||
11 | #[ORM\Table(name: TABLE_PREFIX . "presentation")] | ||
12 | class Presentation | ||
13 | { | ||
14 | #[ORM\Id] | ||
15 | #[ORM\GeneratedValue] | ||
16 | #[ORM\Column(type: "integer")] | ||
17 | private int $id_presentation; | ||
18 | |||
19 | #[ORM\Column(type: "string", length: 255)] | ||
20 | private string $name_presentation; | ||
21 | |||
22 | public function __construct(string $name) | ||
23 | { | ||
24 | $this->name_presentation = $name; | ||
25 | } | ||
26 | |||
27 | public function getName(): string | ||
28 | { | ||
29 | return $this->name_presentation; | ||
30 | } | ||
31 | } \ No newline at end of file | ||