Selaa lähdekoodia

entities : replace setters by adders / removers for collections

Olivier Massot 11 kuukautta sitten
vanhempi
commit
1c6e65dfb9

+ 12 - 2
src/Entity/AccessWish/AccessFamilyWish.php

@@ -115,9 +115,19 @@ class AccessFamilyWish
         return $this->accessWishesGuardians;
     }
 
-    function setAccessWishesGuardians(Collection $accessWishesGuardians): self
+    function addAccessWishesGuardian(AccessWish $accessWishesGuardian): self
     {
-        $this->accessWishesGuardians = $accessWishesGuardians;
+        if (!$this->accessWishesGuardians->contains($accessWishesGuardian)) {
+            $this->accessWishesGuardians[] = $accessWishesGuardian;
+        }
+
+        return $this;
+    }
+
+    function removeAccessWishesGuardian(AccessWish $accessWishesGuardian): self
+    {
+        $this->accessWishesGuardians->removeElement($accessWishesGuardian);
+
         return $this;
     }
 }

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

@@ -176,9 +176,19 @@ class EducationStudentWish
         return $this->teachers;
     }
 
-    function setTeachers(Collection $teachers): self
+    function addTeacher(Access $teacher): self
     {
-        $this->teachers = $teachers;
+        if (!$this->teachers->contains($teacher)) {
+            $this->teachers[] = $teacher;
+        }
+
+        return $this;
+    }
+
+    function removeTeacher(Access $teacher): self
+    {
+        $this->teachers->removeElement($teacher);
+
         return $this;
     }
 

+ 12 - 3
src/Entity/Billing/BillingExportSetting.php

@@ -65,15 +65,24 @@ class BillingExportSetting
         $this->organization = $organization;
         return $this;
     }
-
     function getStageManagers(): Collection
     {
         return $this->stageManagers;
     }
 
-    function setStageManagers(Collection $stageManagers): self
+    function addStageManager(Access $stageManager): self
     {
-        $this->stageManagers = $stageManagers;
+        if (!$this->stageManagers->contains($stageManager)) {
+            $this->stageManagers[] = $stageManager;
+        }
+
+        return $this;
+    }
+
+    function removeStageManager(Access $stageManager): self
+    {
+        $this->stageManagers->removeElement($stageManager);
+
         return $this;
     }
 }

+ 12 - 2
src/Entity/Billing/SddBank.php

@@ -43,9 +43,19 @@ class SddBank
         return $this->billPayments;
     }
 
-    function setBillPayments(Collection $billPayments): self
+    function addBillPayment(BillPayment $billPayment): self
     {
-        $this->billPayments = $billPayments;
+        if (!$this->billPayments->contains($billPayment)) {
+            $this->billPayments[] = $billPayment;
+        }
+
+        return $this;
+    }
+
+    function removeBillPayment(BillPayment $billPayment): self
+    {
+        $this->billPayments->removeElement($billPayment);
+
         return $this;
     }
 

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

@@ -12,6 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
 
 /**
  * Classe ... qui ...
+ * // TODO: possible factoriser avec SddBank?
  */
 // #[Auditable]
 #[ORM\Entity]
@@ -46,9 +47,19 @@ class SddRegie
         return $this->billPayments;
     }
 
-    function setBillPayments(Collection $billPayments): self
+    function addBillPayment(BillPayment $billPayment): self
     {
-        $this->billPayments = $billPayments;
+        if (!$this->billPayments->contains($billPayment)) {
+            $this->billPayments[] = $billPayment;
+        }
+
+        return $this;
+    }
+
+    function removeBillPayment(BillPayment $billPayment): self
+    {
+        $this->billPayments->removeElement($billPayment);
+
         return $this;
     }
 

+ 13 - 2
src/Entity/Booking/Course.php

@@ -113,6 +113,7 @@ class Course extends AbstractBooking
         $this->attendanceBooking = new ArrayCollection();
         $this->tags = new ArrayCollection();
         $this->educationStudentWishes = new ArrayCollection();
+        parent::__construct();
     }
 
     public function getDiscr(): ?string
@@ -432,9 +433,19 @@ class Course extends AbstractBooking
         return $this->educationStudentWishes;
     }
 
-    function setEducationStudentWishes(Collection $educationStudentWishes): self
+    function addEducationStudentWishe(EducationStudentWish $educationStudentWishe): self
     {
-        $this->educationStudentWishes = $educationStudentWishes;
+        if (!$this->educationStudentWishes->contains($educationStudentWishe)) {
+            $this->educationStudentWishes[] = $educationStudentWishe;
+        }
+
+        return $this;
+    }
+
+    function removeEducationStudentWishe(EducationStudentWish $educationStudentWishe): self
+    {
+        $this->educationStudentWishes->removeElement($educationStudentWishe);
+
         return $this;
     }
 }

+ 1 - 14
src/Entity/Booking/EducationalProject.php

@@ -99,9 +99,6 @@ class EducationalProject extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     protected Collection $tags;
 
-    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
-    protected Collection $equipments;
-
     #[ORM\OneToOne(targetEntity: EducationalProjectAge::class, cascade: ['persist'])]
     protected EducationalProjectAge $ageDistribution;
 
@@ -118,6 +115,7 @@ class EducationalProject extends AbstractBooking
         $this->organizer = new ArrayCollection();
         $this->tags = new ArrayCollection();
         $this->equipments = new ArrayCollection();
+        parent::__construct();
     }
 
     public function getDiscr(): ?string
@@ -492,17 +490,6 @@ class EducationalProject extends AbstractBooking
         return $this;
     }
 
-    function getEquipments(): Collection
-    {
-        return $this->equipments;
-    }
-
-    function setEquipments(Collection $equipments): self
-    {
-        $this->equipments = $equipments;
-        return $this;
-    }
-
     function getAgeDistribution(): EducationalProjectAge
     {
         return $this->ageDistribution;

+ 0 - 3
src/Entity/Booking/Event.php

@@ -98,9 +98,6 @@ class Event extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     protected Collection $tags;
 
-    #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
-    protected Collection $equipments;
-
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();

+ 12 - 2
src/Entity/Core/AbstractControl.php

@@ -50,9 +50,19 @@ abstract class AbstractControl
         return $this->tags;
     }
 
-    function setTags(Collection $tags): self
+    function addTag(Tagg $tag): self
     {
-        $this->tags = $tags;
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        $this->tags->removeElement($tag);
+
         return $this;
     }
 }

+ 12 - 2
src/Entity/Core/AddressPostal.php

@@ -259,9 +259,19 @@ class AddressPostal
         return $this->organizationAddressPostals;
     }
 
-    function setOrganizationAddressPostals(Collection $organizationAddressPostals): self
+    function addOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
     {
-        $this->organizationAddressPostals = $organizationAddressPostals;
+        if (!$this->organizationAddressPostals->contains($organizationAddressPostal)) {
+            $this->organizationAddressPostals[] = $organizationAddressPostal;
+        }
+
+        return $this;
+    }
+
+    function removeOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
+    {
+        $this->organizationAddressPostals->removeElement($organizationAddressPostal);
+
         return $this;
     }
 }

+ 72 - 12
src/Entity/Core/Tagg.php

@@ -946,9 +946,19 @@ class Tagg
         return $this->products;
     }
 
-    function setProducts(Collection $products): self
+    function addProduct(AbstractProduct $product): self
     {
-        $this->products = $products;
+        if (!$this->products->contains($product)) {
+            $this->products[] = $product;
+        }
+
+        return $this;
+    }
+
+    function removeProduct(AbstractProduct $product): self
+    {
+        $this->products->removeElement($product);
+
         return $this;
     }
 
@@ -957,9 +967,19 @@ class Tagg
         return $this->bookings;
     }
 
-    function setBookings(Collection $bookings): self
+    function addBooking(AbstractBooking $booking): self
     {
-        $this->bookings = $bookings;
+        if (!$this->bookings->contains($booking)) {
+            $this->bookings[] = $booking;
+        }
+
+        return $this;
+    }
+
+    function removeBooking(AbstractBooking $booking): self
+    {
+        $this->bookings->removeElement($booking);
+
         return $this;
     }
 
@@ -968,9 +988,19 @@ class Tagg
         return $this->messages;
     }
 
-    function setMessages(Collection $messages): self
+    function addMessage(AbstractMessage $message): self
+    {
+        if (!$this->messages->contains($message)) {
+            $this->messages[] = $message;
+        }
+
+        return $this;
+    }
+
+    function removeMessage(AbstractMessage $message): self
     {
-        $this->messages = $messages;
+        $this->messages->removeElement($message);
+
         return $this;
     }
 
@@ -979,9 +1009,19 @@ class Tagg
         return $this->repairs;
     }
 
-    function setRepairs(Collection $repairs): self
+    function addRepair(AbstractRepair $repair): self
     {
-        $this->repairs = $repairs;
+        if (!$this->repairs->contains($repair)) {
+            $this->repairs[] = $repair;
+        }
+
+        return $this;
+    }
+
+    function removeRepair(AbstractRepair $repair): self
+    {
+        $this->repairs->removeElement($repair);
+
         return $this;
     }
 
@@ -990,9 +1030,19 @@ class Tagg
         return $this->controls;
     }
 
-    function setControls(Collection $controls): self
+    function addControl(AbstractControl $control): self
     {
-        $this->controls = $controls;
+        if (!$this->controls->contains($control)) {
+            $this->controls[] = $control;
+        }
+
+        return $this;
+    }
+
+    function removeControl(AbstractControl $control): self
+    {
+        $this->controls->removeElement($control);
+
         return $this;
     }
 
@@ -1001,9 +1051,19 @@ class Tagg
         return $this->educationCurriculumPacks;
     }
 
-    function setEducationCurriculumPacks(Collection $educationCurriculumPacks): self
+    function addEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
+    {
+        if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
+            $this->educationCurriculumPacks[] = $educationCurriculumPack;
+        }
+
+        return $this;
+    }
+
+    function removeEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
     {
-        $this->educationCurriculumPacks = $educationCurriculumPacks;
+        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+
         return $this;
     }
 }

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

@@ -174,9 +174,19 @@ class Cycle
         return $this->educationCurriculums;
     }
 
-    function setEducationCurriculums(Collection $educationCurriculums): self
+    function addEducationCurriculum(EducationCurriculum $educationCurriculum): self
     {
-        $this->educationCurriculums = $educationCurriculums;
+        if (!$this->educationCurriculums->contains($educationCurriculum)) {
+            $this->educationCurriculums[] = $educationCurriculum;
+        }
+
+        return $this;
+    }
+
+    function removeEducationCurriculum(EducationCurriculum $educationCurriculum): self
+    {
+        $this->educationCurriculums->removeElement($educationCurriculum);
+
         return $this;
     }
 }

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

@@ -294,9 +294,19 @@ class Education
         return $this->educationWishes;
     }
 
-    function setEducationWishes(Collection $educationWishes): self
+    function addEducationWishe(EducationStudentWish $educationWishe): self
     {
-        $this->educationWishes = $educationWishes;
+        if (!$this->educationWishes->contains($educationWishe)) {
+            $this->educationWishes[] = $educationWishe;
+        }
+
+        return $this;
+    }
+
+    function removeEducationWishe(EducationStudentWish $educationWishe): self
+    {
+        $this->educationWishes->removeElement($educationWishe);
+
         return $this;
     }
 }

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

@@ -39,9 +39,19 @@ class EducationComplement
         return $this->educations;
     }
 
-    function setEducations(Collection $educations): self
+    function addEducation(Education $education): self
     {
-        $this->educations = $educations;
+        if (!$this->educations->contains($education)) {
+            $this->educations[] = $education;
+        }
+
+        return $this;
+    }
+
+    function removeEducation(Education $education): self
+    {
+        $this->educations->removeElement($education);
+
         return $this;
     }
 }

+ 70 - 19
src/Entity/Education/EducationCurriculum.php

@@ -195,9 +195,19 @@ class EducationCurriculum
         return $this->educationStudentWish;
     }
 
-    function setEducationStudentWish(Collection $educationStudentWish): self
+    function addEducationStudentWish(EducationStudentWish $educationStudentWish): self
     {
-        $this->educationStudentWish = $educationStudentWish;
+        if (!$this->educationStudentWish->contains($educationStudentWish)) {
+            $this->educationStudentWish[] = $educationStudentWish;
+        }
+
+        return $this;
+    }
+
+    function removeEducationStudentWish(EducationStudentWish $educationStudentWish): self
+    {
+        $this->educationStudentWish->removeElement($educationStudentWish);
+
         return $this;
     }
 
@@ -206,9 +216,19 @@ class EducationCurriculum
         return $this->courses;
     }
 
-    function setCourses(Collection $courses): self
+    function addCourse(Course $course): self
+    {
+        if (!$this->courses->contains($course)) {
+            $this->courses[] = $course;
+        }
+
+        return $this;
+    }
+
+    function removeCourse(Course $course): self
     {
-        $this->courses = $courses;
+        $this->courses->removeElement($course);
+
         return $this;
     }
 
@@ -217,9 +237,19 @@ class EducationCurriculum
         return $this->examens;
     }
 
-    function setExamens(Collection $examens): self
+    function addExamen(Examen $examen): self
     {
-        $this->examens = $examens;
+        if (!$this->examens->contains($examen)) {
+            $this->examens[] = $examen;
+        }
+
+        return $this;
+    }
+
+    function removeExamen(Examen $examen): self
+    {
+        $this->examens->removeElement($examen);
+
         return $this;
     }
 
@@ -228,20 +258,19 @@ class EducationCurriculum
         return $this->intangibles;
     }
 
-    function setIntangibles(Collection $intangibles): self
+    function addIntangible(Intangible $intangible): self
     {
-        $this->intangibles = $intangibles;
+        if (!$this->intangibles->contains($intangible)) {
+            $this->intangibles[] = $intangible;
+        }
+
         return $this;
     }
 
-    function getRequiredEducationCurriculumPacks(): Collection
+    function removeIntangible(Intangible $intangible): self
     {
-        return $this->requiredEducationCurriculumPacks;
-    }
+        $this->intangibles->removeElement($intangible);
 
-    function setRequiredEducationCurriculumPacks(Collection $requiredEducationCurriculumPacks): self
-    {
-        $this->requiredEducationCurriculumPacks = $requiredEducationCurriculumPacks;
         return $this;
     }
 
@@ -250,9 +279,21 @@ class EducationCurriculum
         return $this->requiredChoicesEducationCurriculumPacks;
     }
 
-    function setRequiredChoicesEducationCurriculumPacks(Collection $requiredChoicesEducationCurriculumPacks): self
-    {
-        $this->requiredChoicesEducationCurriculumPacks = $requiredChoicesEducationCurriculumPacks;
+    function addRequiredChoicesEducationCurriculumPack(
+        EducationCurriculumPack $requiredChoicesEducationCurriculumPack,
+    ): self {
+        if (!$this->requiredChoicesEducationCurriculumPacks->contains($requiredChoicesEducationCurriculumPack)) {
+            $this->requiredChoicesEducationCurriculumPacks[] = $requiredChoicesEducationCurriculumPack;
+        }
+
+        return $this;
+    }
+
+    function removeRequiredChoicesEducationCurriculumPack(
+        EducationCurriculumPack $requiredChoicesEducationCurriculumPack,
+    ): self {
+        $this->requiredChoicesEducationCurriculumPacks->removeElement($requiredChoicesEducationCurriculumPack);
+
         return $this;
     }
 
@@ -261,9 +302,19 @@ class EducationCurriculum
         return $this->optionnalEducationCurriculumPacks;
     }
 
-    function setOptionnalEducationCurriculumPacks(Collection $optionnalEducationCurriculumPacks): self
+    function addOptionnalEducationCurriculumPack(EducationCurriculumPack $optionnalEducationCurriculumPack): self
     {
-        $this->optionnalEducationCurriculumPacks = $optionnalEducationCurriculumPacks;
+        if (!$this->optionnalEducationCurriculumPacks->contains($optionnalEducationCurriculumPack)) {
+            $this->optionnalEducationCurriculumPacks[] = $optionnalEducationCurriculumPack;
+        }
+
+        return $this;
+    }
+
+    function removeOptionnalEducationCurriculumPack(EducationCurriculumPack $optionnalEducationCurriculumPack): self
+    {
+        $this->optionnalEducationCurriculumPacks->removeElement($optionnalEducationCurriculumPack);
+
         return $this;
     }
 }

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

@@ -55,8 +55,8 @@ abstract class AbstractMessage
     #[ORM\Column(type: 'text', nullable: true)]
     protected string $text;
 
-    #[ORM\OneToMany(mappedBy: 'message', targetEntity: ReportMessage::class, cascade: ['persist'], orphanRemoval: true)]
-    protected Collection $reportMessage;
+//    #[ORM\OneToMany(mappedBy: 'message', targetEntity: ReportMessage::class, cascade: ['persist'], orphanRemoval: true)]
+//    protected Collection $reportMessage;
 
     public function __construct()
     {
@@ -138,9 +138,19 @@ abstract class AbstractMessage
         return $this->reportMessage;
     }
 
-    function setReportMessage(Collection $reportMessage): self
+    function addReportMessage(ReportMessage $reportMessage): self
     {
-        $this->reportMessage = $reportMessage;
+        if (!$this->reportMessage->contains($reportMessage)) {
+            $this->reportMessage[] = $reportMessage;
+        }
+
+        return $this;
+    }
+
+    function removeReportMessage(ReportMessage $reportMessage): self
+    {
+        $this->reportMessage->removeElement($reportMessage);
+
         return $this;
     }
 }

+ 12 - 2
src/Entity/Organization/OnlineRegistrationSettings.php

@@ -263,9 +263,19 @@ class OnlineRegistrationSettings
         return $this->adultStudentDocuments;
     }
 
-    function setAdultStudentDocuments(Collection $adultStudentDocuments): self
+    function addAdultStudentDocument(OnlineRegistrationDocument $adultStudentDocument): self
     {
-        $this->adultStudentDocuments = $adultStudentDocuments;
+        if (!$this->adultStudentDocuments->contains($adultStudentDocument)) {
+            $this->adultStudentDocuments[] = $adultStudentDocument;
+        }
+
+        return $this;
+    }
+
+    function removeAdultStudentDocument(OnlineRegistrationDocument $adultStudentDocument): self
+    {
+        $this->adultStudentDocuments->removeElement($adultStudentDocument);
+
         return $this;
     }
 }

+ 106 - 48
src/Entity/Organization/Organization.php

@@ -485,6 +485,22 @@ class Organization
         return $this->accesses;
     }
 
+    function addAccess(Access $access): self
+    {
+        if (!$this->access->contains($access)) {
+            $this->access[] = $access;
+        }
+
+        return $this;
+    }
+
+    function removeAccess(Access $access): self
+    {
+        $this->access->removeElement($access);
+
+        return $this;
+    }
+
     public function getNetworkOrganizations(): Collection
     {
         return $this->networkOrganizations;
@@ -1244,28 +1260,6 @@ class Organization
         return $this->subdomains;
     }
 
-    public function addAccess(Access $access): self
-    {
-        if (!$this->accesses->contains($access)) {
-            $this->accesses[] = $access;
-            $access->setOrganization($this);
-        }
-
-        return $this;
-    }
-
-    public function removeAccess(Access $access): self
-    {
-        if ($this->accesses->removeElement($access)) {
-            // set the owning side to null (unless already changed)
-            if ($access->getOrganization() === $this) {
-                $access->setOrganization(null);
-            }
-        }
-
-        return $this;
-    }
-
     public function getContactPerson(): ?Access
     {
         return $this->contactPerson;
@@ -1908,9 +1902,19 @@ class Organization
         return $this->network;
     }
 
-    function setNetwork(Collection $network): self
+    function addNetwork(NetworkOrganization $network): self
+    {
+        if (!$this->network->contains($network)) {
+            $this->network[] = $network;
+        }
+
+        return $this;
+    }
+
+    function removeNetwork(NetworkOrganization $network): self
     {
-        $this->network = $network;
+        $this->network->removeElement($network);
+
         return $this;
     }
 
@@ -1919,9 +1923,19 @@ class Organization
         return $this->networkChild;
     }
 
-    function setNetworkChild(Collection $networkChild): self
+    function addNetworkChild(NetworkOrganization $networkChild): self
+    {
+        if (!$this->networkChild->contains($networkChild)) {
+            $this->networkChild[] = $networkChild;
+        }
+
+        return $this;
+    }
+
+    function removeNetworkChild(NetworkOrganization $networkChild): self
     {
-        $this->networkChild = $networkChild;
+        $this->networkChild->removeElement($networkChild);
+
         return $this;
     }
 
@@ -1936,25 +1950,24 @@ class Organization
         return $this;
     }
 
-    function getAccess(): Collection
+    function getMessages(): Collection
     {
-        return $this->access;
+        return $this->messages;
     }
 
-    function setAccess(Collection $access): self
+    function addMessage(mixed $message): self
     {
-        $this->access = $access;
+        if (!$this->messages->contains($message)) {
+            $this->messages[] = $message;
+        }
+
         return $this;
     }
 
-    function getMessages(): Collection
+    function removeMessage(mixed $message): self
     {
-        return $this->messages;
-    }
+        $this->messages->removeElement($message);
 
-    function setMessages(Collection $messages): self
-    {
-        $this->messages = $messages;
         return $this;
     }
 
@@ -1974,9 +1987,19 @@ class Organization
         return $this->cotisationByYears;
     }
 
-    function setCotisationByYears(Collection $cotisationByYears): self
+    function addCotisationByYear(CotisationByYear $cotisationByYear): self
+    {
+        if (!$this->cotisationByYears->contains($cotisationByYear)) {
+            $this->cotisationByYears[] = $cotisationByYear;
+        }
+
+        return $this;
+    }
+
+    function removeCotisationByYear(CotisationByYear $cotisationByYear): self
     {
-        $this->cotisationByYears = $cotisationByYears;
+        $this->cotisationByYears->removeElement($cotisationByYear);
+
         return $this;
     }
 
@@ -1985,9 +2008,19 @@ class Organization
         return $this->attendanceBookingReasons;
     }
 
-    function setAttendanceBookingReasons(Collection $attendanceBookingReasons): self
+    function addAttendanceBookingReason(AttendanceBookingReason $attendanceBookingReason): self
     {
-        $this->attendanceBookingReasons = $attendanceBookingReasons;
+        if (!$this->attendanceBookingReasons->contains($attendanceBookingReason)) {
+            $this->attendanceBookingReasons[] = $attendanceBookingReason;
+        }
+
+        return $this;
+    }
+
+    function removeAttendanceBookingReason(AttendanceBookingReason $attendanceBookingReason): self
+    {
+        $this->attendanceBookingReasons->removeElement($attendanceBookingReason);
+
         return $this;
     }
 
@@ -1996,9 +2029,19 @@ class Organization
         return $this->educationCurriculumPacks;
     }
 
-    function setEducationCurriculumPacks(Collection $educationCurriculumPacks): self
+    function addEducationCurriculumPack(Cycle $educationCurriculumPack): self
+    {
+        if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
+            $this->educationCurriculumPacks[] = $educationCurriculumPack;
+        }
+
+        return $this;
+    }
+
+    function removeEducationCurriculumPack(Cycle $educationCurriculumPack): self
     {
-        $this->educationCurriculumPacks = $educationCurriculumPacks;
+        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+
         return $this;
     }
 
@@ -2007,20 +2050,35 @@ class Organization
         return $this->familyQuotientModels;
     }
 
-    function setFamilyQuotientModels(Collection $familyQuotientModels): self
+    function addFamilyQuotientModel(FamilyQuotientModel $familyQuotientModel): self
     {
-        $this->familyQuotientModels = $familyQuotientModels;
+        if (!$this->familyQuotientModels->contains($familyQuotientModel)) {
+            $this->familyQuotientModels[] = $familyQuotientModel;
+        }
+
         return $this;
     }
 
-    function getBillSchedules(): Collection
+    function removeFamilyQuotientModel(FamilyQuotientModel $familyQuotientModel): self
     {
-        return $this->billSchedules;
+        $this->familyQuotientModels->removeElement($familyQuotientModel);
+
+        return $this;
     }
 
-    function setBillSchedules(Collection $billSchedules): self
+    function addBillSchedule(BillSchedule $billSchedule): self
     {
-        $this->billSchedules = $billSchedules;
+        if (!$this->billSchedules->contains($billSchedule)) {
+            $this->billSchedules[] = $billSchedule;
+        }
+
+        return $this;
+    }
+
+    function removeBillSchedule(BillSchedule $billSchedule): self
+    {
+        $this->billSchedules->removeElement($billSchedule);
+
         return $this;
     }
 }

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

@@ -21,8 +21,8 @@ abstract class AbstractProduct
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'products', cascade: ['persist'], orphanRemoval: false)]
-    protected Collection $tags;
+//    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'products', cascade: ['persist'], orphanRemoval: false)]
+//    protected Collection $tags;
 
     #[ORM\ManyToOne]
     protected Organization $organization;
@@ -42,9 +42,19 @@ abstract class AbstractProduct
         return $this->tags;
     }
 
-    function setTags(Collection $tags): self
+    function addTag(Tagg $tag): self
     {
-        $this->tags = $tags;
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+        }
+
+        return $this;
+    }
+
+    function removeTag(Tagg $tag): self
+    {
+        $this->tags->removeElement($tag);
+
         return $this;
     }
 }

+ 39 - 12
src/Entity/Product/Equipment.php

@@ -406,15 +406,12 @@ class Equipment extends AbstractProduct
         return $this;
     }
 
-    /**
-     * @return Collection<int, Tagg>
-     */
-    public function getTags(): Collection
+    function getTags(): Collection
     {
         return $this->tags;
     }
 
-    public function addTag(Tagg $tag): self
+    function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
@@ -423,7 +420,7 @@ class Equipment extends AbstractProduct
         return $this;
     }
 
-    public function removeTag(Tagg $tag): self
+    function removeTag(Tagg $tag): self
     {
         $this->tags->removeElement($tag);
 
@@ -435,9 +432,19 @@ class Equipment extends AbstractProduct
         return $this->equipmentCompositionChildren;
     }
 
-    function setEquipmentCompositionChildren(Collection $equipmentCompositionChildren): self
+    function addEquipmentCompositionChildren(EquipmentComposition $equipmentCompositionChildren): self
+    {
+        if (!$this->equipmentCompositionChildren->contains($equipmentCompositionChildren)) {
+            $this->equipmentCompositionChildren[] = $equipmentCompositionChildren;
+        }
+
+        return $this;
+    }
+
+    function removeEquipmentCompositionChildren(EquipmentComposition $equipmentCompositionChildren): self
     {
-        $this->equipmentCompositionChildren = $equipmentCompositionChildren;
+        $this->equipmentCompositionChildren->removeElement($equipmentCompositionChildren);
+
         return $this;
     }
 
@@ -446,9 +453,19 @@ class Equipment extends AbstractProduct
         return $this->equipmentLoanFiltered;
     }
 
-    function setEquipmentLoanFiltered(Collection $equipmentLoanFiltered): self
+    function addEquipmentLoanFiltered(EquipmentLoan $equipmentLoanFiltered): self
     {
-        $this->equipmentLoanFiltered = $equipmentLoanFiltered;
+        if (!$this->equipmentLoanFiltered->contains($equipmentLoanFiltered)) {
+            $this->equipmentLoanFiltered[] = $equipmentLoanFiltered;
+        }
+
+        return $this;
+    }
+
+    function removeEquipmentLoanFiltered(EquipmentLoan $equipmentLoanFiltered): self
+    {
+        $this->equipmentLoanFiltered->removeElement($equipmentLoanFiltered);
+
         return $this;
     }
 
@@ -457,9 +474,19 @@ class Equipment extends AbstractProduct
         return $this->examenConvocations;
     }
 
-    function setExamenConvocations(Collection $examenConvocations): self
+    function addExamenConvocation(ExamenConvocation $examenConvocation): self
     {
-        $this->examenConvocations = $examenConvocations;
+        if (!$this->examenConvocations->contains($examenConvocation)) {
+            $this->examenConvocations[] = $examenConvocation;
+        }
+
+        return $this;
+    }
+
+    function removeExamenConvocation(ExamenConvocation $examenConvocation): self
+    {
+        $this->examenConvocations->removeElement($examenConvocation);
+
         return $this;
     }
 }

+ 12 - 2
src/Entity/Product/Intangible.php

@@ -178,9 +178,19 @@ class Intangible extends AbstractProduct
         return $this->intangiblePriceAndDiscount;
     }
 
-    function setIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
+    function addEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
     {
-        $this->intangiblePriceAndDiscount = $intangiblePriceAndDiscount;
+        if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
+            $this->educationCurriculumPacks[] = $educationCurriculumPack;
+        }
+
+        return $this;
+    }
+
+    function removeEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
+    {
+        $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
+
         return $this;
     }
 }

+ 5 - 1
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -538,7 +538,11 @@ class SchemaSnippetsMaker
                 $targetEntityName = str_replace('::class', '', $targetEntityName);
 
                 if (!str_contains($targetEntityName, '\\')) {
-                    $targetEntityName = $this->entityUtils->getFullNameFromEntityName($targetEntityName);
+                    try {
+                        $targetEntityName = $this->entityUtils->getFullNameFromEntityName($targetEntityName);
+                    } catch (\LogicException) {
+                        return null;
+                    }
                 }
                 return $targetEntityName;
             }