From e73ea91a5999dc2cbadc00dfda18c839ef1a158b Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 24 Oct 2025 16:36:57 +0200 Subject: =?UTF-8?q?hack=20de=20beau=20gosse=20pour=20autoriser=202=20paire?= =?UTF-8?q?s=20node=5Fdata=5Fid/asset=5Fid=20identiques=20dans=20nodedata?= =?UTF-8?q?=5Fasset,=20probl=C3=A8me=20permission=20de=20fichiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/NodeDataAsset.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/model/entities/NodeDataAsset.php') 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 @@ ressource unique" (paires node_data/role uniques) +// doctrine gère mal les clés primaires triples, j'ai donc choisi une clé primaire double node_data_id/role declare(strict_types=1); @@ -11,7 +12,6 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] #[ORM\Table(name: TABLE_PREFIX . 'nodedata_asset')] -#[ORM\UniqueConstraint(name: 'unique_role_per_node', columns: ['node_data_id', 'role'])] // un rôle UNIQUE pour chaque node_data_id, excellent! class NodeDataAsset { // clé primaire double @@ -22,13 +22,13 @@ class NodeDataAsset private NodeData $node_data; #[ORM\Id] + #[ORM\Column(type: 'string', length: 50)] + private string $role; + #[ORM\ManyToOne(targetEntity: Asset::class)] #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id_asset', onDelete: 'CASCADE')] private Asset $asset; - #[ORM\Column(type: 'string', length: 50)] - private string $role; - public function __construct(NodeData $node_data, Asset $asset, string $role){ $this->node_data = $node_data; $this->asset = $asset; -- cgit v1.2.3