/** * Unsubscribe user * * @param Contact $user * @return boolean */ function unsubscribeUser(Contact $user) { $subscription = ObjectSubscriptions::findById(array('object_id' => $this->getId(), 'contact_id' => $user->getId())); // findById if ($subscription instanceof ObjectSubscription) { return $subscription->delete(); } else { return true; } // if }
/** * Unsubscribe user * * @param User $user * @return boolean */ function unsubscribeUser(User $user) { $subscription = ObjectSubscriptions::findById(array('object_id' => $this->getId(), 'object_manager' => get_class($this->manager()), 'user_id' => $user->getId())); // findById if ($subscription instanceof ObjectSubscription) { return $subscription->delete(); } else { return true; } // if }