/** * @param $lectureId * @throws \Exception * @Method('POST', 'GET') * @Route('lectures/{integer $lectureId}/participate') */ public function participate(integer $lectureId) { $userId = HttpContext::getInstance()->getIdentity()->getUserId(); $service = new LecturesService($this->dbContext); $result = $service->addParticipant($lectureId, $userId); $this->processResponse($result); $this->redirectToUrl('/conferences/details/' . $result->getModel()); }
public function batchBook(BatchBookLectures $lectures) : ServiceResponse { $lectureService = new LecturesService($this->dbContext); $responses = []; foreach ($lectures->getLectureIds() as $lectureId) { $response = $lectureService->addParticipant($lectureId, HttpContext::getInstance()->getIdentity()->getUserId()); $responses[] = $response; } return new ServiceResponse(null, null, $responses); }