aboutsummaryrefslogtreecommitdiff
path: root/src/model/entities/NodeData.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-09-01 18:52:17 +0200
committerpolo <ordipolo@gmx.fr>2025-09-01 18:52:17 +0200
commitf477314613beb26b0ce4c61ec0b1900df1de1cb1 (patch)
treed41ace78a572a11887e7cfa2611c3f02fb04e51c /src/model/entities/NodeData.php
parente642cd51d7e8599537f8514bef8d5d16096dddf8 (diff)
downloadcms-f477314613beb26b0ce4c61ec0b1900df1de1cb1.zip
renommage des présentations,modif présentation des blocs et largeur min (donc nb de colonnes) en mode grid, corrections de bugs et erreurs 404, le param page_modif n'est plus une action, légère symfonyfication du routeur
Diffstat (limited to 'src/model/entities/NodeData.php')
-rw-r--r--src/model/entities/NodeData.php40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php
index c835727..3688e4a 100644
--- a/src/model/entities/NodeData.php
+++ b/src/model/entities/NodeData.php
@@ -24,12 +24,15 @@ 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\Column(type: "json")]
28 private array $data;
29
27 #[ORM\ManyToOne(targetEntity: Presentation::class)] 30 #[ORM\ManyToOne(targetEntity: Presentation::class)]
28 #[ORM\JoinColumn(name: "presentation_id", referencedColumnName: "id_presentation", nullable: true)] 31 #[ORM\JoinColumn(name: "presentation_id", referencedColumnName: "id_presentation", nullable: true)]
29 private Presentation $presentation; 32 private ?Presentation $presentation;
30 33
31 #[ORM\Column(type: "json")] 34 #[ORM\Column(type: "integer", length: 255, nullable: true)]
32 private array $data; 35 private ?int $grid_cols_min_width = null; // pour le mode grille
33 36
34 // liaison avec table intermédiaire 37 // liaison avec table intermédiaire
35 #[ORM\ManyToMany(targetEntity: Image::class, inversedBy: "node_data")] 38 #[ORM\ManyToMany(targetEntity: Image::class, inversedBy: "node_data")]
@@ -40,25 +43,20 @@ class NodeData
40 )] 43 )]
41 private Collection $images; 44 private Collection $images;
42 45
43 public function __construct(array $data, Node $node, Collection $images = new ArrayCollection) 46 public function __construct(array $data, Node $node, Collection $images = new ArrayCollection, Presentation $presentation = null)
44 { 47 {
45 $this->data = $data; 48 $this->data = $data;
46 $this->node = $node; 49 $this->node = $node;
47 $this->images = $images; 50 $this->images = $images;
51 if(!empty($presentation) && $presentation->getName() === 'grid'){
52 $this->grid_cols_min_width = 250;
53 }
48 } 54 }
49 55
50 public function getId(): int 56 public function getId(): int
51 { 57 {
52 return $this->id_node_data; 58 return $this->id_node_data;
53 } 59 }
54 public function getPresentation(): Presentation
55 {
56 return $this->presentation;
57 }
58 public function setPresentation(Presentation $presentation): void
59 {
60 $this->presentation = $presentation;
61 }
62 public function getData(): array 60 public function getData(): array
63 { 61 {
64 return $this->data; 62 return $this->data;
@@ -77,6 +75,24 @@ class NodeData
77 unset($this->data[$key]); 75 unset($this->data[$key]);
78 } 76 }
79 } 77 }
78 public function getPresentation(): ?Presentation
79 {
80 return $this->presentation;
81 }
82 public function setPresentation(Presentation $presentation): void
83 {
84 $this->presentation = $presentation;
85 }
86 public function getColsMinWidth(): int
87 {
88 $default = 320; // pixels
89 return $this->grid_cols_min_width === null ? $default : $this->grid_cols_min_width;
90 }
91 public function setColsMinWidth(int $columns): void
92 {
93 $this->grid_cols_min_width = $columns;
94 }
95
80 /*public function setNode(Node $node): void 96 /*public function setNode(Node $node): void
81 { 97 {
82 $this->node = $node; 98 $this->node = $node;