]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Dance.php
Protect from infinite remove recursion
[airbundle] / Entity / Dance.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);
        }