]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Location.php
Protect from infinite remove recursion
[airbundle] / Entity / Location.php
index 984e8d86449593b160334a94560d2ddfd34211c3..613e46281c3664f841ddbc86f8790c8bfb50f966 100644 (file)
@@ -444,6 +444,10 @@ class Location {
         * @return bool
         */
        public function removeUser(User $user): bool {
         * @return bool
         */
        public function removeUser(User $user): bool {
+               if (!$this->users->contains($user)) {
+                       return true;
+               }
+
                //Remove from owning side
                $user->removeSubscriber($this);
 
                //Remove from owning side
                $user->removeSubscriber($this);