]> Raphaël G. Git Repositories - airbundle/commitdiff
Act on owning side
authorRaphaël Gertz <git@rapsys.eu>
Wed, 21 Feb 2024 11:15:08 +0000 (12:15 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Wed, 21 Feb 2024 11:15:08 +0000 (12:15 +0100)
Entity/Dance.php
Entity/Location.php

index dccee339801f6dd00cec7c9a4bfc032bc4a212d5..59896cdad505495196db859127b24a081cda5c7b 100644 (file)
@@ -209,6 +209,9 @@ class Dance {
         * @return Dance
         */
        public function addUser(User $user): Dance {
+               //Add from owning side
+               $user->addSubscriber($this);
+
                $this->users[] = $user;
 
                return $this;
@@ -222,6 +225,9 @@ class Dance {
         * @return bool
         */
        public function removeUser(User $user): bool {
+               //Remove from owning side
+               $user->removeSubscriber($this);
+
                return $this->users->removeElement($user);
        }
 
index c379b560c8a614805d013845a31359e58553fb9b..984e8d86449593b160334a94560d2ddfd34211c3 100644 (file)
@@ -429,6 +429,9 @@ class Location {
         * @return Location
         */
        public function addUser(User $user): Location {
+               //Add from owning side
+               $user->addSubscriber($this);
+
                $this->users[] = $user;
 
                return $this;
@@ -441,6 +444,9 @@ class Location {
         * @return bool
         */
        public function removeUser(User $user): bool {
+               //Remove from owning side
+               $user->removeSubscriber($this);
+
                return $this->users->removeElement($user);
        }