diff options
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/entities/Asset.php | 8 | ||||
| -rw-r--r-- | src/model/entities/AssetEmployment.php (renamed from src/model/entities/NodeDataAsset.php) | 4 | ||||
| -rw-r--r-- | src/model/entities/NodeData.php | 16 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/model/entities/Asset.php b/src/model/entities/Asset.php index 5400db4..d76ba08 100644 --- a/src/model/entities/Asset.php +++ b/src/model/entities/Asset.php | |||
| @@ -30,8 +30,8 @@ class Asset | |||
| 30 | #[ORM\Column(type: "string", length: 64, unique: true)] // doctrine n'a pas d'équivalent au type CHAR des BDD (on voulait CHAR(64)), c'est pas grave! | 30 | #[ORM\Column(type: "string", length: 64, unique: true)] // doctrine n'a pas d'équivalent au type CHAR des BDD (on voulait CHAR(64)), c'est pas grave! |
| 31 | private string $hash; // pour détecter deux fichiers identiques, même si leurs noms et les métadonnées changent | 31 | private string $hash; // pour détecter deux fichiers identiques, même si leurs noms et les métadonnées changent |
| 32 | 32 | ||
| 33 | #[ORM\OneToMany(mappedBy: 'asset', targetEntity: NodeDataAsset::class)] | 33 | #[ORM\OneToMany(mappedBy: 'asset', targetEntity: AssetEmployment::class)] |
| 34 | private Collection $nda_collection; | 34 | private Collection $asset_employment; |
| 35 | 35 | ||
| 36 | public function __construct(string $name, string $mime_type, string $hash) | 36 | public function __construct(string $name, string $mime_type, string $hash) |
| 37 | { | 37 | { |
| @@ -61,8 +61,8 @@ class Asset | |||
| 61 | return $this->hash; | 61 | return $this->hash; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | public function getNodeDataAssets(): Collection | 64 | public function getAssetEmployments(): Collection |
| 65 | { | 65 | { |
| 66 | return $this->nda_collection; | 66 | return $this->asset_employment; |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
diff --git a/src/model/entities/NodeDataAsset.php b/src/model/entities/AssetEmployment.php index d5eb141..88ad1bc 100644 --- a/src/model/entities/NodeDataAsset.php +++ b/src/model/entities/AssetEmployment.php | |||
| @@ -11,8 +11,8 @@ namespace App\Entity; | |||
| 11 | use Doctrine\ORM\Mapping as ORM; | 11 | use Doctrine\ORM\Mapping as ORM; |
| 12 | 12 | ||
| 13 | #[ORM\Entity] | 13 | #[ORM\Entity] |
| 14 | #[ORM\Table(name: TABLE_PREFIX . 'nodedata_asset')] | 14 | #[ORM\Table(name: TABLE_PREFIX . 'asset_employment')] |
| 15 | class NodeDataAsset | 15 | class AssetEmployment |
| 16 | { | 16 | { |
| 17 | // clé primaire double | 17 | // clé primaire double |
| 18 | #[ORM\Id] | 18 | #[ORM\Id] |
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php index d2f10ba..49bfb3c 100644 --- a/src/model/entities/NodeData.php +++ b/src/model/entities/NodeData.php | |||
| @@ -41,8 +41,8 @@ class NodeData | |||
| 41 | #[ORM\Column(type: "integer", nullable: true)] | 41 | #[ORM\Column(type: "integer", nullable: true)] |
| 42 | private ?int $pagination_limit = null; // pour les post_block et news_block | 42 | private ?int $pagination_limit = null; // pour les post_block et news_block |
| 43 | 43 | ||
| 44 | #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: NodeDataAsset::class, cascade: ['persist', 'remove'])] | 44 | #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: AssetEmployment::class, cascade: ['persist', 'remove'])] |
| 45 | private Collection $nda_collection; | 45 | private Collection $asset_employment; |
| 46 | 46 | ||
| 47 | /*#[ORM\OneToMany(mappedBy: 'node_data', targetEntity: Email::class, cascade: ['persist', 'remove'])] // => noeud "form", inutilisé et conflit avec le tableau $emails | 47 | /*#[ORM\OneToMany(mappedBy: 'node_data', targetEntity: Email::class, cascade: ['persist', 'remove'])] // => noeud "form", inutilisé et conflit avec le tableau $emails |
| 48 | private Collection $emails;*/ | 48 | private Collection $emails;*/ |
| @@ -50,11 +50,11 @@ class NodeData | |||
| 50 | private int $nb_pages = 1; | 50 | private int $nb_pages = 1; |
| 51 | private array $emails = []; // => noeud "show_emails" | 51 | private array $emails = []; // => noeud "show_emails" |
| 52 | 52 | ||
| 53 | public function __construct(array $data, Node $node, Collection $nda_collection = new ArrayCollection, ?string $presentation = null, ?bool $chrono_order = null) | 53 | public function __construct(array $data, Node $node, Collection $asset_employment = new ArrayCollection, ?string $presentation = null, ?bool $chrono_order = null) |
| 54 | { | 54 | { |
| 55 | $this->data = $data; | 55 | $this->data = $data; |
| 56 | $this->node = $node; | 56 | $this->node = $node; |
| 57 | $this->nda_collection = $nda_collection; | 57 | $this->asset_employment = $asset_employment; |
| 58 | if(!empty($presentation) && $presentation === 'grid'){ | 58 | if(!empty($presentation) && $presentation === 'grid'){ |
| 59 | $this->grid_cols_min_width = 250; | 59 | $this->grid_cols_min_width = 250; |
| 60 | } | 60 | } |
| @@ -137,11 +137,11 @@ class NodeData | |||
| 137 | 137 | ||
| 138 | public function getNodeDataAssets(): Collection | 138 | public function getNodeDataAssets(): Collection |
| 139 | { | 139 | { |
| 140 | return $this->nda_collection; | 140 | return $this->asset_employment; |
| 141 | } | 141 | } |
| 142 | public function getNodeDataAssetByRole(string $role): ?NodeDataAsset | 142 | public function getAssetEmploymentByRole(string $role): ?AssetEmployment |
| 143 | { | 143 | { |
| 144 | foreach($this->nda_collection as $nda){ | 144 | foreach($this->asset_employment as $nda){ |
| 145 | if($nda->getRole() === $role){ | 145 | if($nda->getRole() === $role){ |
| 146 | return $nda; | 146 | return $nda; |
| 147 | } | 147 | } |
| @@ -150,7 +150,7 @@ class NodeData | |||
| 150 | } | 150 | } |
| 151 | public function getAssetByRole(string $role): ?Asset | 151 | public function getAssetByRole(string $role): ?Asset |
| 152 | { | 152 | { |
| 153 | $nda = $this->getNodeDataAssetByRole($role); | 153 | $nda = $this->getAssetEmploymentByRole($role); |
| 154 | if($nda === null){ | 154 | if($nda === null){ |
| 155 | return null; | 155 | return null; |
| 156 | } | 156 | } |
