/** * Undo an activity sign up. * * @param ActivityModel $activity * @param Member $user */ public function signOff(ActivityModel $activity, Member $user) { $signUpMapper = $this->getServiceManager()->get('activity_mapper_signup'); $signUp = $signUpMapper->getSignUp($activity->get('id'), $user->getLidnr()); // If the user was not signed up, no need to signoff anyway if (is_null($signUp)) { return; } $em = $this->getServiceManager()->get('Doctrine\\ORM\\EntityManager'); $em->remove($signUp); $em->flush(); }