From c812e773a8195a42a718ce2de0a4e9bca65382aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Wed, 21 Feb 2024 12:15:08 +0100 Subject: [PATCH] Act on owning side --- Entity/Dance.php | 6 ++++++ Entity/Location.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Entity/Dance.php b/Entity/Dance.php index dccee33..59896cd 100644 --- a/Entity/Dance.php +++ b/Entity/Dance.php @@ -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); } diff --git a/Entity/Location.php b/Entity/Location.php index c379b56..984e8d8 100644 --- a/Entity/Location.php +++ b/Entity/Location.php @@ -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); } -- 2.41.0