/** * @param Event $event * @param User $user * @param boolean $isStudent * @param string $registrationType * @return Attendee */ public function create(Event $event, User $user, $isStudent, $registrationType) { $attendee = new Attendee(); $attendee->setEvent($event); $attendee->setUser($user); $attendee->setStatus(Attendee::WAITING_PAYMENT); $attendee->setArrived(false); $attendee->setStudentRegistration($isStudent); $attendee->setRegistrationType($registrationType); $attendee->setCreationTime(new DateTime()); if ($this->talkService->userHasAnyApprovedTalk($user, $event)) { $attendee->setStatus(Attendee::PAYMENT_NOT_NECESSARY); $attendee->setRegistrationType(Attendee::WORKSHOPS_AND_TALKS); } return $attendee; }