Browse Source

Schema snippets : fix adders and removers, and update entities

Olivier Massot 11 tháng trước cách đây
mục cha
commit
4fd654347b
31 tập tin đã thay đổi với 498 bổ sung104 xóa
  1. 105 15
      src/Entity/Access/Access.php
  2. 7 4
      src/Entity/Billing/AbstractBillAccounting.php
  3. 15 2
      src/Entity/Billing/Afi.php
  4. 47 8
      src/Entity/Billing/BillSchedule.php
  5. 2 1
      src/Entity/Billing/BillingExportSetting.php
  6. 13 2
      src/Entity/Billing/CirilCivil.php
  7. 28 4
      src/Entity/Billing/FamilyQuotientBand.php
  8. 1 0
      src/Entity/Billing/FamilyQuotientBandDetail.php
  9. 8 2
      src/Entity/Billing/FamilyQuotientModel.php
  10. 4 1
      src/Entity/Billing/Odyssee.php
  11. 4 1
      src/Entity/Billing/SddBank.php
  12. 4 1
      src/Entity/Billing/SddRegie.php
  13. 6 3
      src/Entity/Core/AbstractControl.php
  14. 4 1
      src/Entity/Core/AbstractRepair.php
  15. 4 1
      src/Entity/Core/AddressPostal.php
  16. 5 3
      src/Entity/Core/File.php
  17. 26 8
      src/Entity/Core/Tagg.php
  18. 4 1
      src/Entity/Education/Cycle.php
  19. 8 5
      src/Entity/Education/Education.php
  20. 4 1
      src/Entity/Education/EducationComplement.php
  21. 48 6
      src/Entity/Education/EducationCurriculum.php
  22. 20 5
      src/Entity/Education/EducationCurriculumPack.php
  23. 10 4
      src/Entity/Message/AbstractMessage.php
  24. 41 10
      src/Entity/Organization/Organization.php
  25. 6 3
      src/Entity/Person/Person.php
  26. 32 0
      src/Entity/Place/RoomControl.php
  27. 4 1
      src/Entity/Product/AbstractProduct.php
  28. 16 4
      src/Entity/Product/Equipment.php
  29. 6 3
      src/Entity/Product/Intangible.php
  30. 1 1
      src/Entity/Product/IntangiblePriceAndDiscount.php
  31. 15 3
      src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

+ 105 - 15
src/Entity/Access/Access.php

@@ -2181,15 +2181,27 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-
     function getBookingOrganizers(): Collection
     {
         return $this->bookingOrganizers;
     }
 
-    function setBookingOrganizers(Collection $bookingOrganizers): self
+    function addBookingOrganizer(AbstractBooking $bookingOrganizer): self
     {
-        $this->bookingOrganizers = $bookingOrganizers;
+        if (!$this->bookingOrganizers->contains($bookingOrganizer)) {
+            $this->bookingOrganizers[] = $bookingOrganizer;
+            $bookingOrganizer->addOrganizer($this);
+        }
+
+        return $this;
+    }
+
+    function removeBookingOrganizer(AbstractBooking $bookingOrganizer): self
+    {
+        if ($this->bookingOrganizers->removeElement($bookingOrganizer)) {
+            $bookingOrganizer->removeOrganizer($this);
+        }
+
         return $this;
     }
 
@@ -2198,9 +2210,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->advancePayments;
     }
 
-    function setAdvancePayments(Collection $advancePayments): self
+    function addAdvancePayment(AdvancePayment $advancePayment): self
     {
-        $this->advancePayments = $advancePayments;
+        if (!$this->advancePayments->contains($advancePayment)) {
+            $this->advancePayments[] = $advancePayment;
+            $advancePayment->setAccess($this);
+        }
+
+        return $this;
+    }
+
+    function removeAdvancePayment(AdvancePayment $advancePayment): self
+    {
+        if ($this->advancePayments->removeElement($advancePayment)) {
+            $advancePayment->setAccess(null);
+        }
+
         return $this;
     }
 
@@ -2209,9 +2234,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->messages;
     }
 
-    function setMessages(Collection $messages): self
+    function addMessage(mixed $message): self
+    {
+        if (!$this->messages->contains($message)) {
+            $this->messages[] = $message;
+            $message->setAuthor($this);
+        }
+
+        return $this;
+    }
+
+    function removeMessage(mixed $message): self
     {
-        $this->messages = $messages;
+        if ($this->messages->removeElement($message)) {
+            $message->setAuthor(null);
+        }
+
         return $this;
     }
 
@@ -2220,9 +2258,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->equipmentManagerControls;
     }
 
-    function setEquipmentManagerControls(Collection $equipmentManagerControls): self
+    function addEquipmentManagerControl(Equipment $equipmentManagerControl): self
     {
-        $this->equipmentManagerControls = $equipmentManagerControls;
+        if (!$this->equipmentManagerControls->contains($equipmentManagerControl)) {
+            $this->equipmentManagerControls[] = $equipmentManagerControl;
+            $equipmentManagerControl->setManagerControl($this);
+        }
+
+        return $this;
+    }
+
+    function removeEquipmentManagerControl(Equipment $equipmentManagerControl): self
+    {
+        if ($this->equipmentManagerControls->removeElement($equipmentManagerControl)) {
+            $equipmentManagerControl->setManagerControl(null);
+        }
+
         return $this;
     }
 
@@ -2231,9 +2282,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->accompanistControl;
     }
 
-    function setAccompanistControl(Collection $accompanistControl): self
+    function addAccompanistControl(AbstractControl $accompanistControl): self
+    {
+        if (!$this->accompanistControl->contains($accompanistControl)) {
+            $this->accompanistControl[] = $accompanistControl;
+            $accompanistControl->setAccompanist($this);
+        }
+
+        return $this;
+    }
+
+    function removeAccompanistControl(AbstractControl $accompanistControl): self
     {
-        $this->accompanistControl = $accompanistControl;
+        if ($this->accompanistControl->removeElement($accompanistControl)) {
+            $accompanistControl->setAccompanist(null);
+        }
+
         return $this;
     }
 
@@ -2242,9 +2306,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->rewards;
     }
 
-    function setRewards(Collection $rewards): self
+    function addReward(AccessReward $reward): self
+    {
+        if (!$this->rewards->contains($reward)) {
+            $this->rewards[] = $reward;
+            $reward->setAccess($this);
+        }
+
+        return $this;
+    }
+
+    function removeReward(AccessReward $reward): self
     {
-        $this->rewards = $rewards;
+        if ($this->rewards->removeElement($reward)) {
+            $reward->setAccess(null);
+        }
+
         return $this;
     }
 
@@ -2297,9 +2374,22 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->tokens;
     }
 
-    function setTokens(Collection $tokens): self
+    function addToken(Token $token): self
+    {
+        if (!$this->tokens->contains($token)) {
+            $this->tokens[] = $token;
+            $token->setAccess($this);
+        }
+
+        return $this;
+    }
+
+    function removeToken(Token $token): self
     {
-        $this->tokens = $tokens;
+        if ($this->tokens->removeElement($token)) {
+            $token->setAccess(null);
+        }
+
         return $this;
     }
 }

+ 7 - 4
src/Entity/Billing/AbstractBillAccounting.php

@@ -90,7 +90,7 @@ abstract class AbstractBillAccounting
 
     #[ORM\ManyToOne(targetEntity: Odyssee::class, inversedBy: 'bills', cascade: ['persist'])]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
-    protected Odyssee $odyssee;
+    protected Odyssee $odyssee; // TODO: sûr que c'est pas nullable?
 
     #[ORM\ManyToOne(targetEntity: Afi::class, inversedBy: 'bills', cascade: ['persist'])]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
@@ -327,18 +327,21 @@ abstract class AbstractBillAccounting
         return $this->tags;
     }
 
-    public function addTag(Tagg $tag): self
+    function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addBillAccounting($this);
         }
 
         return $this;
     }
 
-    public function removeTag(Tagg $tag): self
+    function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeBillAccounting($this);
+        }
 
         return $this;
     }

+ 15 - 2
src/Entity/Billing/Afi.php

@@ -42,9 +42,22 @@ class Afi
         return $this->bills;
     }
 
-    function setBills(Collection $bills): self
+    function addBill(Bill $bill): self
     {
-        $this->bills = $bills;
+        if (!$this->bills->contains($bill)) {
+            $this->bills[] = $bill;
+            $bill->setAfi($this);
+        }
+
+        return $this;
+    }
+
+    function removeBill(Bill $bill): self
+    {
+        if ($this->bills->removeElement($bill)) {
+            $bill->setAfi(null);
+        }
+
         return $this;
     }
 

+ 47 - 8
src/Entity/Billing/BillSchedule.php

@@ -28,10 +28,10 @@ class BillSchedule
     #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: BillScheduleDate::class, cascade: ['persist'], orphanRemoval: true)]
     protected Collection $scheduleDates;
 
-    #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessBilling::class, cascade: [], orphanRemoval: false)]
+    #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessBilling::class, cascade: [], orphanRemoval: false)] // TODO: à revoir
     protected Collection $accessBilling;
 
-    #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessWish::class, cascade: [], orphanRemoval: false)]
+    #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessWish::class, cascade: [], orphanRemoval: false)] // TODO: à revoir
     protected Collection $accessWishes;
 
     function getId(): int
@@ -61,9 +61,22 @@ class BillSchedule
         return $this->scheduleDates;
     }
 
-    function setScheduleDates(Collection $scheduleDates): self
+    function addScheduleDate(BillScheduleDate $scheduleDate): self
     {
-        $this->scheduleDates = $scheduleDates;
+        if (!$this->scheduleDates->contains($scheduleDate)) {
+            $this->scheduleDates[] = $scheduleDate;
+            $scheduleDate->setBillSchedule($this);
+        }
+
+        return $this;
+    }
+
+    function removeScheduleDate(BillScheduleDate $scheduleDate): self
+    {
+        if ($this->scheduleDates->removeElement($scheduleDate)) {
+            $scheduleDate->setBillSchedule(null);
+        }
+
         return $this;
     }
 
@@ -72,9 +85,22 @@ class BillSchedule
         return $this->accessBilling;
     }
 
-    function setAccessBilling(Collection $accessBilling): self
+    function addAccessBilling(AccessBilling $accessBilling): self
+    {
+        if (!$this->accessBilling->contains($accessBilling)) {
+            $this->accessBilling[] = $accessBilling;
+            $accessBilling->setBillSchedule($this);
+        }
+
+        return $this;
+    }
+
+    function removeAccessBilling(AccessBilling $accessBilling): self
     {
-        $this->accessBilling = $accessBilling;
+        if ($this->accessBilling->removeElement($accessBilling)) {
+            $accessBilling->setBillSchedule(null);
+        }
+
         return $this;
     }
 
@@ -83,9 +109,22 @@ class BillSchedule
         return $this->accessWishes;
     }
 
-    function setAccessWishes(Collection $accessWishes): self
+    function addAccessWish(AccessWish $accessWish): self
     {
-        $this->accessWishes = $accessWishes;
+        if (!$this->accessWishes->contains($accessWish)) {
+            $this->accessWishes[] = $accessWish;
+            $accessWish->setBillSchedule($this);
+        }
+
+        return $this;
+    }
+
+    function removeAccessWish(AccessWish $accessWish): self
+    {
+        if ($this->accessWishes->removeElement($accessWish)) {
+            $accessWish->setBillSchedule(null);
+        }
+
         return $this;
     }
 }

+ 2 - 1
src/Entity/Billing/BillingExportSetting.php

@@ -74,6 +74,7 @@ class BillingExportSetting
     {
         if (!$this->stageManagers->contains($stageManager)) {
             $this->stageManagers[] = $stageManager;
+            // TODO: compléter (je n'ai pas le mappedBy)
         }
 
         return $this;
@@ -82,7 +83,7 @@ class BillingExportSetting
     function removeStageManager(Access $stageManager): self
     {
         $this->stageManagers->removeElement($stageManager);
-
+        // TODO: compléter (je n'ai pas le mappedBy)
         return $this;
     }
 }

+ 13 - 2
src/Entity/Billing/CirilCivil.php

@@ -42,9 +42,20 @@ class CirilCivil
         return $this->bills;
     }
 
-    function setBills(Collection $bills): self
+    function addBill(Bill $bill): self
     {
-        $this->bills = $bills;
+        if (!$this->bills->contains($bill)) {
+            $this->bills[] = $bill;
+            $bill->setCirilCivil($this);
+        }
+
+        return $this;
+    }
+
+    function removeBill(Bill $bill): self
+    {
+        $this->bills->removeElement($bill);
+
         return $this;
     }
 

+ 28 - 4
src/Entity/Billing/FamilyQuotientBand.php

@@ -61,9 +61,22 @@ class FamilyQuotientBand
         return $this->familyQuotientBandDetails;
     }
 
-    function setFamilyQuotientBandDetails(Collection $familyQuotientBandDetails): self
+    function addFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
     {
-        $this->familyQuotientBandDetails = $familyQuotientBandDetails;
+        if (!$this->familyQuotientBandDetails->contains($familyQuotientBandDetail)) {
+            $this->familyQuotientBandDetails[] = $familyQuotientBandDetail;
+            $familyQuotientBandDetail->setFamilyQuotientBand($this);
+        }
+
+        return $this;
+    }
+
+    function removeFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
+    {
+        if ($this->familyQuotientBandDetails->removeElement($familyQuotientBandDetail)) {
+            $familyQuotientBandDetail->setFamilyQuotientBand(null);
+        }
+
         return $this;
     }
 
@@ -72,9 +85,20 @@ class FamilyQuotientBand
         return $this->intangibleDiscountDetails;
     }
 
-    function setIntangibleDiscountDetails(Collection $intangibleDiscountDetails): self
+    function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
+    {
+        if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
+            $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
+            $intangibleDiscountDetail->setFamilyQuotientBand($this);
+        }
+
+        return $this;
+    }
+
+    function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
     {
-        $this->intangibleDiscountDetails = $intangibleDiscountDetails;
+        $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);
+        
         return $this;
     }
 }

+ 1 - 0
src/Entity/Billing/FamilyQuotientBandDetail.php

@@ -73,6 +73,7 @@ class FamilyQuotientBandDetail
     {
         if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
             $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
+            $intangibleDiscountDetail->setFamilyQuotientBandDetail($this);
         }
 
         return $this;

+ 8 - 2
src/Entity/Billing/FamilyQuotientModel.php

@@ -62,6 +62,7 @@ class FamilyQuotientModel
     {
         if (!$this->familyQuotientBands->contains($familyQuotientBand)) {
             $this->familyQuotientBands[] = $familyQuotientBand;
+            $familyQuotientBand->setFamilyQuotientModel($this);
         }
 
         return $this;
@@ -69,7 +70,9 @@ class FamilyQuotientModel
 
     function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
     {
-        $this->familyQuotientBands->removeElement($familyQuotientBand);
+        if ($this->familyQuotientBands->removeElement($familyQuotientBand)) {
+            $familyQuotientBand->setFamilyQuotientModel(null);
+        }
 
         return $this;
     }
@@ -83,6 +86,7 @@ class FamilyQuotientModel
     {
         if (!$this->intangiblePriceAndDiscounts->contains($intangiblePriceAndDiscount)) {
             $this->intangiblePriceAndDiscounts[] = $intangiblePriceAndDiscount;
+            $intangiblePriceAndDiscount->setFamilyQuotientModel($this);
         }
 
         return $this;
@@ -90,7 +94,9 @@ class FamilyQuotientModel
 
     function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
     {
-        $this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount);
+        if ($this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount)) {
+            $intangiblePriceAndDiscount->setFamilyQuotientModel(null);
+        }
 
         return $this;
     }

+ 4 - 1
src/Entity/Billing/Odyssee.php

@@ -46,6 +46,7 @@ class Odyssee
     {
         if (!$this->bills->contains($bill)) {
             $this->bills[] = $bill;
+            $bill->setOdyssee($this);
         }
 
         return $this;
@@ -53,7 +54,9 @@ class Odyssee
 
     function removeBill(Bill $bill): self
     {
-        $this->bills->removeElement($bill);
+        if ($this->bills->removeElement($bill)) {
+//            $bill->setOdyssee(null); // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

+ 4 - 1
src/Entity/Billing/SddBank.php

@@ -47,6 +47,7 @@ class SddBank
     {
         if (!$this->billPayments->contains($billPayment)) {
             $this->billPayments[] = $billPayment;
+            $billPayment->setSddBank($this);
         }
 
         return $this;
@@ -54,7 +55,9 @@ class SddBank
 
     function removeBillPayment(BillPayment $billPayment): self
     {
-        $this->billPayments->removeElement($billPayment);
+        if ($this->billPayments->removeElement($billPayment)) {
+//            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

+ 4 - 1
src/Entity/Billing/SddRegie.php

@@ -51,6 +51,7 @@ class SddRegie
     {
         if (!$this->billPayments->contains($billPayment)) {
             $this->billPayments[] = $billPayment;
+            $billPayment->setSddRegie($this);
         }
 
         return $this;
@@ -58,7 +59,9 @@ class SddRegie
 
     function removeBillPayment(BillPayment $billPayment): self
     {
-        $this->billPayments->removeElement($billPayment);
+        if ($this->billPayments->removeElement($billPayment)) {
+//            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

+ 6 - 3
src/Entity/Core/AbstractControl.php

@@ -21,8 +21,8 @@ abstract class AbstractControl
     #[ORM\JoinColumn(nullable: true)]
     protected Access $accompanist;
 
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'controls', cascade: ['persist'], orphanRemoval: false)]
-    protected Collection $tags;
+//    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'controls', cascade: ['persist'], orphanRemoval: false)]
+//    protected Collection $tags;
 
     public function __construct()
     {
@@ -54,6 +54,7 @@ abstract class AbstractControl
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addControl($this);
         }
 
         return $this;
@@ -61,7 +62,9 @@ abstract class AbstractControl
 
     function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->addControl($this);
+        }
 
         return $this;
     }

+ 4 - 1
src/Entity/Core/AbstractRepair.php

@@ -38,6 +38,7 @@ abstract class AbstractRepair
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addRepair($this);
         }
 
         return $this;
@@ -45,7 +46,9 @@ abstract class AbstractRepair
 
     function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeRepair($this);
+        }
 
         return $this;
     }

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

@@ -263,6 +263,7 @@ class AddressPostal
     {
         if (!$this->organizationAddressPostals->contains($organizationAddressPostal)) {
             $this->organizationAddressPostals[] = $organizationAddressPostal;
+            $organizationAddressPostal->setAddressPostal($this);
         }
 
         return $this;
@@ -270,7 +271,9 @@ class AddressPostal
 
     function removeOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
     {
-        $this->organizationAddressPostals->removeElement($organizationAddressPostal);
+        if ($this->organizationAddressPostals->removeElement($organizationAddressPostal)) {
+//            $organizationAddressPostal->setAddressPostal(null); // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

+ 5 - 3
src/Entity/Core/File.php

@@ -753,7 +753,7 @@ class File
         return $this->networks;
     }
 
-    public function addNetwork(Network $network): self
+    function addNetwork(Network $network): self
     {
         if (!$this->networks->contains($network)) {
             $this->networks[] = $network;
@@ -763,9 +763,11 @@ class File
         return $this;
     }
 
-    public function removeNetwork(Network $network): self
+    function removeNetwork(Network $network): self
     {
-        $this->networks->removeElement($network);
+        if ($this->networks->removeElement($network)) {
+//            $network->setImage(null);  // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

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

@@ -950,6 +950,7 @@ class Tagg
     {
         if (!$this->products->contains($product)) {
             $this->products[] = $product;
+            $product->addTag($this);
         }
 
         return $this;
@@ -957,7 +958,9 @@ class Tagg
 
     function removeProduct(AbstractProduct $product): self
     {
-        $this->products->removeElement($product);
+        if ($this->products->removeElement($product)) {
+            $product->removeTag($this);
+        }
 
         return $this;
     }
@@ -971,6 +974,7 @@ class Tagg
     {
         if (!$this->bookings->contains($booking)) {
             $this->bookings[] = $booking;
+            $booking->addTag($this);
         }
 
         return $this;
@@ -978,7 +982,9 @@ class Tagg
 
     function removeBooking(AbstractBooking $booking): self
     {
-        $this->bookings->removeElement($booking);
+        if ($this->bookings->removeElement($booking)) {
+            $booking->removeTag($this);
+        }
 
         return $this;
     }
@@ -988,18 +994,21 @@ class Tagg
         return $this->messages;
     }
 
-    function addMessage(AbstractMessage $message): self
+    function addMessage(mixed $message): self
     {
         if (!$this->messages->contains($message)) {
             $this->messages[] = $message;
+            $message->addTag($this);
         }
 
         return $this;
     }
 
-    function removeMessage(AbstractMessage $message): self
+    function removeMessage(mixed $message): self
     {
-        $this->messages->removeElement($message);
+        if ($this->messages->removeElement($message)) {
+            $message->removeTag($this);
+        }
 
         return $this;
     }
@@ -1013,6 +1022,7 @@ class Tagg
     {
         if (!$this->repairs->contains($repair)) {
             $this->repairs[] = $repair;
+            $repair->addTag($this);
         }
 
         return $this;
@@ -1020,7 +1030,9 @@ class Tagg
 
     function removeRepair(AbstractRepair $repair): self
     {
-        $this->repairs->removeElement($repair);
+        if ($this->repairs->removeElement($repair)) {
+            $repair->removeTag($this);
+        }
 
         return $this;
     }
@@ -1034,6 +1046,7 @@ class Tagg
     {
         if (!$this->controls->contains($control)) {
             $this->controls[] = $control;
+            $control->addTag($this);
         }
 
         return $this;
@@ -1041,7 +1054,9 @@ class Tagg
 
     function removeControl(AbstractControl $control): self
     {
-        $this->controls->removeElement($control);
+        if ($this->controls->removeElement($control)) {
+            $control->removeTag($this);
+        }
 
         return $this;
     }
@@ -1055,6 +1070,7 @@ class Tagg
     {
         if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
             $this->educationCurriculumPacks[] = $educationCurriculumPack;
+            $educationCurriculumPack->addTag($this);
         }
 
         return $this;
@@ -1062,7 +1078,9 @@ class Tagg
 
     function removeEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
     {
-        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+        if ($this->educationCurriculumPacks->removeElement($educationCurriculumPack)) {
+            $educationCurriculumPack->removeTag($this);
+        }
 
         return $this;
     }

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

@@ -178,6 +178,7 @@ class Cycle
     {
         if (!$this->educationCurriculums->contains($educationCurriculum)) {
             $this->educationCurriculums[] = $educationCurriculum;
+            $educationCurriculum->setCycle($this);
         }
 
         return $this;
@@ -185,7 +186,9 @@ class Cycle
 
     function removeEducationCurriculum(EducationCurriculum $educationCurriculum): self
     {
-        $this->educationCurriculums->removeElement($educationCurriculum);
+        if ($this->educationCurriculums->removeElement($educationCurriculum)) {
+            $educationCurriculum->setCycle(null);
+        }
 
         return $this;
     }

+ 8 - 5
src/Entity/Education/Education.php

@@ -294,18 +294,21 @@ class Education
         return $this->educationWishes;
     }
 
-    function addEducationWishe(EducationStudentWish $educationWishe): self
+    function addEducationWish(EducationStudentWish $educationWish): self
     {
-        if (!$this->educationWishes->contains($educationWishe)) {
-            $this->educationWishes[] = $educationWishe;
+        if (!$this->educationWishes->contains($educationWish)) {
+            $this->educationWishes[] = $educationWish;
+            $educationWish->setEducationWish($this);
         }
 
         return $this;
     }
 
-    function removeEducationWishe(EducationStudentWish $educationWishe): self
+    function removeEducationWish(EducationStudentWish $educationWish): self
     {
-        $this->educationWishes->removeElement($educationWishe);
+        if ($this->educationWishes->removeElement($educationWish)) {
+            $educationWish->setEducationWish(null);
+        }
 
         return $this;
     }

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

@@ -43,6 +43,7 @@ class EducationComplement
     {
         if (!$this->educations->contains($education)) {
             $this->educations[] = $education;
+            $education->setEducationComplement($this);
         }
 
         return $this;
@@ -50,7 +51,9 @@ class EducationComplement
 
     function removeEducation(Education $education): self
     {
-        $this->educations->removeElement($education);
+        if ($this->educations->removeElement($education)) {
+            $education->setEducationComplement(null);
+        }
 
         return $this;
     }

+ 48 - 6
src/Entity/Education/EducationCurriculum.php

@@ -199,6 +199,7 @@ class EducationCurriculum
     {
         if (!$this->educationStudentWish->contains($educationStudentWish)) {
             $this->educationStudentWish[] = $educationStudentWish;
+            $educationStudentWish->setEducationCurriculum($this);
         }
 
         return $this;
@@ -206,7 +207,9 @@ class EducationCurriculum
 
     function removeEducationStudentWish(EducationStudentWish $educationStudentWish): self
     {
-        $this->educationStudentWish->removeElement($educationStudentWish);
+        if ($this->educationStudentWish->removeElement($educationStudentWish)) {
+            $educationStudentWish->setEducationCurriculum(null);
+        }
 
         return $this;
     }
@@ -220,6 +223,7 @@ class EducationCurriculum
     {
         if (!$this->courses->contains($course)) {
             $this->courses[] = $course;
+            $course->addEducationCurriculum($this);
         }
 
         return $this;
@@ -227,7 +231,9 @@ class EducationCurriculum
 
     function removeCourse(Course $course): self
     {
-        $this->courses->removeElement($course);
+        if ($this->courses->removeElement($course)) {
+            $course->removeEducationCurriculum($this);
+        }
 
         return $this;
     }
@@ -241,6 +247,7 @@ class EducationCurriculum
     {
         if (!$this->examens->contains($examen)) {
             $this->examens[] = $examen;
+            $examen->addEducationCurriculum($this);
         }
 
         return $this;
@@ -248,7 +255,9 @@ class EducationCurriculum
 
     function removeExamen(Examen $examen): self
     {
-        $this->examens->removeElement($examen);
+        if ($this->examens->removeElement($examen)) {
+            $examen->removeEducationCurriculum($this);
+        }
 
         return $this;
     }
@@ -262,6 +271,7 @@ class EducationCurriculum
     {
         if (!$this->intangibles->contains($intangible)) {
             $this->intangibles[] = $intangible;
+            $intangible->addEducationCurriculum($this);
         }
 
         return $this;
@@ -269,7 +279,33 @@ class EducationCurriculum
 
     function removeIntangible(Intangible $intangible): self
     {
-        $this->intangibles->removeElement($intangible);
+        if ($this->intangibles->removeElement($intangible)) {
+            $intangible->removeEducationCurriculum($this);
+        }
+
+        return $this;
+    }
+
+    function getRequiredEducationCurriculumPacks(): Collection
+    {
+        return $this->requiredEducationCurriculumPacks;
+    }
+
+    function addRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
+    {
+        if (!$this->requiredEducationCurriculumPacks->contains($requiredEducationCurriculumPack)) {
+            $this->requiredEducationCurriculumPacks[] = $requiredEducationCurriculumPack;
+            $requiredEducationCurriculumPack->addRequiredEducationCurriculum($this);
+        }
+
+        return $this;
+    }
+
+    function removeRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
+    {
+        if ($this->requiredEducationCurriculumPacks->removeElement($requiredEducationCurriculumPack)) {
+            $requiredEducationCurriculumPack->removeRequiredEducationCurriculum($this);
+        }
 
         return $this;
     }
@@ -284,6 +320,7 @@ class EducationCurriculum
     ): self {
         if (!$this->requiredChoicesEducationCurriculumPacks->contains($requiredChoicesEducationCurriculumPack)) {
             $this->requiredChoicesEducationCurriculumPacks[] = $requiredChoicesEducationCurriculumPack;
+            $requiredChoicesEducationCurriculumPack->addRequiredChoicesEducationCurriculum($this);
         }
 
         return $this;
@@ -292,7 +329,9 @@ class EducationCurriculum
     function removeRequiredChoicesEducationCurriculumPack(
         EducationCurriculumPack $requiredChoicesEducationCurriculumPack,
     ): self {
-        $this->requiredChoicesEducationCurriculumPacks->removeElement($requiredChoicesEducationCurriculumPack);
+        if ($this->requiredChoicesEducationCurriculumPacks->removeElement($requiredChoicesEducationCurriculumPack)) {
+            $requiredChoicesEducationCurriculumPack->removeRequiredChoicesEducationCurriculum($this);
+        }
 
         return $this;
     }
@@ -306,6 +345,7 @@ class EducationCurriculum
     {
         if (!$this->optionnalEducationCurriculumPacks->contains($optionnalEducationCurriculumPack)) {
             $this->optionnalEducationCurriculumPacks[] = $optionnalEducationCurriculumPack;
+            $optionnalEducationCurriculumPack->addOptionnalEducationCurriculum($this);
         }
 
         return $this;
@@ -313,7 +353,9 @@ class EducationCurriculum
 
     function removeOptionnalEducationCurriculumPack(EducationCurriculumPack $optionnalEducationCurriculumPack): self
     {
-        $this->optionnalEducationCurriculumPacks->removeElement($optionnalEducationCurriculumPack);
+        if ($this->optionnalEducationCurriculumPacks->removeElement($optionnalEducationCurriculumPack)) {
+            $optionnalEducationCurriculumPack->removeOptionnalEducationCurriculum($this);
+        }
 
         return $this;
     }

+ 20 - 5
src/Entity/Education/EducationCurriculumPack.php

@@ -88,6 +88,7 @@ class EducationCurriculumPack
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addEducationCurriculumPack($this);
         }
 
         return $this;
@@ -95,7 +96,9 @@ class EducationCurriculumPack
 
     function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeEducationCurriculumPack($this);
+        }
 
         return $this;
     }
@@ -109,6 +112,7 @@ class EducationCurriculumPack
     {
         if (!$this->requiredEducationCurriculums->contains($requiredEducationCurriculum)) {
             $this->requiredEducationCurriculums[] = $requiredEducationCurriculum;
+            $requiredEducationCurriculum->addRequiredEducationCurriculumPack($this);
         }
 
         return $this;
@@ -116,7 +120,9 @@ class EducationCurriculumPack
 
     function removeRequiredEducationCurriculum(EducationCurriculum $requiredEducationCurriculum): self
     {
-        $this->requiredEducationCurriculums->removeElement($requiredEducationCurriculum);
+        if ($this->requiredEducationCurriculums->removeElement($requiredEducationCurriculum)) {
+            $requiredEducationCurriculum->removeRequiredEducationCurriculumPack($this);
+        }
 
         return $this;
     }
@@ -130,6 +136,7 @@ class EducationCurriculumPack
     {
         if (!$this->requiredChoicesEducationCurriculums->contains($requiredChoicesEducationCurriculum)) {
             $this->requiredChoicesEducationCurriculums[] = $requiredChoicesEducationCurriculum;
+            $requiredChoicesEducationCurriculum->addRequiredChoicesEducationCurriculumPack($this);
         }
 
         return $this;
@@ -137,7 +144,9 @@ class EducationCurriculumPack
 
     function removeRequiredChoicesEducationCurriculum(EducationCurriculum $requiredChoicesEducationCurriculum): self
     {
-        $this->requiredChoicesEducationCurriculums->removeElement($requiredChoicesEducationCurriculum);
+        if ($this->requiredChoicesEducationCurriculums->removeElement($requiredChoicesEducationCurriculum)) {
+            $requiredChoicesEducationCurriculum->removeRequiredChoicesEducationCurriculumPack($this);
+        }
 
         return $this;
     }
@@ -151,6 +160,7 @@ class EducationCurriculumPack
     {
         if (!$this->optionnalEducationCurriculums->contains($optionnalEducationCurriculum)) {
             $this->optionnalEducationCurriculums[] = $optionnalEducationCurriculum;
+            $optionnalEducationCurriculum->addOptionnalEducationCurriculumPack($this);
         }
 
         return $this;
@@ -158,7 +168,9 @@ class EducationCurriculumPack
 
     function removeOptionnalEducationCurriculum(EducationCurriculum $optionnalEducationCurriculum): self
     {
-        $this->optionnalEducationCurriculums->removeElement($optionnalEducationCurriculum);
+        if ($this->optionnalEducationCurriculums->removeElement($optionnalEducationCurriculum)) {
+            $optionnalEducationCurriculum->removeOptionnalEducationCurriculumPack($this);
+        }
 
         return $this;
     }
@@ -172,6 +184,7 @@ class EducationCurriculumPack
     {
         if (!$this->intangibles->contains($intangible)) {
             $this->intangibles[] = $intangible;
+            $intangible->addEducationCurriculumPack($this);
         }
 
         return $this;
@@ -179,7 +192,9 @@ class EducationCurriculumPack
 
     function removeIntangible(Intangible $intangible): self
     {
-        $this->intangibles->removeElement($intangible);
+        if ($this->intangibles->removeElement($intangible)) {
+            $intangible->removeEducationCurriculumPack($this);
+        }
 
         return $this;
     }

+ 10 - 4
src/Entity/Message/AbstractMessage.php

@@ -148,18 +148,21 @@ abstract class AbstractMessage
         return $this->files;
     }
 
-    public function addFile(File $file): self
+    function addFile(File $file): self
     {
         if (!$this->files->contains($file)) {
             $this->files[] = $file;
+//            $file->addXXXX($this);  // TODO: quel méthode?
         }
 
         return $this;
     }
 
-    public function removeFile(File $file): self
+    function removeFile(File $file): self
     {
-        $this->files->removeElement($file);
+        if ($this->files->removeElement($file)) {
+//            $file->removeXXX($this);  // TODO: quel méthode?
+        }
 
         return $this;
     }
@@ -173,6 +176,7 @@ abstract class AbstractMessage
     {
         if (!$this->reportMessage->contains($reportMessage)) {
             $this->reportMessage[] = $reportMessage;
+            $reportMessage->setMessage($this);
         }
 
         return $this;
@@ -180,7 +184,9 @@ abstract class AbstractMessage
 
     function removeReportMessage(ReportMessage $reportMessage): self
     {
-        $this->reportMessage->removeElement($reportMessage);
+        if ($this->reportMessage->removeElement($reportMessage)) {
+            $reportMessage->setMessage(null);
+        }
 
         return $this;
     }

+ 41 - 10
src/Entity/Organization/Organization.php

@@ -489,6 +489,7 @@ class Organization
     {
         if (!$this->access->contains($access)) {
             $this->access[] = $access;
+            $access->setOrganization($this);
         }
 
         return $this;
@@ -496,7 +497,9 @@ class Organization
 
     function removeAccess(Access $access): self
     {
-        $this->access->removeElement($access);
+        if ($this->access->removeElement($access)) {
+            $access->setOrganization(null);
+        }
 
         return $this;
     }
@@ -1896,7 +1899,6 @@ class Organization
 
         return $this;
     }
-
     function getNetwork(): Collection
     {
         return $this->network;
@@ -1906,6 +1908,7 @@ class Organization
     {
         if (!$this->network->contains($network)) {
             $this->network[] = $network;
+            $network->setOrganization($this);
         }
 
         return $this;
@@ -1913,7 +1916,9 @@ class Organization
 
     function removeNetwork(NetworkOrganization $network): self
     {
-        $this->network->removeElement($network);
+        if ($this->network->removeElement($network)) {
+            $network->setOrganization(null);
+        }
 
         return $this;
     }
@@ -1927,6 +1932,7 @@ class Organization
     {
         if (!$this->networkChild->contains($networkChild)) {
             $this->networkChild[] = $networkChild;
+            $networkChild->setParent($this);
         }
 
         return $this;
@@ -1934,7 +1940,9 @@ class Organization
 
     function removeNetworkChild(NetworkOrganization $networkChild): self
     {
-        $this->networkChild->removeElement($networkChild);
+        if ($this->networkChild->removeElement($networkChild)) {
+            $networkChild->setParent(null);
+        }
 
         return $this;
     }
@@ -1959,6 +1967,7 @@ class Organization
     {
         if (!$this->messages->contains($message)) {
             $this->messages[] = $message;
+            $message->setOrganization($this);
         }
 
         return $this;
@@ -1966,7 +1975,9 @@ class Organization
 
     function removeMessage(mixed $message): self
     {
-        $this->messages->removeElement($message);
+        if ($this->messages->removeElement($message)) {
+            $message->setOrganization(null);
+        }
 
         return $this;
     }
@@ -1991,6 +2002,7 @@ class Organization
     {
         if (!$this->cotisationByYears->contains($cotisationByYear)) {
             $this->cotisationByYears[] = $cotisationByYear;
+            $cotisationByYear->setOrganization($this);
         }
 
         return $this;
@@ -1998,7 +2010,9 @@ class Organization
 
     function removeCotisationByYear(CotisationByYear $cotisationByYear): self
     {
-        $this->cotisationByYears->removeElement($cotisationByYear);
+        if ($this->cotisationByYears->removeElement($cotisationByYear)) {
+            $cotisationByYear->setOrganization(null);
+        }
 
         return $this;
     }
@@ -2012,6 +2026,7 @@ class Organization
     {
         if (!$this->attendanceBookingReasons->contains($attendanceBookingReason)) {
             $this->attendanceBookingReasons[] = $attendanceBookingReason;
+            $attendanceBookingReason->setOrganization($this);
         }
 
         return $this;
@@ -2019,7 +2034,9 @@ class Organization
 
     function removeAttendanceBookingReason(AttendanceBookingReason $attendanceBookingReason): self
     {
-        $this->attendanceBookingReasons->removeElement($attendanceBookingReason);
+        if ($this->attendanceBookingReasons->removeElement($attendanceBookingReason)) {
+            $attendanceBookingReason->setOrganization(null);
+        }
 
         return $this;
     }
@@ -2033,6 +2050,7 @@ class Organization
     {
         if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
             $this->educationCurriculumPacks[] = $educationCurriculumPack;
+            $educationCurriculumPack->setOrganization($this);
         }
 
         return $this;
@@ -2040,7 +2058,9 @@ class Organization
 
     function removeEducationCurriculumPack(Cycle $educationCurriculumPack): self
     {
-        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+        if ($this->educationCurriculumPacks->removeElement($educationCurriculumPack)) {
+            $educationCurriculumPack->setOrganization(null);
+        }
 
         return $this;
     }
@@ -2054,6 +2074,7 @@ class Organization
     {
         if (!$this->familyQuotientModels->contains($familyQuotientModel)) {
             $this->familyQuotientModels[] = $familyQuotientModel;
+            $familyQuotientModel->setOrganization($this);
         }
 
         return $this;
@@ -2061,15 +2082,23 @@ class Organization
 
     function removeFamilyQuotientModel(FamilyQuotientModel $familyQuotientModel): self
     {
-        $this->familyQuotientModels->removeElement($familyQuotientModel);
+        if ($this->familyQuotientModels->removeElement($familyQuotientModel)) {
+//            $familyQuotientModel->setOrganization(null); // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }
 
+    function getBillSchedules(): Collection
+    {
+        return $this->billSchedules;
+    }
+
     function addBillSchedule(BillSchedule $billSchedule): self
     {
         if (!$this->billSchedules->contains($billSchedule)) {
             $this->billSchedules[] = $billSchedule;
+            $billSchedule->setOrganization($this);
         }
 
         return $this;
@@ -2077,7 +2106,9 @@ class Organization
 
     function removeBillSchedule(BillSchedule $billSchedule): self
     {
-        $this->billSchedules->removeElement($billSchedule);
+        if ($this->billSchedules->removeElement($billSchedule)) {
+//            $billSchedule->setOrganization(null);  // TODO: actuellement, pas nullable: conserver?
+        }
 
         return $this;
     }

+ 6 - 3
src/Entity/Person/Person.php

@@ -611,7 +611,7 @@ class Person implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->allowedIps;
     }
 
-    public function addAllowedIp(AllowedIp $allowedIp): self
+    function addAllowedIp(AllowedIp $allowedIp): self
     {
         if (!$this->allowedIps->contains($allowedIp)) {
             $this->allowedIps[] = $allowedIp;
@@ -621,9 +621,12 @@ class Person implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    public function removeAllowedIp(AllowedIp $allowedIp): self
+    function removeAllowedIp(AllowedIp $allowedIp): self
     {
-        $this->allowedIps->removeElement($allowedIp);
+        if ($this->allowedIps->removeElement($allowedIp)) {
+//            $allowedIp->setPerson(null);  // TODO: actuellement, pas nullable: conserver?
+        }
+
         return $this;
     }
 }

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

@@ -6,6 +6,8 @@ namespace App\Entity\Place;
 
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use App\Entity\Core\AbstractControl;
+use App\Entity\Core\Tagg;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -24,6 +26,12 @@ class RoomControl extends AbstractControl
     #[ORM\ManyToOne(inversedBy: 'controls')]
     private Room $room;
 
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'controls', cascade: ['persist'], orphanRemoval: false)]
+    #[ORM\JoinTable(name: 'tag_control')]
+    #[ORM\JoinColumn(name: 'control_id')]
+    #[ORM\InverseJoinColumn(name: 'tag_id')]
+    protected Collection $tags;
+
     public function getDiscr(): ?string
     {
         return $this->discr;
@@ -47,4 +55,28 @@ class RoomControl extends AbstractControl
 
         return $this;
     }
+
+    function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+            $tag->addControl($this);
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeControl($this);
+        }
+
+        return $this;
+    }
 }

+ 4 - 1
src/Entity/Product/AbstractProduct.php

@@ -46,6 +46,7 @@ abstract class AbstractProduct
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addProduct($this);
         }
 
         return $this;
@@ -53,7 +54,9 @@ abstract class AbstractProduct
 
     function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeProduct($this);
+        }
 
         return $this;
     }

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

@@ -415,6 +415,7 @@ class Equipment extends AbstractProduct
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
+            $tag->addProduct($this);
         }
 
         return $this;
@@ -422,7 +423,9 @@ class Equipment extends AbstractProduct
 
     function removeTag(Tagg $tag): self
     {
-        $this->tags->removeElement($tag);
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeProduct($this);
+        }
 
         return $this;
     }
@@ -436,6 +439,7 @@ class Equipment extends AbstractProduct
     {
         if (!$this->equipmentCompositionChildren->contains($equipmentCompositionChildren)) {
             $this->equipmentCompositionChildren[] = $equipmentCompositionChildren;
+            $equipmentCompositionChildren->setChildren($this);
         }
 
         return $this;
@@ -443,7 +447,9 @@ class Equipment extends AbstractProduct
 
     function removeEquipmentCompositionChildren(EquipmentComposition $equipmentCompositionChildren): self
     {
-        $this->equipmentCompositionChildren->removeElement($equipmentCompositionChildren);
+        if ($this->equipmentCompositionChildren->removeElement($equipmentCompositionChildren)) {
+            $equipmentCompositionChildren->setChildren(null);
+        }
 
         return $this;
     }
@@ -457,6 +463,7 @@ class Equipment extends AbstractProduct
     {
         if (!$this->equipmentLoanFiltered->contains($equipmentLoanFiltered)) {
             $this->equipmentLoanFiltered[] = $equipmentLoanFiltered;
+            $equipmentLoanFiltered->setEquipment($this);
         }
 
         return $this;
@@ -464,7 +471,9 @@ class Equipment extends AbstractProduct
 
     function removeEquipmentLoanFiltered(EquipmentLoan $equipmentLoanFiltered): self
     {
-        $this->equipmentLoanFiltered->removeElement($equipmentLoanFiltered);
+        if ($this->equipmentLoanFiltered->removeElement($equipmentLoanFiltered)) {
+            $equipmentLoanFiltered->setEquipment(null);
+        }
 
         return $this;
     }
@@ -478,6 +487,7 @@ class Equipment extends AbstractProduct
     {
         if (!$this->examenConvocations->contains($examenConvocation)) {
             $this->examenConvocations[] = $examenConvocation;
+            $examenConvocation->addEquipment($this);
         }
 
         return $this;
@@ -485,7 +495,9 @@ class Equipment extends AbstractProduct
 
     function removeExamenConvocation(ExamenConvocation $examenConvocation): self
     {
-        $this->examenConvocations->removeElement($examenConvocation);
+        if ($this->examenConvocations->removeElement($examenConvocation)) {
+            $examenConvocation->removeEquipment($this);
+        }
 
         return $this;
     }

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

@@ -44,8 +44,8 @@ class Intangible extends AbstractProduct
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     protected Collection $tags;
 
-    #[ORM\ManyToMany(targetEntity: EducationCurriculumPack::class, inversedBy: 'intangibles', cascade: [], orphanRemoval: false)]
-    protected Collection $educationCurriculumPacks;
+//    #[ORM\ManyToMany(targetEntity: EducationCurriculumPack::class, inversedBy: 'intangibles', cascade: [], orphanRemoval: false)]
+//    protected Collection $educationCurriculumPacks;
 
     #[ORM\OneToOne(inversedBy: 'intangible', targetEntity: IntangiblePriceAndDiscount::class, cascade: ['persist'])]
     protected IntangiblePriceAndDiscount $intangiblePriceAndDiscount;
@@ -182,6 +182,7 @@ class Intangible extends AbstractProduct
     {
         if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
             $this->educationCurriculumPacks[] = $educationCurriculumPack;
+            $educationCurriculumPack->addIntangible($this);
         }
 
         return $this;
@@ -189,7 +190,9 @@ class Intangible extends AbstractProduct
 
     function removeEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
     {
-        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+        if ($this->educationCurriculumPacks->removeElement($educationCurriculumPack)) {
+            $educationCurriculumPack->removeIntangible($this);
+        }
 
         return $this;
     }

+ 1 - 1
src/Entity/Product/IntangiblePriceAndDiscount.php

@@ -91,7 +91,7 @@ class IntangiblePriceAndDiscount
         return $this->familyQuotientModel;
     }
 
-    function setFamilyQuotientModel(FamilyQuotientModel $familyQuotientModel): self
+    function setFamilyQuotientModel(?FamilyQuotientModel $familyQuotientModel): self
     {
         $this->familyQuotientModel = $familyQuotientModel;
         return $this;

+ 15 - 3
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -675,7 +675,12 @@ class SchemaSnippetsMaker
 
         $attr = $prop->getAttributes()[0];
 
-        $prefix = ($attr->getName() === OneToMany::class ? 'set' : ($isRemoving ? 'remove' : 'add'));
+        if ($attr->getName() === OneToMany::class) {
+            $prefix = 'set';
+        } else {
+            $prefix = $isRemoving ? 'remove' : 'add';
+            $inversedBy = $this->singularize($inversedBy);
+        }
 
         return
             $prefix .
@@ -691,7 +696,7 @@ class SchemaSnippetsMaker
      */
     protected function makeSnippetAdderForCollection(Property $prop): Method {
 
-        $singularPropName = rtrim($prop->getName(), 's');
+        $singularPropName = $this->singularize($prop->getName());
 
         $method = new Method('add' . ucfirst($singularPropName));
 
@@ -724,7 +729,7 @@ class SchemaSnippetsMaker
      * @return Method
      */
     protected function makeSnippetRemoverForCollection(Property $prop): Method {
-        $singularPropName = rtrim($prop->getName(), 's');
+        $singularPropName = $this->singularize($prop->getName());
 
         $method = new Method('remove' . ucfirst($singularPropName));
 
@@ -763,5 +768,12 @@ class SchemaSnippetsMaker
         return preg_replace("/targetEntity: '(\w+)::class'/", "targetEntity: $1::class", $content);
     }
 
+    protected function singularize(string $name): string {
+        $exceptions = ['access'];
+        if (in_array(strtolower($name), $exceptions)) {
+            return $name;
+        }
 
+        return preg_replace('/s$/', '', $name);
+    }
 }