From 17fd3ef23aaa0c730fa304b40888ac01090fb863 Mon Sep 17 00:00:00 2001 From: besbota Date: Thu, 17 Oct 2024 17:17:21 +0200 Subject: [PATCH] MissionCategory.php --- src/Entity/MissionCategory.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Entity/MissionCategory.php b/src/Entity/MissionCategory.php index 862d5a8..ea5680d 100644 --- a/src/Entity/MissionCategory.php +++ b/src/Entity/MissionCategory.php @@ -5,17 +5,18 @@ namespace App\Entity; use App\Repository\MissionCategoryRepository; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: MissionCategoryRepository::class)] +#[ORM\Entity] +#[ORM\UniqueConstraint(columns: ['mission', 'category'])] class MissionCategory { #[ORM\Id] - #[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'MissionCategory')] - #[ORM\JoinColumn(nullable: false)] + #[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'missionCategories')] + #[ORM\Column(type: 'integer')] private ?Mission $mission = null; #[ORM\Id] - #[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'MissionCategory')] - #[ORM\JoinColumn(nullable: false)] + #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'missionCategories')] + #[ORM\Column(type: 'integer')] private ?Category $category = null; public function getMission(): ?Mission