X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/89206adbc7af13fc281d31dabcc416d973982428..6235f8f993d9a97f08d00ce578c86da020d7e978:/Entity/Location.php diff --git a/Entity/Location.php b/Entity/Location.php index c379b56..613e462 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,13 @@ class Location { * @return bool */ public function removeUser(User $user): bool { + if (!$this->users->contains($user)) { + return true; + } + + //Remove from owning side + $user->removeSubscriber($this); + return $this->users->removeElement($user); }