diff options
| author | polo <ordipolo@gmx.fr> | 2025-12-24 13:20:11 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-12-24 13:20:11 +0100 |
| commit | a3df76b303613141134912b426535ab8b077b77d (patch) | |
| tree | 277c935ca6c54eb07b73ee978d3f232fe36f4b7a /src/model/entities/AssetEmployment.php | |
| parent | 0ec35c94c77a36894ce7d30fce290412f25b3e0e (diff) | |
| download | cms-a3df76b303613141134912b426535ab8b077b77d.tar.gz cms-a3df76b303613141134912b426535ab8b077b77d.tar.bz2 cms-a3df76b303613141134912b426535ab8b077b77d.zip | |
renommage NodeDataAsset en AssetEmployment
Diffstat (limited to 'src/model/entities/AssetEmployment.php')
| -rw-r--r-- | src/model/entities/AssetEmployment.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/model/entities/AssetEmployment.php b/src/model/entities/AssetEmployment.php new file mode 100644 index 0000000..88ad1bc --- /dev/null +++ b/src/model/entities/AssetEmployment.php | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | <?php | ||
| 2 | // src/model/entities/NodeDataAsset.php | ||
| 3 | // | ||
| 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 | ||
| 6 | |||
| 7 | declare(strict_types=1); | ||
| 8 | |||
| 9 | namespace App\Entity; | ||
| 10 | |||
| 11 | use Doctrine\ORM\Mapping as ORM; | ||
| 12 | |||
| 13 | #[ORM\Entity] | ||
| 14 | #[ORM\Table(name: TABLE_PREFIX . 'asset_employment')] | ||
| 15 | class AssetEmployment | ||
| 16 | { | ||
| 17 | // clé primaire double | ||
| 18 | #[ORM\Id] | ||
| 19 | #[ORM\ManyToOne(targetEntity: NodeData::class, inversedBy: 'nda_collection')] | ||
| 20 | #[ORM\JoinColumn(name: 'node_data_id', referencedColumnName: 'id_node_data', onDelete: 'CASCADE')] | ||
| 21 | private NodeData $node_data; | ||
| 22 | |||
| 23 | #[ORM\Id] | ||
| 24 | #[ORM\Column(type: 'string', length: 50)] | ||
| 25 | private string $role; | ||
| 26 | |||
| 27 | #[ORM\ManyToOne(targetEntity: Asset::class)] | ||
| 28 | #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id_asset', onDelete: 'CASCADE')] | ||
| 29 | private Asset $asset; | ||
| 30 | |||
| 31 | public function __construct(NodeData $node_data, Asset $asset, string $role){ | ||
| 32 | $this->node_data = $node_data; | ||
| 33 | $this->asset = $asset; | ||
| 34 | $this->role = $role; | ||
| 35 | } | ||
| 36 | |||
| 37 | /*public function getNodeData(): NodeData | ||
| 38 | { | ||
| 39 | return $this->node_data; | ||
| 40 | }*/ | ||
| 41 | public function getAsset(): Asset | ||
| 42 | { | ||
| 43 | return $this->asset; | ||
| 44 | } | ||
| 45 | public function setAsset(Asset $asset): self | ||
| 46 | { | ||
| 47 | $this->asset = $asset; | ||
| 48 | return $this; | ||
| 49 | } | ||
| 50 | public function getRole(): string | ||
| 51 | { | ||
| 52 | return $this->role; | ||
| 53 | } | ||
| 54 | } | ||
