浏览代码

fix phpstan errors

Olivier Massot 8 月之前
父节点
当前提交
067a7f8bc0

+ 4 - 0
.gitlab-ci.yml

@@ -27,6 +27,10 @@ code_style:
   script:
     - php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php
 
+doctrine:
+  script:
+    - php bin/console d:s:v
+
 unit:
   stage: test
 

+ 1 - 1
src/Entity/Access/Access.php

@@ -1195,7 +1195,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    public function removePracticalCourse(AbstractBooking $practicalCourse): self
+    public function removePracticalCourse(Course $practicalCourse): self
     {
         if ($this->practicalCourses->removeElement($practicalCourse)) {
             $practicalCourse->removeOrganizer($this);

+ 33 - 0
src/Entity/Booking/AbstractBooking.php

@@ -6,8 +6,10 @@ namespace App\Entity\Booking;
 
 use App\Attribute\ActivityYearConstraintAware;
 use App\Attribute\OrganizationDefaultValue;
+use App\Entity\Core\Tagg;
 use App\Entity\Traits\ActivityYearTrait;
 use App\Enum\Booking\VisibilityEnum;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -57,6 +59,13 @@ abstract class AbstractBooking
     #[ORM\Column(unique: true)]
     protected string $uuid;
 
+    /** @var Collection<int, Tagg> */
+    #[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 getId(): ?int
     {
         return $this->id;
@@ -121,4 +130,28 @@ abstract class AbstractBooking
 
         return $this;
     }
+
+    public function getTags(): Collection
+    {
+        return $this->tags;
+    }
+
+    public function addTag(Tagg $tag): self
+    {
+        if (!$this->tags->contains($tag)) {
+            $this->tags[] = $tag;
+            $tag->addBooking($this);
+        }
+
+        return $this;
+    }
+
+    public function removeTag(Tagg $tag): self
+    {
+        if ($this->tags->removeElement($tag)) {
+            $tag->removeBooking($this);
+        }
+
+        return $this;
+    }
 }

+ 0 - 38
src/Entity/Booking/Examen.php

@@ -80,19 +80,6 @@ class Examen extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'equipment_id')]
     protected Collection $equipments;
 
-    /** @var Collection<int, Access> */
-    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
-    #[ORM\JoinTable(name: 'booking_organizer')]
-    #[ORM\JoinColumn(name: 'booking_id')]
-    protected Collection $organizer;
-
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'examens', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_booking')]
-    #[ORM\JoinColumn(name: 'booking_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();
@@ -101,7 +88,6 @@ class Examen extends AbstractBooking
         $this->convocation = new ArrayCollection();
         $this->attendanceBooking = new ArrayCollection();
         $this->tags = new ArrayCollection();
-        $this->organizer = new ArrayCollection();
         $this->equipments = new ArrayCollection();
     }
 
@@ -321,30 +307,6 @@ class Examen extends AbstractBooking
         return $this;
     }
 
-    public function getOrganizer(): Collection
-    {
-        return $this->organizer;
-    }
-
-    public function addOrganizer(Access $organizer): self
-    {
-        if (!$this->organizer->contains($organizer)) {
-            $this->organizer[] = $organizer;
-            $organizer->addPracticalCourse($this);
-        }
-
-        return $this;
-    }
-
-    public function removeOrganizer(Access $organizer): self
-    {
-        if ($this->organizer->removeElement($organizer)) {
-            $organizer->removePracticalCourse($this);
-        }
-
-        return $this;
-    }
-
     public function getEquipments(): Collection
     {
         return $this->equipments;

+ 0 - 38
src/Entity/Booking/OrganizationHoliday.php

@@ -32,12 +32,6 @@ class OrganizationHoliday extends AbstractBooking
     #[ORM\JoinColumn(nullable: false)]
     private Organization $organization;
 
-    /** @var Collection<int, Access> */
-    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
-    #[ORM\JoinTable(name: 'booking_organizer')]
-    #[ORM\JoinColumn(name: 'booking_id')]
-    protected Collection $organizer;
-
     /** @var Collection<int, Equipment> */
     #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
     #[ORM\JoinTable(name: 'booking_equipment')]
@@ -45,17 +39,9 @@ class OrganizationHoliday extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'equipment_id')]
     protected Collection $equipments;
 
-    /** @var Collection<int, Tagg> */
-    #[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();
     }
@@ -102,30 +88,6 @@ class OrganizationHoliday extends AbstractBooking
         return $this;
     }
 
-    public function getOrganizer(): Collection
-    {
-        return $this->organizer;
-    }
-
-    public function addOrganizer(Access $organizer): self
-    {
-        if (!$this->organizer->contains($organizer)) {
-            $this->organizer[] = $organizer;
-            $organizer->addPracticalCourse($this);
-        }
-
-        return $this;
-    }
-
-    public function removeOrganizer(Access $organizer): self
-    {
-        if ($this->organizer->removeElement($organizer)) {
-            $organizer->removePracticalCourse($this);
-        }
-
-        return $this;
-    }
-
     public function getEquipments(): Collection
     {
         return $this->equipments;

+ 0 - 62
src/Entity/Booking/PersonHoliday.php

@@ -35,12 +35,6 @@ class PersonHoliday extends AbstractBooking
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
     protected Organization $organization;
 
-    /** @var Collection<int, Access> */
-    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'practicalCourses', cascade: [], orphanRemoval: false)]
-    #[ORM\JoinTable(name: 'booking_organizer')]
-    #[ORM\JoinColumn(name: 'booking_id')]
-    protected Collection $organizer;
-
     /** @var Collection<int, Equipment> */
     #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
     #[ORM\JoinTable(name: 'booking_equipment')]
@@ -48,17 +42,9 @@ class PersonHoliday extends AbstractBooking
     #[ORM\InverseJoinColumn(name: 'equipment_id')]
     protected Collection $equipments;
 
-    /** @var Collection<int, Tagg> */
-    #[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();
     }
@@ -117,30 +103,6 @@ class PersonHoliday extends AbstractBooking
         return $this;
     }
 
-    public function getOrganizer(): Collection
-    {
-        return $this->organizer;
-    }
-
-    public function addOrganizer(Access $organizer): self
-    {
-        if (!$this->organizer->contains($organizer)) {
-            $this->organizer[] = $organizer;
-            $organizer->addPracticalCourse($this);
-        }
-
-        return $this;
-    }
-
-    public function removeOrganizer(Access $organizer): self
-    {
-        if ($this->organizer->removeElement($organizer)) {
-            $organizer->removePracticalCourse($this);
-        }
-
-        return $this;
-    }
-
     public function getEquipments(): Collection
     {
         return $this->equipments;
@@ -164,28 +126,4 @@ class PersonHoliday extends AbstractBooking
 
         return $this;
     }
-
-    public function getTags(): Collection
-    {
-        return $this->tags;
-    }
-
-    public function addTag(Tagg $tag): self
-    {
-        if (!$this->tags->contains($tag)) {
-            $this->tags[] = $tag;
-            $tag->addBooking($this);
-        }
-
-        return $this;
-    }
-
-    public function removeTag(Tagg $tag): self
-    {
-        if ($this->tags->removeElement($tag)) {
-            $tag->removeBooking($this);
-        }
-
-        return $this;
-    }
 }

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

@@ -8,6 +8,7 @@ use App\Entity\Access\Access;
 use App\Entity\Place\PlaceControl;
 use App\Entity\Place\RoomControl;
 use App\Entity\Product\EquipmentControl;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -35,6 +36,13 @@ abstract class AbstractControl
     #[ORM\JoinColumn(nullable: true)]
     protected ?Access $accompanist = null;
 
+    /** @var Collection<int, Tagg> */
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'controls', cascade: ['persist'])]
+    #[ORM\JoinTable(name: 'tag_control')]
+    #[ORM\JoinColumn(name: 'control_id', referencedColumnName: 'id')]
+    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
+    protected Collection $tags;
+
     public function getId(): ?int
     {
         return $this->id;
@@ -51,4 +59,25 @@ abstract class AbstractControl
 
         return $this;
     }
+
+    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;
+    }
 }

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

@@ -7,10 +7,11 @@ namespace App\Entity\Core;
 use App\Entity\Place\PlaceRepair;
 use App\Entity\Place\RoomRepair;
 use App\Entity\Product\EquipmentRepair;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
- * Classe de base de @see PlaceRepair, RoomRepair, EquipmentRepair.
+ * Classe de base de @see PlaceRepair, RoomRepair, EquipmentRepair
  */
 #[ORM\MappedSuperclass]
 #[ORM\Table(name: 'Repair')]
@@ -29,8 +30,39 @@ abstract class AbstractRepair
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
+    /** @var Collection<int, Tagg> */
+    #[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 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 - 8
src/Entity/Organization/Organization.php

@@ -37,7 +37,7 @@ use App\Entity\Message\Mail;
 use App\Entity\Message\Sms;
 use App\Entity\Network\NetworkOrganization;
 use App\Entity\Person\Commission;
-use App\Entity\Place\AbstractPlace;
+use App\Entity\Place\Place;
 use App\Entity\Product\Equipment;
 use App\Entity\Product\Intangible;
 use App\Entity\Reward\Reward;
@@ -337,8 +337,8 @@ class Organization
     #[ORM\OneToMany(targetEntity: Commission::class, mappedBy: 'organization', cascade: ['persist', 'remove'], orphanRemoval: true)]
     private Collection $commissions;
 
-    /** @var Collection<int, AbstractPlace> */
-    #[ORM\OneToMany(mappedBy: 'organization', targetEntity: AbstractPlace::class, orphanRemoval: true)]
+    /** @var Collection<int, Place> */
+    #[ORM\OneToMany(mappedBy: 'organization', targetEntity: Place::class, orphanRemoval: true)]
     private Collection $places;
 
     /** @var Collection<int, Attendance> */
@@ -1756,15 +1756,12 @@ class Organization
         return $this;
     }
 
-    /**
-     * @return Collection<int, AbstractPlace>
-     */
     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;
@@ -1774,7 +1771,7 @@ class Organization
         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)

+ 0 - 368
src/Entity/Place/AbstractPlace.php

@@ -43,10 +43,6 @@ abstract class AbstractPlace
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?AddressPostal $addressPostal;
 
-    /** @var Collection<int, Event> */
-    #[ORM\OneToMany(targetEntity: Event::class, mappedBy: 'place')]
-    private Collection $events;
-
     /** @var Collection<int, Tagg> */
     #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'places', cascade: ['persist'])]
     #[ORM\JoinTable(name: 'tag_place')]
@@ -54,64 +50,9 @@ abstract class AbstractPlace
     #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
     private Collection $tags;
 
-    #[ORM\ManyToOne(inversedBy: 'places')]
-    private ?Organization $organization;
-
-    /** @var Collection<int, ContactPoint> */
-    #[ORM\ManyToMany(targetEntity: ContactPoint::class, inversedBy: 'place', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'place_contactpoint')]
-    #[ORM\JoinColumn(name: 'contactPoint_id', referencedColumnName: 'id', unique: true)]
-    #[ORM\InverseJoinColumn(name: 'place_id', referencedColumnName: 'id')]
-    private Collection $contactpoint;
-
-    /** @var Collection<int, Room> */
-    #[ORM\OneToMany(targetEntity: Room::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
-    #[ORM\JoinColumn(nullable: false)]
-    private Collection $rooms;
-
-    /** @var Collection<int, PlaceControl> */
-    #[ORM\OneToMany(targetEntity: PlaceControl::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
-    #[ORM\JoinColumn(nullable: false)]
-    private Collection $controls;
-
-    /** @var Collection<int, PlaceRepair> */
-    #[ORM\OneToMany(targetEntity: PlaceRepair::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
-    #[ORM\JoinColumn(nullable: false)]
-    private Collection $repairs;
-
-    /** @var Collection<int, Course> */
-    #[ORM\OneToMany(targetEntity: Course::class, mappedBy: 'place')]
-    private Collection $courses;
-
-    /** @var Collection<int, EducationalProject> */
-    #[ORM\OneToMany(targetEntity: EducationalProject::class, mappedBy: 'place')]
-    private Collection $educationalProjects;
-
-    /** @var Collection<int, Examen> */
-    #[ORM\OneToMany(targetEntity: Examen::class, mappedBy: 'place')]
-    private Collection $examens;
-
-    /** @var Collection<int, Equipment> */
-    #[ORM\OneToMany(targetEntity: Equipment::class, mappedBy: 'placeStorage')]
-    private Collection $equipmentStorages;
-
-    /** @var Collection<int, Equipment> */
-    #[ORM\OneToMany(targetEntity: Equipment::class, mappedBy: 'placeWhereIsUsed')]
-    private Collection $equipmentUseds;
-
     public function __construct()
     {
-        $this->events = new ArrayCollection();
         $this->tags = new ArrayCollection();
-        $this->contactpoint = new ArrayCollection();
-        $this->rooms = new ArrayCollection();
-        $this->controls = new ArrayCollection();
-        $this->repairs = new ArrayCollection();
-        $this->courses = new ArrayCollection();
-        $this->educationalProjects = new ArrayCollection();
-        $this->examens = new ArrayCollection();
-        $this->equipmentStorages = new ArrayCollection();
-        $this->equipmentUseds = new ArrayCollection();
     }
 
     public function getId(): ?int
@@ -131,39 +72,6 @@ abstract class AbstractPlace
         return $this;
     }
 
-    /**
-     * @return Collection<int, Event>
-     */
-    public function getEvents(): Collection
-    {
-        return $this->events;
-    }
-
-    public function addEvent(Event $event): self
-    {
-        if (!$this->events->contains($event)) {
-            $this->events[] = $event;
-            $event->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeEvent(Event $event): self
-    {
-        if ($this->events->removeElement($event)) {
-            // set the owning side to null (unless already changed)
-            if ($event->getPlace() === $this) {
-                $event->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Tagg>
-     */
     public function getTags(): Collection
     {
         return $this->tags;
@@ -184,280 +92,4 @@ abstract class AbstractPlace
 
         return $this;
     }
-
-    public function getOrganization(): ?Organization
-    {
-        return $this->organization;
-    }
-
-    public function setOrganization(?Organization $organization): self
-    {
-        $this->organization = $organization;
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, ContactPoint>
-     */
-    public function getContactpoint(): Collection
-    {
-        return $this->contactpoint;
-    }
-
-    public function addContactpoint(ContactPoint $contactpoint): self
-    {
-        if (!$this->contactpoint->contains($contactpoint)) {
-            $this->contactpoint[] = $contactpoint;
-        }
-
-        return $this;
-    }
-
-    public function removeContactpoint(ContactPoint $contactpoint): self
-    {
-        $this->contactpoint->removeElement($contactpoint);
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Room>
-     */
-    public function getRooms(): Collection
-    {
-        return $this->rooms;
-    }
-
-    public function addRoom(Room $room): self
-    {
-        if (!$this->rooms->contains($room)) {
-            $this->rooms[] = $room;
-            $room->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeRoom(Room $room): self
-    {
-        if ($this->rooms->removeElement($room)) {
-            // set the owning side to null (unless already changed)
-            if ($room->getPlace() === $this) {
-                $room->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, PlaceControl>
-     */
-    public function getControls(): Collection
-    {
-        return $this->controls;
-    }
-
-    public function addControl(PlaceControl $control): self
-    {
-        if (!$this->controls->contains($control)) {
-            $this->controls[] = $control;
-            $control->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeControl(PlaceControl $control): self
-    {
-        if ($this->controls->removeElement($control)) {
-            // set the owning side to null (unless already changed)
-            if ($control->getPlace() === $this) {
-                $control->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, PlaceRepair>
-     */
-    public function getRepairs(): Collection
-    {
-        return $this->repairs;
-    }
-
-    public function addRepair(PlaceRepair $repair): self
-    {
-        if (!$this->repairs->contains($repair)) {
-            $this->repairs[] = $repair;
-            $repair->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeRepair(PlaceRepair $repair): self
-    {
-        if ($this->repairs->removeElement($repair)) {
-            // set the owning side to null (unless already changed)
-            if ($repair->getPlace() === $this) {
-                $repair->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Course>
-     */
-    public function getCourses(): Collection
-    {
-        return $this->courses;
-    }
-
-    public function addCourse(Course $course): self
-    {
-        if (!$this->courses->contains($course)) {
-            $this->courses[] = $course;
-            $course->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeCourse(Course $course): self
-    {
-        if ($this->courses->removeElement($course)) {
-            // set the owning side to null (unless already changed)
-            if ($course->getPlace() === $this) {
-                $course->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, EducationalProject>
-     */
-    public function getEducationalProjects(): Collection
-    {
-        return $this->educationalProjects;
-    }
-
-    public function addEducationalProject(EducationalProject $educationalProject): self
-    {
-        if (!$this->educationalProjects->contains($educationalProject)) {
-            $this->educationalProjects[] = $educationalProject;
-            $educationalProject->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeEducationalProject(EducationalProject $educationalProject): self
-    {
-        if ($this->educationalProjects->removeElement($educationalProject)) {
-            // set the owning side to null (unless already changed)
-            if ($educationalProject->getPlace() === $this) {
-                $educationalProject->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Examen>
-     */
-    public function getExamens(): Collection
-    {
-        return $this->examens;
-    }
-
-    public function addExamen(Examen $examen): self
-    {
-        if (!$this->examens->contains($examen)) {
-            $this->examens[] = $examen;
-            $examen->setPlace($this);
-        }
-
-        return $this;
-    }
-
-    public function removeExamen(Examen $examen): self
-    {
-        if ($this->examens->removeElement($examen)) {
-            // set the owning side to null (unless already changed)
-            if ($examen->getPlace() === $this) {
-                $examen->setPlace(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Equipment>
-     */
-    public function getEquipmentStorages(): Collection
-    {
-        return $this->equipmentStorages;
-    }
-
-    public function addEquipmentStorage(Equipment $equipmentStorage): self
-    {
-        if (!$this->equipmentStorages->contains($equipmentStorage)) {
-            $this->equipmentStorages[] = $equipmentStorage;
-            $equipmentStorage->setPlaceStorage($this);
-        }
-
-        return $this;
-    }
-
-    public function removeEquipmentStorage(Equipment $equipmentStorage): self
-    {
-        if ($this->equipmentStorages->removeElement($equipmentStorage)) {
-            // set the owning side to null (unless already changed)
-            if ($equipmentStorage->getPlaceStorage() === $this) {
-                $equipmentStorage->setPlaceStorage(null);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * @return Collection<int, Equipment>
-     */
-    public function getEquipmentUseds(): Collection
-    {
-        return $this->equipmentUseds;
-    }
-
-    public function addEquipmentUsed(Equipment $equipmentUsed): self
-    {
-        if (!$this->equipmentUseds->contains($equipmentUsed)) {
-            $this->equipmentUseds[] = $equipmentUsed;
-            $equipmentUsed->setPlaceWhereIsUsed($this);
-        }
-
-        return $this;
-    }
-
-    public function removeEquipmentUsed(Equipment $equipmentUsed): self
-    {
-        if ($this->equipmentUseds->removeElement($equipmentUsed)) {
-            // set the owning side to null (unless already changed)
-            if ($equipmentUsed->getPlaceWhereIsUsed() === $this) {
-                $equipmentUsed->setPlaceWhereIsUsed(null);
-            }
-        }
-
-        return $this;
-    }
 }

+ 371 - 0
src/Entity/Place/Place.php

@@ -6,6 +6,15 @@ namespace App\Entity\Place;
 
 use ApiPlatform\Metadata\ApiResource;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use App\Entity\Booking\Course;
+use App\Entity\Booking\EducationalProject;
+use App\Entity\Booking\Event;
+use App\Entity\Booking\Examen;
+use App\Entity\Core\ContactPoint;
+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;
 
 /**
@@ -16,4 +25,366 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Entity]
 class Place extends AbstractPlace
 {
+    /** @var Collection<int, Event> */
+    #[ORM\OneToMany(targetEntity: Event::class, mappedBy: 'place')]
+    private Collection $events;
+
+    #[ORM\ManyToOne(inversedBy: 'places')]
+    private ?Organization $organization;
+
+    /** @var Collection<int, ContactPoint> */
+    #[ORM\ManyToMany(targetEntity: ContactPoint::class, inversedBy: 'place', cascade: ['persist'])]
+    #[ORM\JoinTable(name: 'place_contactpoint')]
+    #[ORM\JoinColumn(name: 'contactPoint_id', referencedColumnName: 'id', unique: true)]
+    #[ORM\InverseJoinColumn(name: 'place_id', referencedColumnName: 'id')]
+    private Collection $contactpoint;
+
+    /** @var Collection<int, Room> */
+    #[ORM\OneToMany(targetEntity: Room::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\JoinColumn(nullable: false)]
+    private Collection $rooms;
+
+    /** @var Collection<int, PlaceControl> */
+    #[ORM\OneToMany(targetEntity: PlaceControl::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\JoinColumn(nullable: false)]
+    private Collection $controls;
+
+    /** @var Collection<int, PlaceRepair> */
+    #[ORM\OneToMany(targetEntity: PlaceRepair::class, mappedBy: 'place', cascade: ['persist'], orphanRemoval: true)]
+    #[ORM\JoinColumn(nullable: false)]
+    private Collection $repairs;
+
+    /** @var Collection<int, Course> */
+    #[ORM\OneToMany(targetEntity: Course::class, mappedBy: 'place')]
+    private Collection $courses;
+
+    /** @var Collection<int, EducationalProject> */
+    #[ORM\OneToMany(targetEntity: EducationalProject::class, mappedBy: 'place')]
+    private Collection $educationalProjects;
+
+    /** @var Collection<int, Examen> */
+    #[ORM\OneToMany(targetEntity: Examen::class, mappedBy: 'place')]
+    private Collection $examens;
+
+    /** @var Collection<int, Equipment> */
+    #[ORM\OneToMany(targetEntity: Equipment::class, mappedBy: 'placeStorage')]
+    private Collection $equipmentStorages;
+
+    /** @var Collection<int, Equipment> */
+    #[ORM\OneToMany(targetEntity: Equipment::class, mappedBy: 'placeWhereIsUsed')]
+    private Collection $equipmentUseds;
+
+    public function __construct()
+    {
+        $this->events = new ArrayCollection();
+        $this->contactpoint = new ArrayCollection();
+        $this->rooms = new ArrayCollection();
+        $this->controls = new ArrayCollection();
+        $this->repairs = new ArrayCollection();
+        $this->courses = new ArrayCollection();
+        $this->educationalProjects = new ArrayCollection();
+        $this->examens = new ArrayCollection();
+        $this->equipmentStorages = new ArrayCollection();
+        $this->equipmentUseds = new ArrayCollection();
+        parent::__construct();
+    }
+
+    public function getEvents(): Collection
+    {
+        return $this->events;
+    }
+
+    public function addEvent(Event $event): self
+    {
+        if (!$this->events->contains($event)) {
+            $this->events[] = $event;
+            $event->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeEvent(Event $event): self
+    {
+        if ($this->events->removeElement($event)) {
+            // set the owning side to null (unless already changed)
+            if ($event->getPlace() === $this) {
+                $event->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+
+    public function getOrganization(): ?Organization
+    {
+        return $this->organization;
+    }
+
+    public function setOrganization(?Organization $organization): self
+    {
+        $this->organization = $organization;
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, ContactPoint>
+     */
+    public function getContactpoint(): Collection
+    {
+        return $this->contactpoint;
+    }
+
+    public function addContactpoint(ContactPoint $contactpoint): self
+    {
+        if (!$this->contactpoint->contains($contactpoint)) {
+            $this->contactpoint[] = $contactpoint;
+        }
+
+        return $this;
+    }
+
+    public function removeContactpoint(ContactPoint $contactpoint): self
+    {
+        $this->contactpoint->removeElement($contactpoint);
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Room>
+     */
+    public function getRooms(): Collection
+    {
+        return $this->rooms;
+    }
+
+    public function addRoom(Room $room): self
+    {
+        if (!$this->rooms->contains($room)) {
+            $this->rooms[] = $room;
+            $room->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeRoom(Room $room): self
+    {
+        $this->rooms->removeElement($room);
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, PlaceControl>
+     */
+    public function getControls(): Collection
+    {
+        return $this->controls;
+    }
+
+    public function addControl(PlaceControl $control): self
+    {
+        if (!$this->controls->contains($control)) {
+            $this->controls[] = $control;
+            $control->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeControl(PlaceControl $control): self
+    {
+        if ($this->controls->removeElement($control)) {
+            // set the owning side to null (unless already changed)
+            if ($control->getPlace() === $this) {
+                $control->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, PlaceRepair>
+     */
+    public function getRepairs(): Collection
+    {
+        return $this->repairs;
+    }
+
+    public function addRepair(PlaceRepair $repair): self
+    {
+        if (!$this->repairs->contains($repair)) {
+            $this->repairs[] = $repair;
+            $repair->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeRepair(PlaceRepair $repair): self
+    {
+        if ($this->repairs->removeElement($repair)) {
+            // set the owning side to null (unless already changed)
+            if ($repair->getPlace() === $this) {
+                $repair->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Course>
+     */
+    public function getCourses(): Collection
+    {
+        return $this->courses;
+    }
+
+    public function addCourse(Course $course): self
+    {
+        if (!$this->courses->contains($course)) {
+            $this->courses[] = $course;
+            $course->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeCourse(Course $course): self
+    {
+        if ($this->courses->removeElement($course)) {
+            // set the owning side to null (unless already changed)
+            if ($course->getPlace() === $this) {
+                $course->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, EducationalProject>
+     */
+    public function getEducationalProjects(): Collection
+    {
+        return $this->educationalProjects;
+    }
+
+    public function addEducationalProject(EducationalProject $educationalProject): self
+    {
+        if (!$this->educationalProjects->contains($educationalProject)) {
+            $this->educationalProjects[] = $educationalProject;
+            $educationalProject->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeEducationalProject(EducationalProject $educationalProject): self
+    {
+        if ($this->educationalProjects->removeElement($educationalProject)) {
+            // set the owning side to null (unless already changed)
+            if ($educationalProject->getPlace() === $this) {
+                $educationalProject->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Examen>
+     */
+    public function getExamens(): Collection
+    {
+        return $this->examens;
+    }
+
+    public function addExamen(Examen $examen): self
+    {
+        if (!$this->examens->contains($examen)) {
+            $this->examens[] = $examen;
+            $examen->setPlace($this);
+        }
+
+        return $this;
+    }
+
+    public function removeExamen(Examen $examen): self
+    {
+        if ($this->examens->removeElement($examen)) {
+            // set the owning side to null (unless already changed)
+            if ($examen->getPlace() === $this) {
+                $examen->setPlace(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Equipment>
+     */
+    public function getEquipmentStorages(): Collection
+    {
+        return $this->equipmentStorages;
+    }
+
+    public function addEquipmentStorage(Equipment $equipmentStorage): self
+    {
+        if (!$this->equipmentStorages->contains($equipmentStorage)) {
+            $this->equipmentStorages[] = $equipmentStorage;
+            $equipmentStorage->setPlaceStorage($this);
+        }
+
+        return $this;
+    }
+
+    public function removeEquipmentStorage(Equipment $equipmentStorage): self
+    {
+        if ($this->equipmentStorages->removeElement($equipmentStorage)) {
+            // set the owning side to null (unless already changed)
+            if ($equipmentStorage->getPlaceStorage() === $this) {
+                $equipmentStorage->setPlaceStorage(null);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return Collection<int, Equipment>
+     */
+    public function getEquipmentUseds(): Collection
+    {
+        return $this->equipmentUseds;
+    }
+
+    public function addEquipmentUsed(Equipment $equipmentUsed): self
+    {
+        if (!$this->equipmentUseds->contains($equipmentUsed)) {
+            $this->equipmentUseds[] = $equipmentUsed;
+            $equipmentUsed->setPlaceWhereIsUsed($this);
+        }
+
+        return $this;
+    }
+
+    public function removeEquipmentUsed(Equipment $equipmentUsed): self
+    {
+        if ($this->equipmentUseds->removeElement($equipmentUsed)) {
+            // set the owning side to null (unless already changed)
+            if ($equipmentUsed->getPlaceWhereIsUsed() === $this) {
+                $equipmentUsed->setPlaceWhereIsUsed(null);
+            }
+        }
+
+        return $this;
+    }
 }

+ 0 - 31
src/Entity/Place/PlaceControl.php

@@ -26,13 +26,6 @@ class PlaceControl extends AbstractControl
     #[ORM\ManyToOne(inversedBy: 'controls')]
     protected ?Place $place;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'placeControls', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_control')]
-    #[ORM\JoinColumn(name: 'control_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     public function __construct()
     {
         $this->tags = new ArrayCollection();
@@ -49,28 +42,4 @@ class PlaceControl extends AbstractControl
 
         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;
-    }
 }

+ 0 - 28
src/Entity/Place/PlaceRepair.php

@@ -31,13 +31,6 @@ class PlaceRepair extends AbstractRepair
     #[ORM\ManyToOne(inversedBy: 'repairs')]
     protected ?Place $place = null;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'placeRepairs', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_repair')]
-    #[ORM\JoinColumn(name: 'repair_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     public function __construct()
     {
         $this->tags = new ArrayCollection();
@@ -66,25 +59,4 @@ class PlaceRepair extends AbstractRepair
 
         return $this;
     }
-
-    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;
-    }
 }

+ 4 - 3
src/Entity/Place/Room.php

@@ -29,7 +29,8 @@ class Room
     private ?int $id = null;
 
     #[ORM\ManyToOne(targetEntity: Place::class, inversedBy: 'rooms')]
-    private ?Place $place = null;
+    #[ORM\JoinColumn(nullable: false)]
+    private Place $place;
 
     /** @var Collection<int, RoomControl> */
     #[ORM\OneToMany(targetEntity: RoomControl::class, mappedBy: 'room', cascade: ['persist'], orphanRemoval: true)]
@@ -82,12 +83,12 @@ class Room
         return $this->id;
     }
 
-    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;
 

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

@@ -24,13 +24,6 @@ class RoomControl extends AbstractControl
     #[ORM\ManyToOne(inversedBy: 'controls')]
     private ?Room $room = null;
 
-    /** @var Collection<int, Tagg> */
-    #[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 getRoom(): ?Room
     {
         return $this->room;
@@ -42,28 +35,4 @@ class RoomControl extends AbstractControl
 
         return $this;
     }
-
-    public function getTags(): Collection
-    {
-        return $this->tags;
-    }
-
-    public function addTag(Tagg $tag): self
-    {
-        if (!$this->tags->contains($tag)) {
-            $this->tags[] = $tag;
-            $tag->addControl($this);
-        }
-
-        return $this;
-    }
-
-    public function removeTag(Tagg $tag): self
-    {
-        if ($this->tags->removeElement($tag)) {
-            $tag->removeControl($this);
-        }
-
-        return $this;
-    }
 }

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

@@ -30,13 +30,6 @@ class RoomRepair extends AbstractRepair
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
     private ?Access $provider = null;
 
-    /** @var Collection<int, Tagg> */
-    #[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();
@@ -65,28 +58,4 @@ class RoomRepair extends AbstractRepair
 
         return $this;
     }
-
-    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;
-    }
 }

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

@@ -25,13 +25,6 @@ class EquipmentControl extends AbstractControl
     #[ORM\ManyToOne(inversedBy: 'equipmentControl')]
     protected ?Equipment $equipment = null;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'equipmentControls', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_control')]
-    #[ORM\JoinColumn(name: 'control_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     public function __construct()
     {
         $this->tags = new ArrayCollection();
@@ -48,28 +41,4 @@ class EquipmentControl extends AbstractControl
 
         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;
-    }
 }

+ 0 - 31
src/Entity/Product/EquipmentRepair.php

@@ -31,13 +31,6 @@ class EquipmentRepair extends AbstractRepair
     #[ORM\ManyToOne(inversedBy: 'equipmentRepair')]
     protected ?Equipment $equipment = null;
 
-    /** @var Collection<int, Tagg> */
-    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'equipmentRepairs', cascade: ['persist'])]
-    #[ORM\JoinTable(name: 'tag_repair')]
-    #[ORM\JoinColumn(name: 'repair_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
-    protected Collection $tags;
-
     public function __construct()
     {
         $this->tags = new ArrayCollection();
@@ -66,28 +59,4 @@ class EquipmentRepair extends AbstractRepair
 
         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;
-    }
 }