/** * @param ChildNotificationOnUser $onUser The ChildNotificationOnUser object to remove. * @return $this|ChildNotification The current object (for fluent API support) */ public function removeOnUser(ChildNotificationOnUser $onUser) { if ($this->getOnUsers()->contains($onUser)) { $pos = $this->collOnUsers->search($onUser); $this->collOnUsers->remove($pos); if (null === $this->onUsersScheduledForDeletion) { $this->onUsersScheduledForDeletion = clone $this->collOnUsers; $this->onUsersScheduledForDeletion->clear(); } $this->onUsersScheduledForDeletion[] = $onUser; $onUser->setNotification(null); } return $this; }
/** * @param ChildNotificationOnUser $notification The ChildNotificationOnUser object to remove. * @return $this|ChildUser The current object (for fluent API support) */ public function removeNotification(ChildNotificationOnUser $notification) { if ($this->getNotifications()->contains($notification)) { $pos = $this->collNotifications->search($notification); $this->collNotifications->remove($pos); if (null === $this->notificationsScheduledForDeletion) { $this->notificationsScheduledForDeletion = clone $this->collNotifications; $this->notificationsScheduledForDeletion->clear(); } $this->notificationsScheduledForDeletion[] = $notification; $notification->setUser(null); } return $this; }