aboutsummaryrefslogtreecommitdiff
path: root/src/model/entities/NodeDataAsset.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-10-24 16:36:57 +0200
committerpolo <ordipolo@gmx.fr>2025-10-24 16:36:57 +0200
commite73ea91a5999dc2cbadc00dfda18c839ef1a158b (patch)
tree14feeb0ab7a01bdebdf6432772db89520da343f0 /src/model/entities/NodeDataAsset.php
parent5311271ae590460b986e3e09edcdc665b73710ca (diff)
downloadcms-e73ea91a5999dc2cbadc00dfda18c839ef1a158b.zip
hack de beau gosse pour autoriser 2 paires node_data_id/asset_id identiques dans nodedata_asset, problème permission de fichiersHEADmain
Diffstat (limited to 'src/model/entities/NodeDataAsset.php')
-rw-r--r--src/model/entities/NodeDataAsset.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/model/entities/NodeDataAsset.php b/src/model/entities/NodeDataAsset.php
index 7f7008e..7f92fd1 100644
--- a/src/model/entities/NodeDataAsset.php
+++ b/src/model/entities/NodeDataAsset.php
@@ -1,7 +1,8 @@
1<?php 1<?php
2// src/model/entities/NodeDataAsset.php 2// src/model/entities/NodeDataAsset.php
3// 3//
4// entité intermédiaire avec 3 colonnes 4// entité intermédiaire 3 colonnes conçue selon le principe "slot <=> ressource unique" (paires node_data/role uniques)
5// doctrine gère mal les clés primaires triples, j'ai donc choisi une clé primaire double node_data_id/role
5 6
6declare(strict_types=1); 7declare(strict_types=1);
7 8
@@ -11,7 +12,6 @@ use Doctrine\ORM\Mapping as ORM;
11 12
12#[ORM\Entity] 13#[ORM\Entity]
13#[ORM\Table(name: TABLE_PREFIX . 'nodedata_asset')] 14#[ORM\Table(name: TABLE_PREFIX . 'nodedata_asset')]
14#[ORM\UniqueConstraint(name: 'unique_role_per_node', columns: ['node_data_id', 'role'])] // un rôle UNIQUE pour chaque node_data_id, excellent!
15class NodeDataAsset 15class NodeDataAsset
16{ 16{
17 // clé primaire double 17 // clé primaire double
@@ -22,13 +22,13 @@ class NodeDataAsset
22 private NodeData $node_data; 22 private NodeData $node_data;
23 23
24 #[ORM\Id] 24 #[ORM\Id]
25 #[ORM\Column(type: 'string', length: 50)]
26 private string $role;
27
25 #[ORM\ManyToOne(targetEntity: Asset::class)] 28 #[ORM\ManyToOne(targetEntity: Asset::class)]
26 #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id_asset', onDelete: 'CASCADE')] 29 #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id_asset', onDelete: 'CASCADE')]
27 private Asset $asset; 30 private Asset $asset;
28 31
29 #[ORM\Column(type: 'string', length: 50)]
30 private string $role;
31
32 public function __construct(NodeData $node_data, Asset $asset, string $role){ 32 public function __construct(NodeData $node_data, Asset $asset, string $role){
33 $this->node_data = $node_data; 33 $this->node_data = $node_data;
34 $this->asset = $asset; 34 $this->asset = $asset;