浏览代码

fix doctrine schema (ongoing)

Olivier Massot 8 月之前
父节点
当前提交
eec70d9994
共有 34 个文件被更改,包括 562 次插入219 次删除
  1. 28 26
      src/Entity/Access/Access.php
  2. 2 2
      src/Entity/AccessWish/EducationStudentWish.php
  3. 3 2
      src/Entity/Billing/AbstractBillAccounting.php
  4. 0 2
      src/Entity/Billing/AdvancePayment.php
  5. 0 15
      src/Entity/Billing/Bill.php
  6. 1 1
      src/Entity/Billing/BillLine.php
  7. 1 1
      src/Entity/Billing/BillPayment.php
  8. 7 6
      src/Entity/Booking/Course.php
  9. 35 5
      src/Entity/Booking/EducationalProject.php
  10. 26 7
      src/Entity/Booking/Event.php
  11. 64 2
      src/Entity/Booking/Examen.php
  12. 92 1
      src/Entity/Booking/OrganizationHoliday.php
  13. 92 1
      src/Entity/Booking/PersonHoliday.php
  14. 1 0
      src/Entity/Core/AbstractControl.php
  15. 0 32
      src/Entity/Core/AbstractRepair.php
  16. 5 4
      src/Entity/Core/AddressPostal.php
  17. 6 5
      src/Entity/Core/ContactPoint.php
  18. 8 7
      src/Entity/Core/Tagg.php
  19. 1 1
      src/Entity/Education/Cycle.php
  20. 2 2
      src/Entity/Education/Education.php
  21. 1 1
      src/Entity/Education/EducationComplement.php
  22. 4 4
      src/Entity/Education/EducationCurriculum.php
  23. 2 2
      src/Entity/Message/AbstractReport.php
  24. 119 0
      src/Entity/Message/Message.php
  25. 1 1
      src/Entity/Message/ReportMessage.php
  26. 1 3
      src/Entity/Place/PlaceControl.php
  27. 2 2
      src/Entity/Place/Room.php
  28. 0 1
      src/Entity/Place/RoomControl.php
  29. 38 0
      src/Entity/Place/RoomRepair.php
  30. 4 34
      src/Entity/Product/Equipment.php
  31. 0 1
      src/Entity/Product/EquipmentControl.php
  32. 3 35
      src/Entity/Product/Intangible.php
  33. 8 8
      src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php
  34. 5 5
      src/Service/Doctrine/SchemaValidation/SchemaValidationService.php

+ 28 - 26
src/Entity/Access/Access.php

@@ -40,6 +40,7 @@ use App\Entity\Education\EducationTeacher;
 use App\Entity\Message\AbstractMessage;
 use App\Entity\Message\Email;
 use App\Entity\Message\Mail;
+use App\Entity\Message\Message;
 use App\Entity\Message\Sms;
 use App\Entity\Organization\Jury;
 use App\Entity\Organization\Organization;
@@ -365,13 +366,14 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     private Collection $tags;
 
-    #[ORM\ManyToMany(mappedBy: 'organizer', targetEntity: AbstractBooking::class, cascade: ['persist'], orphanRemoval: false)]
-    private Collection $bookingOrganizers;
+    // TODO: revoir le mapping, on ne peut pas mapper à une mapped superclass comme abstract booking
+//    #[ORM\ManyToMany(mappedBy: 'organizer', targetEntity: AbstractBooking::class, cascade: ['persist'], orphanRemoval: false)]
+//    private Collection $bookingOrganizers;
 
     #[ORM\OneToMany(mappedBy: 'access', targetEntity: AdvancePayment::class, cascade: [], orphanRemoval: true)]
     private Collection $advancePayments;
 
-    #[ORM\OneToMany(mappedBy: 'author', targetEntity: AbstractMessage::class, cascade: [], orphanRemoval: true)]
+    #[ORM\OneToMany(mappedBy: 'author', targetEntity: Message::class, cascade: [], orphanRemoval: true)]
     private Collection $messages;
 
     #[ORM\OneToMany(mappedBy: 'managerControl', targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
@@ -2247,29 +2249,29 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    public function getBookingOrganizers(): Collection
-    {
-        return $this->bookingOrganizers;
-    }
-
-    public function addBookingOrganizer(AbstractBooking $bookingOrganizer): self
-    {
-        if (!$this->bookingOrganizers->contains($bookingOrganizer)) {
-            $this->bookingOrganizers[] = $bookingOrganizer;
-            $bookingOrganizer->addOrganizer($this);
-        }
-
-        return $this;
-    }
-
-    public function removeBookingOrganizer(AbstractBooking $bookingOrganizer): self
-    {
-        if ($this->bookingOrganizers->removeElement($bookingOrganizer)) {
-            $bookingOrganizer->removeOrganizer($this);
-        }
-
-        return $this;
-    }
+//    public function getBookingOrganizers(): Collection
+//    {
+//        return $this->bookingOrganizers;
+//    }
+//
+//    public function addBookingOrganizer(AbstractBooking $bookingOrganizer): self
+//    {
+//        if (!$this->bookingOrganizers->contains($bookingOrganizer)) {
+//            $this->bookingOrganizers[] = $bookingOrganizer;
+//            $bookingOrganizer->addOrganizer($this);
+//        }
+//
+//        return $this;
+//    }
+//
+//    public function removeBookingOrganizer(AbstractBooking $bookingOrganizer): self
+//    {
+//        if ($this->bookingOrganizers->removeElement($bookingOrganizer)) {
+//            $bookingOrganizer->removeOrganizer($this);
+//        }
+//
+//        return $this;
+//    }
 
     public function getAdvancePayments(): Collection
     {

+ 2 - 2
src/Entity/AccessWish/EducationStudentWish.php

@@ -38,7 +38,7 @@ class EducationStudentWish
     #[ORM\Column(length: 50, enumType: RegistrationStatusEnum::class)]
     private RegistrationStatusEnum $registrationStatus;
 
-    #[ORM\ManyToOne]
+    #[ORM\ManyToOne(targetEntity: Education::class, cascade: ['persist'], inversedBy: 'educationWishes')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?Education $educationWish = null;
 
@@ -50,7 +50,7 @@ class EducationStudentWish
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?AccessWish $accessWishReregistrations = null;
 
-    #[ORM\ManyToOne]
+    #[ORM\ManyToOne(targetEntity: EducationCurriculum::class, cascade: ['persist'], inversedBy: 'educationStudentWish')]
     private ?EducationCurriculum $educationCurriculum = null;
 
     #[ORM\ManyToOne]

+ 3 - 2
src/Entity/Billing/AbstractBillAccounting.php

@@ -26,6 +26,7 @@ use Doctrine\ORM\Mapping as ORM;
         'billaccounting' => BillAccounting::class,
         'bill' => Bill::class,
         'billcredit' => BillCredit::class,
+        'advancepayment' => AdvancePayment::class,
     ]
 )]
 abstract class AbstractBillAccounting
@@ -50,7 +51,7 @@ abstract class AbstractBillAccounting
 
     #[ORM\ManyToOne(inversedBy: 'billCredits')]
     #[ORM\JoinColumn(nullable: true)]
-    protected AbstractBillAccounting $bill;
+    protected BillAccounting $bill;
 
     #[ORM\OneToMany(mappedBy: 'bill', targetEntity: BillingIntangibleExcludeDate::class, cascade: ['persist'], orphanRemoval: true)]
     protected Collection $billingIntangibleExcludeDates;
@@ -344,7 +345,7 @@ abstract class AbstractBillAccounting
         return $this->access;
     }
 
-    public function setAccess(?Access $access): self
+    public function setAccess(Access $access): self
     {
         $this->access = $access;
 

+ 0 - 2
src/Entity/Billing/AdvancePayment.php

@@ -13,6 +13,4 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Entity]
 class AdvancePayment extends AbstractBillAccounting
 {
-    #[ORM\Column(length: 255, nullable: false)]
-    protected string $discr = 'advancepayment';
 }

+ 0 - 15
src/Entity/Billing/Bill.php

@@ -14,19 +14,4 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Entity]
 class Bill extends AbstractBillAccounting
 {
-    #[ORM\ManyToOne(inversedBy: 'bills')]
-    #[ORM\JoinColumn(nullable: false)]
-    public Access $access;
-
-    public function getAccess(): Access
-    {
-        return $this->access;
-    }
-
-    public function setAccess(Access $access): self
-    {
-        $this->access = $access;
-
-        return $this;
-    }
 }

+ 1 - 1
src/Entity/Billing/BillLine.php

@@ -26,7 +26,7 @@ class BillLine
 
     #[ORM\ManyToOne(inversedBy: 'billLines')]
     #[ORM\JoinColumn(nullable: false)]
-    private AbstractBillAccounting $bill;
+    private BillAccounting $bill;
 
     #[ORM\ManyToOne(inversedBy: 'billLines')]
     private ?Access $access = null;

+ 1 - 1
src/Entity/Billing/BillPayment.php

@@ -27,7 +27,7 @@ class BillPayment
 
     #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billPayments')]
     #[ORM\JoinColumn(nullable: true)]
-    private ?AbstractBillAccounting $bill = null;
+    private BillAccounting|null $bill = null;
 
     #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billDetachedPayments')]
     #[ORM\JoinColumn(nullable: true)]

+ 7 - 6
src/Entity/Booking/Course.php

@@ -13,6 +13,7 @@ use App\Entity\Education\Education;
 use App\Entity\Education\EducationCurriculum;
 use App\Entity\Organization\Organization;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\Room;
 use App\Entity\Product\Equipment;
 use App\Repository\Booking\CourseRepository;
@@ -49,7 +50,7 @@ class Course extends AbstractBooking
 
     #[ORM\ManyToOne(inversedBy: 'courses')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    protected ?AbstractPlace $place = null;
+    protected ?Place $place = null;
 
     #[ORM\ManyToOne(inversedBy: 'courses')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
@@ -71,7 +72,7 @@ class Course extends AbstractBooking
     protected ?Education $education = null;
 
     /** @var Collection<int, EducationCurriculum> */
-    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class)]
+    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class, inversedBy: 'courses', cascade: ['persist'])]
     protected Collection $educationCurriculum;
 
     /** @var Collection<int, Access> */
@@ -82,7 +83,7 @@ class Course extends AbstractBooking
     protected Collection $students;
 
     /** @var Collection<int, Work> */
-    #[ORM\OneToMany(mappedBy: 'course', targetEntity: Work::class, cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\OneToMany(targetEntity: Work::class, mappedBy: 'course', cascade: ['persist'], orphanRemoval: true)]
     protected Collection $work;
 
     /** @var Collection<int, Equipment> */
@@ -104,7 +105,7 @@ class Course extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     protected Collection $tags;
 
-    #[ORM\OneToMany(mappedBy: 'course', targetEntity: EducationStudentWish::class, cascade: [], orphanRemoval: false)]
+    #[ORM\OneToMany(targetEntity: EducationStudentWish::class, mappedBy: 'course', cascade: [], orphanRemoval: false)]
     protected Collection $educationStudentWishes;
 
     public function __construct()
@@ -194,12 +195,12 @@ class Course extends AbstractBooking
         return $this;
     }
 
-    public function getPlace(): ?AbstractPlace
+    public function getPlace(): ?Place
     {
         return $this->place;
     }
 
-    public function setPlace(?AbstractPlace $place): self
+    public function setPlace(?Place $place): self
     {
         $this->place = $place;
 

+ 35 - 5
src/Entity/Booking/EducationalProject.php

@@ -14,8 +14,10 @@ use App\Entity\Core\File;
 use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -86,8 +88,7 @@ class EducationalProject extends AbstractBooking
 
     #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    protected ?AbstractPlace $place = null;
-    protected AbstractPlace $place;
+    protected ?Place $place = null;
 
     #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
@@ -110,6 +111,12 @@ class EducationalProject extends AbstractBooking
     #[ORM\OneToOne(targetEntity: EducationalProjectAge::class, cascade: ['persist'])]
     protected EducationalProjectAge $ageDistribution;
 
+    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_equipment')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'equipment_id')]
+    protected Collection $equipments;
+
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();
@@ -123,7 +130,6 @@ class EducationalProject extends AbstractBooking
         $this->organizer = new ArrayCollection();
         $this->tags = new ArrayCollection();
         $this->equipments = new ArrayCollection();
-        parent::__construct();
     }
 
     /**
@@ -414,12 +420,12 @@ class EducationalProject extends AbstractBooking
         return $this;
     }
 
-    public function getPlace(): ?AbstractPlace
+    public function getPlace(): ?Place
     {
         return $this->place;
     }
 
-    public function setPlace(?AbstractPlace $place): self
+    public function setPlace(?Place $place): self
     {
         $this->place = $place;
 
@@ -497,4 +503,28 @@ class EducationalProject extends AbstractBooking
 
         return $this;
     }
+
+    function getEquipments(): Collection
+    {
+        return $this->equipments;
+    }
+
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+//            $equipment->addXXX($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
+    {
+        if ($this->equipments->removeElement($equipment)) {
+//            $equipment->removeXXXX($this);
+        }
+
+        return $this;
+    }
 }

+ 26 - 7
src/Entity/Booking/Event.php

@@ -12,9 +12,11 @@ use App\Entity\Core\File;
 use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\PlaceSystem;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -36,7 +38,7 @@ class Event extends AbstractBooking
 
     #[ORM\ManyToOne(inversedBy: 'events')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    protected AbstractPlace $place;
+    protected ?Place $place;
 
     #[ORM\ManyToOne(inversedBy: 'events')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
@@ -97,6 +99,12 @@ class Event extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'organizer_id', referencedColumnName: 'id')]
     protected Collection $organizer;
 
+    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_equipment')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'equipment_id')]
+    protected Collection $equipments;
+
     /** @var Collection<int, Tagg> */
     #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'events', cascade: ['persist'])]
     #[ORM\JoinTable(name: 'tag_booking')]
@@ -116,7 +124,6 @@ class Event extends AbstractBooking
         $this->organizer = new ArrayCollection();
         $this->tags = new ArrayCollection();
         $this->equipments = new ArrayCollection();
-        parent::__construct();
     }
 
     public function getOrganization(): ?Organization
@@ -131,12 +138,12 @@ class Event extends AbstractBooking
         return $this;
     }
 
-    public function getPlace(): ?AbstractPlace
+    public function getPlace(): ?Place
     {
         return $this->place;
     }
 
-    public function setPlace(?AbstractPlace $place): self
+    public function setPlace(?Place $place): self
     {
         $this->place = $place;
 
@@ -449,14 +456,26 @@ class Event extends AbstractBooking
         return $this;
     }
 
-    public function getEquipments(): Collection
+    function getEquipments(): Collection
     {
         return $this->equipments;
     }
 
-    public function setEquipments(Collection $equipments): self
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+//            $equipment->addXXX($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
     {
-        $this->equipments = $equipments;
+        if ($this->equipments->removeElement($equipment)) {
+//            $equipment->removeXXXX($this);
+        }
 
         return $this;
     }

+ 64 - 2
src/Entity/Booking/Examen.php

@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Booking;
 
 use ApiPlatform\Metadata\ApiResource;
+use App\Entity\Access\Access;
 use App\Entity\Billing\ResidenceArea;
 use App\Entity\Core\Tagg;
 use App\Entity\Education\Education;
@@ -12,8 +13,10 @@ use App\Entity\Education\EducationCurriculum;
 use App\Entity\Organization\Jury;
 use App\Entity\Organization\Organization;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -53,7 +56,7 @@ class Examen extends AbstractBooking
     protected Education $education;
 
     /** @var Collection<int, EducationCurriculum> */
-    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class)]
+    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class, inversedBy: 'examens', cascade: ['persist'])]
     protected Collection $educationCurriculum;
 
     /** @var Collection<int, ExamenConvocation> */
@@ -67,12 +70,18 @@ class Examen extends AbstractBooking
 
     #[ORM\ManyToOne(inversedBy: 'examens')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    protected AbstractPlace $place;
+    protected Place $place;
 
     #[ORM\ManyToOne(inversedBy: 'examens')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     protected ?Room $room = null;
 
+    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_equipment')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'equipment_id')]
+    protected Collection $equipments;
+
     /** @var Collection<int, Tagg> */
     #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'examens', cascade: ['persist'])]
     #[ORM\JoinTable(name: 'tag_booking')]
@@ -309,6 +318,59 @@ class Examen extends AbstractBooking
         return $this;
     }
 
+    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_organizer')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    protected Collection $organizer;
+
+    function getOrganizer(): Collection
+    {
+        return $this->organizer;
+    }
+
+    function addOrganizer(Access $organizer): self
+    {
+        if (!$this->organizer->contains($organizer)) {
+            $this->organizer[] = $organizer;
+            $organizer->addPracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function removeOrganizer(Access $organizer): self
+    {
+        if ($this->organizer->removeElement($organizer)) {
+            $organizer->removePracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function getEquipments(): Collection
+    {
+        return $this->equipments;
+    }
+
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+//            $equipment->addXXX($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
+    {
+        if ($this->equipments->removeElement($equipment)) {
+//            $equipment->removeXXXX($this);
+        }
+
+        return $this;
+    }
+
     /**
      * @return Collection<int, Tagg>
      */

+ 92 - 1
src/Entity/Booking/OrganizationHoliday.php

@@ -5,9 +5,12 @@ declare(strict_types=1);
 namespace App\Entity\Booking;
 
 use ApiPlatform\Metadata\ApiResource;
+use App\Entity\Access\Access;
 use App\Entity\Billing\ResidenceArea;
+use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -31,13 +34,29 @@ class OrganizationHoliday extends AbstractBooking
     #[ORM\JoinColumn(nullable: false)]
     private Organization $organization;
 
+    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_organizer')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    protected Collection $organizer;
+
+    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_equipment')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'equipment_id')]
+    protected Collection $equipments;
+
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'bookings', cascade: ['persist'], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'tag_booking')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'tag_id')]
+    protected Collection $tags;
+
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();
         $this->organizer = new ArrayCollection();
         $this->equipments = new ArrayCollection();
         $this->tags = new ArrayCollection();
-        parent::__construct();
     }
 
     /**
@@ -81,4 +100,76 @@ class OrganizationHoliday extends AbstractBooking
 
         return $this;
     }
+
+    function getOrganizer(): Collection
+    {
+        return $this->organizer;
+    }
+
+    function addOrganizer(Access $organizer): self
+    {
+        if (!$this->organizer->contains($organizer)) {
+            $this->organizer[] = $organizer;
+            $organizer->addPracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function removeOrganizer(Access $organizer): self
+    {
+        if ($this->organizer->removeElement($organizer)) {
+            $organizer->removePracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function getEquipments(): Collection
+    {
+        return $this->equipments;
+    }
+
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+//            $equipment->addXXX($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
+    {
+        if ($this->equipments->removeElement($equipment)) {
+//            $equipment->removeXXXX($this);
+        }
+
+        return $this;
+    }
+
+    function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+            $tag->addBooking($this);
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeBooking($this);
+        }
+
+        return $this;
+    }
 }

+ 92 - 1
src/Entity/Booking/PersonHoliday.php

@@ -8,7 +8,9 @@ use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Access\Access;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use App\Entity\Billing\ResidenceArea;
+use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
+use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -35,13 +37,29 @@ class PersonHoliday extends AbstractBooking
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
     protected Organization $organization;
 
+    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_organizer')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    protected Collection $organizer;
+
+    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'booking_equipment')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'equipment_id')]
+    protected Collection $equipments;
+
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'bookings', cascade: ['persist'], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'tag_booking')]
+    #[ORM\JoinColumn(name: 'booking_id')]
+    #[ORM\InverseJoinColumn(name: 'tag_id')]
+    protected Collection $tags;
+
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();
         $this->organizer = new ArrayCollection();
         $this->equipments = new ArrayCollection();
         $this->tags = new ArrayCollection();
-        parent::__construct();
     }
 
     /**
@@ -97,4 +115,77 @@ class PersonHoliday extends AbstractBooking
 
         return $this;
     }
+
+    function getOrganizer(): Collection
+    {
+        return $this->organizer;
+    }
+
+    function addOrganizer(Access $organizer): self
+    {
+        if (!$this->organizer->contains($organizer)) {
+            $this->organizer[] = $organizer;
+            $organizer->addPracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function removeOrganizer(Access $organizer): self
+    {
+        if ($this->organizer->removeElement($organizer)) {
+            $organizer->removePracticalCourse($this);
+        }
+
+        return $this;
+    }
+
+    function getEquipments(): Collection
+    {
+        return $this->equipments;
+    }
+
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+            $equipment->addXXXX($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
+    {
+        if ($this->equipments->removeElement($equipment)) {
+            $equipment->removeXXXX($this);
+        }
+
+        return $this;
+    }
+
+    function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+            $tag->addBooking($this);
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeBooking($this);
+        }
+
+        return $this;
+    }
+
 }

+ 1 - 0
src/Entity/Core/AbstractControl.php

@@ -13,6 +13,7 @@ use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 #[ORM\MappedSuperclass]
+#[ORM\Table(name: 'Control')]
 #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
 #[ORM\DiscriminatorMap(
     [

+ 0 - 32
src/Entity/Core/AbstractRepair.php

@@ -27,40 +27,8 @@ abstract class AbstractRepair
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'repairs', cascade: ['persist'], orphanRemoval: false)]
-    protected Collection $tags;
-
-    public function __construct()
-    {
-        $this->tags = new ArrayCollection();
-    }
-
     public function getId(): ?int
     {
         return $this->id;
     }
-
-    public function getTags(): Collection
-    {
-        return $this->tags;
-    }
-
-    public function addTag(Tagg $tag): self
-    {
-        if (!$this->tags->contains($tag)) {
-            $this->tags[] = $tag;
-            $tag->addRepair($this);
-        }
-
-        return $this;
-    }
-
-    public function removeTag(Tagg $tag): self
-    {
-        if ($this->tags->removeElement($tag)) {
-            $tag->removeRepair($this);
-        }
-
-        return $this;
-    }
 }

+ 5 - 4
src/Entity/Core/AddressPostal.php

@@ -10,6 +10,7 @@ use App\Entity\Organization\OrganizationAddressPostal;
 use App\Entity\Person\PersonAddressPostal;
 use App\Entity\Place\AbstractPlace;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Place\Place;
 use App\Entity\Traits\CreatedOnAndByTrait;
 use App\Repository\Core\AddressPostalRepository;
 use Doctrine\Common\Collections\ArrayCollection;
@@ -80,7 +81,7 @@ class AddressPostal
     private ?PersonAddressPostal $personAddressPostal = null;
 
     /** @var Collection<int, Place> */
-    #[ORM\OneToMany(mappedBy: 'addressPostal', targetEntity: AbstractPlace::class)]
+    #[ORM\OneToMany(mappedBy: 'addressPostal', targetEntity: Place::class)]
     private Collection $places;
 
     #[ORM\OneToMany(mappedBy: 'addressPostal', targetEntity: OrganizationAddressPostal::class, cascade: [], orphanRemoval: false)]
@@ -230,14 +231,14 @@ class AddressPostal
     }
 
     /**
-     * @return Collection<int, AbstractPlace>
+     * @return Collection<int, Place>
      */
     public function getPlaces(): Collection
     {
         return $this->places;
     }
 
-    public function addPlace(AbstractPlace $place): self
+    public function addPlace(Place $place): self
     {
         if (!$this->places->contains($place)) {
             $this->places[] = $place;
@@ -247,7 +248,7 @@ class AddressPostal
         return $this;
     }
 
-    public function removePlace(AbstractPlace $place): self
+    public function removePlace(Place $place): self
     {
         if ($this->places->removeElement($place)) {
             // set the owning side to null (unless already changed)

+ 6 - 5
src/Entity/Core/ContactPoint.php

@@ -10,6 +10,7 @@ use App\Entity\Organization\Organization;
 use App\Entity\Person\Person;
 use App\Entity\Place\AbstractPlace;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Place\Place;
 use App\Entity\Traits\CreatedOnAndByTrait;
 use App\Enum\Core\ContactPointTypeEnum;
 use App\Repository\Core\ContactPointRepository;
@@ -83,8 +84,8 @@ class ContactPoint
     #[ORM\InverseJoinColumn(name: 'person_id', referencedColumnName: 'id')]
     private Collection $person;
 
-    /** @var Collection<int, AbstractPlace> */
-    #[ORM\ManyToMany(targetEntity: AbstractPlace::class, mappedBy: 'contactpoint')]
+    /** @var Collection<int, Place> */
+    #[ORM\ManyToMany(targetEntity: Place::class, mappedBy: 'contactpoint')]
     private Collection $place;
 
     #[Pure]
@@ -269,14 +270,14 @@ class ContactPoint
     }
 
     /**
-     * @return Collection<int, AbstractPlace>
+     * @return Collection<int, Place>
      */
     public function getPlace(): Collection
     {
         return $this->place;
     }
 
-    public function addPlace(AbstractPlace $place): self
+    public function addPlace(Place $place): self
     {
         if (!$this->place->contains($place)) {
             $this->place[] = $place;
@@ -286,7 +287,7 @@ class ContactPoint
         return $this;
     }
 
-    public function removePlace(AbstractPlace $place): self
+    public function removePlace(Place $place): self
     {
         if ($this->place->removeElement($place)) {
             $place->removeContactpoint($this);

+ 8 - 7
src/Entity/Core/Tagg.php

@@ -30,6 +30,7 @@ use App\Entity\Organization\Jury;
 use App\Entity\Organization\Organization;
 use App\Entity\Person\Commission;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\PlaceControl;
 use App\Entity\Place\PlaceRepair;
 use App\Entity\Product\AbstractProduct;
@@ -68,8 +69,8 @@ class Tagg
     #[ORM\ManyToMany(targetEntity: Organization::class, mappedBy: 'tags')]
     protected Collection $organizations;
 
-    /** @var Collection<int, AbstractBillAccounting> */
-    #[ORM\ManyToMany(targetEntity: AbstractBillAccounting::class, mappedBy: 'tags')]
+    /** @var Collection<int, BillAccounting> */
+    #[ORM\ManyToMany(targetEntity: BillAccounting::class, mappedBy: 'tags')]
     protected Collection $billAccountings;
 
     /** @var Collection<int, Equipment> */
@@ -152,8 +153,8 @@ class Tagg
     #[ORM\ManyToMany(targetEntity: EquipmentLoan::class, mappedBy: 'tags')]
     protected Collection $equipmentLoans;
 
-    /** @var Collection<int, AbstractPlace> */
-    #[ORM\ManyToMany(targetEntity: AbstractPlace::class, mappedBy: 'tags')]
+    /** @var Collection<int, Place> */
+    #[ORM\ManyToMany(targetEntity: Place::class, mappedBy: 'tags')]
     protected Collection $places;
 
     /** @var Collection<int, Email> */
@@ -862,14 +863,14 @@ class Tagg
     }
 
     /**
-     * @return Collection<int, AbstractPlace>
+     * @return Collection<int, Place>
      */
     public function getPlaces(): Collection
     {
         return $this->places;
     }
 
-    public function addPlace(AbstractPlace $place): self
+    public function addPlace(Place $place): self
     {
         if (!$this->places->contains($place)) {
             $this->places[] = $place;
@@ -879,7 +880,7 @@ class Tagg
         return $this;
     }
 
-    public function removePlace(AbstractPlace $place): self
+    public function removePlace(Place $place): self
     {
         if ($this->places->removeElement($place)) {
             $place->removeTag($this);

+ 1 - 1
src/Entity/Education/Cycle.php

@@ -67,7 +67,7 @@ class Cycle
     #[ORM\OneToMany(targetEntity: CycleByEducation::class, mappedBy: 'cycle', orphanRemoval: true)]
     private Collection $cycleByEducations;
 
-    #[ORM\OneToMany(mappedBy: 'cycle', targetEntity: EducationCurriculum::class, cascade: [], orphanRemoval: false)]
+    #[ORM\OneToMany(targetEntity: EducationCurriculum::class, mappedBy: 'cycle', cascade: [], orphanRemoval: false)]
     protected Collection $educationCurriculums;
 
     public function __construct()

+ 2 - 2
src/Entity/Education/Education.php

@@ -40,7 +40,7 @@ class Education
     #[ORM\JoinColumn(nullable: false)]
     private EducationCategory $educationCategory;
 
-    #[ORM\ManyToOne(fetch: 'EAGER')]
+    #[ORM\ManyToOne(targetEntity: EducationComplement::class, fetch: 'EAGER', inversedBy: 'educations')]
     #[ORM\JoinColumn(nullable: false)]
     private EducationComplement $educationComplement;
 
@@ -67,7 +67,7 @@ class Education
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?EducationNotationConfig $educationNotationConfig = null;
 
-    #[ORM\OneToMany(mappedBy: 'educationWish', targetEntity: EducationStudentWish::class, cascade: [], orphanRemoval: true)]
+    #[ORM\OneToMany(targetEntity: EducationStudentWish::class, mappedBy: 'educationWish', cascade: [], orphanRemoval: true)]
     protected Collection $educationWishes;
 
     public function __construct()

+ 1 - 1
src/Entity/Education/EducationComplement.php

@@ -23,7 +23,7 @@ class EducationComplement
     #[ORM\GeneratedValue]
     private ?int $id = null;
 
-    #[ORM\OneToMany(mappedBy: 'educationComplement', targetEntity: Education::class, cascade: [], orphanRemoval: true)]
+    #[ORM\OneToMany(targetEntity: Education::class, mappedBy: 'educationComplement', cascade: [], orphanRemoval: true)]
     protected Collection $educations;
 
     public function __construct()

+ 4 - 4
src/Entity/Education/EducationCurriculum.php

@@ -29,14 +29,14 @@ class EducationCurriculum
     #[ORM\GeneratedValue]
     private ?int $id = null;
 
-    #[ORM\ManyToOne(inversedBy: 'educationCurriculums')]
+    #[ORM\ManyToOne(targetEntity: EducationNotationConfig::class, inversedBy: 'educationCurriculums')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?EducationNotationConfig $educationNotationConfig;
 
-    #[ORM\ManyToOne(inversedBy: 'educationCurriculums')]
+    #[ORM\ManyToOne(targetEntity: Education::class, inversedBy: 'educationCurriculums')]
     private ?Education $education = null;
 
-    #[ORM\ManyToOne]
+    #[ORM\ManyToOne(targetEntity: Cycle::class, inversedBy: 'educationCurriculums')]
     private ?Cycle $cycle = null;
 
     /** @var Collection<int, EducationStudent> */
@@ -49,7 +49,7 @@ class EducationCurriculum
     #[ORM\InverseJoinColumn(name: 'educationTiming_id', referencedColumnName: 'id')]
     private Collection $educationTimings;
 
-    #[ORM\OneToMany(mappedBy: 'educationCurriculum', targetEntity: EducationStudentWish::class, cascade: [], orphanRemoval: false)]
+    #[ORM\OneToMany(targetEntity: EducationStudentWish::class, mappedBy: 'educationCurriculum', cascade: [], orphanRemoval: false)]
     protected Collection $educationStudentWish;
 
     #[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'educationCurriculum', cascade: [], orphanRemoval: false)]

+ 2 - 2
src/Entity/Message/AbstractReport.php

@@ -22,10 +22,10 @@ class AbstractReport
     #[ORM\Column(length: 50, enumType: ReportMessageStatusEnum::class)]
     protected ReportMessageStatusEnum $status;
 
-    #[ORM\ManyToOne(inversedBy: 'report')]
+    #[ORM\ManyToOne(targetEntity: Access::class, inversedBy: 'report')]
     protected ?Access $access;
 
-    #[ORM\ManyToOne(inversedBy: 'report')]
+    #[ORM\ManyToOne(targetEntity: Organization::class, inversedBy: 'report')]
     protected ?Organization $organization;
 
     /**

+ 119 - 0
src/Entity/Message/Message.php

@@ -0,0 +1,119 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Entity\Message;
+
+use ApiPlatform\Metadata\ApiResource;
+use App\Entity\Access\Access;
+use App\Entity\Core\File;
+use App\Entity\Core\Tagg;
+// use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Education\EducationStudent;
+use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\Common\Collections\Collection;
+use Doctrine\ORM\Mapping as ORM;
+use Ramsey\Uuid\Uuid;
+
+/**
+ * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table Email, et supprimer l'attribut discr.
+ * @todo : migration table tag_message
+ *
+ * Classe ... qui ...
+ */
+// #[Auditable]
+#[ApiResource(operations: [])]
+#[ORM\Table(name: 'Message')]
+#[ORM\Entity]
+class Message extends AbstractMessage
+{
+    #[ORM\ManyToOne(inversedBy: 'emails')]
+    #[ORM\JoinColumn(nullable: true)]
+    private ?Access $author = null;
+
+    /** @var Collection<int, ReportEmail> */
+    #[ORM\OneToMany(targetEntity: ReportEmail::class, mappedBy: 'email', cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\JoinColumn(onDelete: 'cascade')]
+    private Collection $reports;
+
+    /** @var Collection<int, Tagg> */
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'emails', cascade: ['persist'])]
+    #[ORM\JoinTable(name: 'tag_message')]
+    #[ORM\JoinColumn(name: 'message_id', referencedColumnName: 'id', onDelete: 'cascade')]
+    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id', onDelete: 'cascade')]
+    protected Collection $tags;
+
+    public function __construct()
+    {
+        $this->uuid = Uuid::uuid4();
+        $this->reports = new ArrayCollection();
+        $this->tags = new ArrayCollection();
+        parent::__construct();
+    }
+
+    public function getAuthor(): ?Access
+    {
+        return $this->author;
+    }
+
+    public function setAuthor(?Access $author): self
+    {
+        $this->author = $author;
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, ReportEmail>
+     */
+    public function getReports(): Collection
+    {
+        return $this->reports;
+    }
+
+    public function addReport(ReportEmail $report): self
+    {
+        if (!$this->reports->contains($report)) {
+            $this->reports[] = $report;
+            $report->setEmail($this);
+        }
+
+        return $this;
+    }
+
+    public function removeReport(ReportEmail $report): self
+    {
+        if ($this->reports->removeElement($report)) {
+            // set the owning side to null (unless already changed)
+            if ($report->getEmail() === $this) {
+                $report->setEmail(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Tagg>
+     */
+    public function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    public function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+        }
+
+        return $this;
+    }
+
+    public function removeTag(Tagg $tag): self
+    {
+        $this->tags->removeElement($tag);
+
+        return $this;
+    }
+}

+ 1 - 1
src/Entity/Message/ReportMessage.php

@@ -18,7 +18,7 @@ class ReportMessage
     #[ORM\GeneratedValue]
     private int $id;
 
-    #[ORM\ManyToOne(targetEntity: AbstractMessage::class, cascade: [], inversedBy: 'reportMessage')]
+    #[ORM\ManyToOne(targetEntity: Message::class, cascade: [], inversedBy: 'reportMessage')]
     public mixed $message;
 
     #[ORM\ManyToOne(targetEntity: Access::class, cascade: [])]

+ 1 - 3
src/Entity/Place/PlaceControl.php

@@ -21,11 +21,10 @@ use Doctrine\ORM\Mapping as ORM;
 // #[Auditable]
 #[ApiResource(operations: [])]
 #[ORM\Entity]
-#[ORM\Table(name: 'Control')]
 class PlaceControl extends AbstractControl
 {
     #[ORM\ManyToOne(inversedBy: 'controls')]
-    protected AbstractPlace $place;
+    protected Place $place;
 
     /** @var Collection<int, Tagg> */
     #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'placeControls', cascade: ['persist'])]
@@ -37,7 +36,6 @@ class PlaceControl extends AbstractControl
     public function __construct()
     {
         $this->tags = new ArrayCollection();
-        parent::__construct();
     }
 
     public function getPlace(): ?AbstractPlace

+ 2 - 2
src/Entity/Place/Room.php

@@ -29,8 +29,8 @@ class Room
     #[ORM\GeneratedValue]
     private ?int $id = null;
 
-    #[ORM\ManyToOne(targetEntity: AbstractPlace::class, inversedBy: 'rooms')]
-    private ?AbstractPlace $place = null;
+    #[ORM\ManyToOne(targetEntity: Place::class, inversedBy: 'rooms')]
+    private ?Place $place = null;
 
     /** @var Collection<int, RoomControl> */
     #[ORM\OneToMany(targetEntity: RoomControl::class, mappedBy: 'room', cascade: ['persist'], orphanRemoval: true)]

+ 0 - 1
src/Entity/Place/RoomControl.php

@@ -19,7 +19,6 @@ use Doctrine\ORM\Mapping as ORM;
 // #[Auditable]
 #[ApiResource(operations: [])]
 #[ORM\Entity]
-#[ORM\Table(name: 'Control')]
 class RoomControl extends AbstractControl
 {
     #[ORM\ManyToOne(inversedBy: 'controls')]

+ 38 - 0
src/Entity/Place/RoomRepair.php

@@ -8,6 +8,9 @@ use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Access\Access;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use App\Entity\Core\AbstractRepair;
+use App\Entity\Core\Tagg;
+use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -28,6 +31,17 @@ class RoomRepair extends AbstractRepair
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?Access $provider = null;
 
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'repairs', cascade: ['persist'], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'tag_repair')]
+    #[ORM\JoinColumn(name: 'repair_id')]
+    #[ORM\InverseJoinColumn(name: 'tag_id')]
+    protected Collection $tags;
+
+    public function __construct()
+    {
+        $this->tags = new ArrayCollection();
+    }
+
     public function getRoom(): ?Room
     {
         return $this->room;
@@ -51,4 +65,28 @@ class RoomRepair extends AbstractRepair
 
         return $this;
     }
+
+    function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+            $tag->addRepair($this);
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeRepair($this);
+        }
+
+        return $this;
+    }
 }

+ 4 - 34
src/Entity/Product/Equipment.php

@@ -11,6 +11,7 @@ use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 use App\Entity\Person\CommissionMember;
 use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use Doctrine\Common\Collections\ArrayCollection;
@@ -36,7 +37,7 @@ class Equipment extends AbstractProduct
 
     #[ORM\ManyToOne(inversedBy: 'equipmentStorages')]
     #[ORM\JoinColumn(name: 'place_storage_id', nullable: true, onDelete: 'SET NULL')]
-    protected ?AbstractPlace $placeStorage = null;
+    protected ?Place $placeStorage = null;
 
     #[ORM\ManyToOne(inversedBy: 'equipmentStorages')]
     #[ORM\JoinColumn(name: 'room_storage_id', nullable: true, onDelete: 'SET NULL')]
@@ -92,13 +93,6 @@ class Equipment extends AbstractProduct
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     protected ?Access $managerControl = null;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'equipments', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_product')]
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     #[ORM\OneToMany(mappedBy: 'children', targetEntity: EquipmentComposition::class, cascade: [], orphanRemoval: true)]
     protected Collection $equipmentCompositionChildren;
 
@@ -146,12 +140,12 @@ class Equipment extends AbstractProduct
         return $this;
     }
 
-    public function getPlaceStorage(): ?AbstractPlace
+    public function getPlaceStorage(): ?Place
     {
         return $this->placeStorage;
     }
 
-    public function setPlaceStorage(?AbstractPlace $placeStorage): self
+    public function setPlaceStorage(?Place $placeStorage): self
     {
         $this->placeStorage = $placeStorage;
 
@@ -398,30 +392,6 @@ class Equipment extends AbstractProduct
         return $this;
     }
 
-    public function getTags(): Collection
-    {
-        return $this->tags;
-    }
-
-    public function addTag(Tagg $tag): self
-    {
-        if (!$this->tags->contains($tag)) {
-            $this->tags[] = $tag;
-            $tag->addProduct($this);
-        }
-
-        return $this;
-    }
-
-    public function removeTag(Tagg $tag): self
-    {
-        if ($this->tags->removeElement($tag)) {
-            $tag->removeProduct($this);
-        }
-
-        return $this;
-    }
-
     public function getEquipmentCompositionChildren(): Collection
     {
         return $this->equipmentCompositionChildren;

+ 0 - 1
src/Entity/Product/EquipmentControl.php

@@ -21,7 +21,6 @@ use Doctrine\ORM\Mapping as ORM;
 // #[Auditable]
 #[ApiResource(operations: [])]
 #[ORM\Entity]
-#[ORM\Table(name: 'Control')]
 class EquipmentControl extends AbstractControl
 {
     #[ORM\ManyToOne(inversedBy: 'equipmentControl')]

+ 3 - 35
src/Entity/Product/Intangible.php

@@ -31,31 +31,23 @@ class Intangible extends AbstractProduct
     protected ?Organization $organization = null;
 
     /** @var Collection<int, EducationCurriculum> */
-    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class)]
+    #[ORM\ManyToMany(targetEntity: EducationCurriculum::class, inversedBy: 'intangibles', cascade: ['persist'])]
     protected Collection $educationCurriculums;
 
     /** @var Collection<int, AccessIntangible> */
-    #[ORM\OneToMany(mappedBy: 'intangible', targetEntity: AccessIntangible::class, cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\OneToMany(targetEntity: AccessIntangible::class, mappedBy: 'intangible', cascade: ['persist'], orphanRemoval: true)]
     protected Collection $accessIntangibles;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'intangibles', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_product')]
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     #[ORM\ManyToMany(targetEntity: EducationCurriculumPack::class, inversedBy: 'intangibles', cascade: [], orphanRemoval: false)]
     protected Collection $educationCurriculumPacks;
 
-    #[ORM\OneToOne(inversedBy: 'intangible', targetEntity: IntangiblePriceAndDiscount::class, cascade: ['persist'])]
+    #[ORM\OneToOne(targetEntity: IntangiblePriceAndDiscount::class, inversedBy: 'intangible', cascade: ['persist'])]
     protected IntangiblePriceAndDiscount $intangiblePriceAndDiscount;
 
     public function __construct()
     {
         $this->educationCurriculums = new ArrayCollection();
         $this->accessIntangibles = new ArrayCollection();
-        $this->tags = new ArrayCollection();
         $this->educationCurriculumPacks = new ArrayCollection();
         $this->intangiblePriceAndDiscount = new IntangiblePriceAndDiscount();
         parent::__construct();
@@ -127,30 +119,6 @@ class Intangible extends AbstractProduct
         return $this;
     }
 
-    /**
-     * @return Collection<int, Tagg>
-     */
-    public function getTags(): Collection
-    {
-        return $this->tags;
-    }
-
-    public function addTag(Tagg $tag): self
-    {
-        if (!$this->tags->contains($tag)) {
-            $this->tags[] = $tag;
-        }
-
-        return $this;
-    }
-
-    public function removeTag(Tagg $tag): self
-    {
-        $this->tags->removeElement($tag);
-
-        return $this;
-    }
-
     public function getEducationCurriculumPacks(): Collection
     {
         return $this->educationCurriculumPacks;

+ 8 - 8
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -9,7 +9,7 @@ use App\Service\Utils\EntityUtils;
 use App\Service\Utils\FileUtils;
 use App\Service\Utils\Path;
 use Doctrine\Common\Collections\Collection;
-use Doctrine\ORM\Mapping\ClassMetadataInfo;
+use Doctrine\ORM\Mapping\ClassMetadata;
 use Doctrine\ORM\Mapping\Column;
 use Doctrine\ORM\Mapping\Entity;
 use Doctrine\ORM\Mapping\InverseJoinColumn;
@@ -237,7 +237,7 @@ class SchemaSnippetsMaker
         foreach ($differences as $field => $difference) {
             if (
                 !is_array($difference->getExpectedType())
-                || !in_array(isset($difference->getExpectedType()['type']), [ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::MANY_TO_ONE])
+                || !in_array(isset($difference->getExpectedType()['type']), [ClassMetadata::ONE_TO_ONE, ClassMetadata::MANY_TO_ONE])
                 || !isset($difference->getExpectedType()['targetEntity'])
             ) {
                 continue;
@@ -399,7 +399,7 @@ class SchemaSnippetsMaker
 
         if (
             isset($type['type'])
-            && $type['type'] === ClassMetadataInfo::ONE_TO_ONE || $type['type'] === ClassMetadataInfo::MANY_TO_ONE
+            && $type['type'] === ClassMetadata::ONE_TO_ONE || $type['type'] === ClassMetadata::MANY_TO_ONE
         ) {
             $targetEntityName = $this->getRelationTargetEntityName($type);
             $prop->setType($targetEntityName);
@@ -448,15 +448,15 @@ class SchemaSnippetsMaker
             $options['inversedBy'] = $type['inversedBy'];
         }
 
-        if (isset($type['orphanRemoval']) && ($type['type'] === ClassMetadataInfo::ONE_TO_MANY || $type['type'] === ClassMetadataInfo::MANY_TO_MANY)) {
+        if (isset($type['orphanRemoval']) && ($type['type'] === ClassMetadata::ONE_TO_MANY || $type['type'] === ClassMetadata::MANY_TO_MANY)) {
             $options['orphanRemoval'] = $type['orphanRemoval'];
         }
 
         $relationClassNames = [
-            ClassMetadataInfo::ONE_TO_MANY => OneToMany::class,
-            ClassMetadataInfo::MANY_TO_MANY => ManyToMany::class,
-            ClassMetadataInfo::MANY_TO_ONE => ManyToOne::class,
-            ClassMetadataInfo::ONE_TO_ONE => OneToOne::class,
+            ClassMetadata::ONE_TO_MANY => OneToMany::class,
+            ClassMetadata::MANY_TO_MANY => ManyToMany::class,
+            ClassMetadata::MANY_TO_ONE => ManyToOne::class,
+            ClassMetadata::ONE_TO_ONE => OneToOne::class,
         ];
 
         return new Attribute($relationClassNames[$type['type']], $options);

+ 5 - 5
src/Service/Doctrine/SchemaValidation/SchemaValidationService.php

@@ -7,7 +7,7 @@ namespace App\Service\Doctrine\SchemaValidation;
 use App\Service\ApiLegacy\ApiLegacyRequestService;
 use App\Service\Utils\EntityUtils;
 use Doctrine\ORM\EntityManagerInterface;
-use Doctrine\ORM\Mapping\ClassMetadataInfo;
+use Doctrine\ORM\Mapping\ClassMetadata;
 use Doctrine\ORM\Mapping\MappingException;
 use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
 use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
@@ -278,10 +278,10 @@ class SchemaValidationService
     protected function getRelationTypeLabel(array $relation): string
     {
         return [
-            ClassMetadataInfo::ONE_TO_ONE => 'OneToOne',
-            ClassMetadataInfo::MANY_TO_ONE => 'ManyToOne',
-            ClassMetadataInfo::ONE_TO_MANY => 'OneToMany',
-            ClassMetadataInfo::MANY_TO_MANY => 'ManyToMany',
+            ClassMetadata::ONE_TO_ONE => 'OneToOne',
+            ClassMetadata::MANY_TO_ONE => 'ManyToOne',
+            ClassMetadata::ONE_TO_MANY => 'OneToMany',
+            ClassMetadata::MANY_TO_MANY => 'ManyToMany',
         ][$relation['type']] ?? 'Unknown';
     }