]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Dance.php
Fix dance user add/remove from inverse side
[airbundle] / Entity / Dance.php
index 59896cdad505495196db859127b24a081cda5c7b..796b81f20798f80239fca9dee7fee51ced9ce337 100644 (file)
@@ -210,7 +210,7 @@ class Dance {
         */
        public function addUser(User $user): Dance {
                //Add from owning side
         */
        public function addUser(User $user): Dance {
                //Add from owning side
-               $user->addSubscriber($this);
+               $user->addDance($this);
 
                $this->users[] = $user;
 
 
                $this->users[] = $user;
 
@@ -225,8 +225,12 @@ class Dance {
         * @return bool
         */
        public function removeUser(User $user): bool {
         * @return bool
         */
        public function removeUser(User $user): bool {
+               if (!$this->dances->contains($user)) {
+                       return true;
+               }
+
                //Remove from owning side
                //Remove from owning side
-               $user->removeSubscriber($this);
+               $user->removeDance($this);
 
                return $this->users->removeElement($user);
        }
 
                return $this->users->removeElement($user);
        }