From f477314613beb26b0ce4c61ec0b1900df1de1cb1 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 1 Sep 2025 18:52:17 +0200 Subject: =?UTF-8?q?renommage=20des=20pr=C3=A9sentations,modif=20pr=C3=A9se?= =?UTF-8?q?ntation=20des=20blocs=20et=20largeur=20min=20(donc=20nb=20de=20?= =?UTF-8?q?colonnes)=20en=20mode=20grid,=20corrections=20de=20bugs=20et=20?= =?UTF-8?q?erreurs=20404,=20le=20param=20page=5Fmodif=20n'est=20plus=20une?= =?UTF-8?q?=20action,=20l=C3=A9g=C3=A8re=20symfonyfication=20du=20routeur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/NodeData.php | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'src/model/entities/NodeData.php') 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 #[ORM\JoinColumn(name: "node_id", referencedColumnName: "id_node", onDelete: "CASCADE")] private Node $node; + #[ORM\Column(type: "json")] + private array $data; + #[ORM\ManyToOne(targetEntity: Presentation::class)] #[ORM\JoinColumn(name: "presentation_id", referencedColumnName: "id_presentation", nullable: true)] - private Presentation $presentation; + private ?Presentation $presentation; - #[ORM\Column(type: "json")] - private array $data; + #[ORM\Column(type: "integer", length: 255, nullable: true)] + private ?int $grid_cols_min_width = null; // pour le mode grille // liaison avec table intermédiaire #[ORM\ManyToMany(targetEntity: Image::class, inversedBy: "node_data")] @@ -40,25 +43,20 @@ class NodeData )] private Collection $images; - public function __construct(array $data, Node $node, Collection $images = new ArrayCollection) + public function __construct(array $data, Node $node, Collection $images = new ArrayCollection, Presentation $presentation = null) { $this->data = $data; $this->node = $node; $this->images = $images; + if(!empty($presentation) && $presentation->getName() === 'grid'){ + $this->grid_cols_min_width = 250; + } } public function getId(): int { return $this->id_node_data; } - public function getPresentation(): Presentation - { - return $this->presentation; - } - public function setPresentation(Presentation $presentation): void - { - $this->presentation = $presentation; - } public function getData(): array { return $this->data; @@ -77,6 +75,24 @@ class NodeData unset($this->data[$key]); } } + public function getPresentation(): ?Presentation + { + return $this->presentation; + } + public function setPresentation(Presentation $presentation): void + { + $this->presentation = $presentation; + } + public function getColsMinWidth(): int + { + $default = 320; // pixels + return $this->grid_cols_min_width === null ? $default : $this->grid_cols_min_width; + } + public function setColsMinWidth(int $columns): void + { + $this->grid_cols_min_width = $columns; + } + /*public function setNode(Node $node): void { $this->node = $node; -- cgit v1.2.3