소스 검색

fix AbstractBooking typing

Olivier Massot 11 달 전
부모
커밋
9443211db0
1개의 변경된 파일36개의 추가작업 그리고 6개의 파일을 삭제
  1. 36 6
      src/Entity/Booking/AbstractBooking.php

+ 36 - 6
src/Entity/Booking/AbstractBooking.php

@@ -131,9 +131,19 @@ abstract class AbstractBooking
         return $this->organizer;
     }
 
-    function setOrganizer(Collection $organizer): self
+    function addOrganizer(Access $organizer): self
     {
-        $this->organizer = $organizer;
+        if (!$this->organizer->contains($organizer)) {
+            $this->organizer[] = $organizer;
+        }
+
+        return $this;
+    }
+
+    function removeOrganizer(Access $organizer): self
+    {
+        $this->organizer->removeElement($organizer);
+
         return $this;
     }
 
@@ -142,9 +152,19 @@ abstract class AbstractBooking
         return $this->equipments;
     }
 
-    function setEquipments(Collection $equipments): self
+    function addEquipment(Equipment $equipment): self
+    {
+        if (!$this->equipments->contains($equipment)) {
+            $this->equipments[] = $equipment;
+        }
+
+        return $this;
+    }
+
+    function removeEquipment(Equipment $equipment): self
     {
-        $this->equipments = $equipments;
+        $this->equipments->removeElement($equipment);
+
         return $this;
     }
 
@@ -153,9 +173,19 @@ abstract class AbstractBooking
         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;
     }
 }