/** * @Route("/api/data", name="public_edk_registration_data", defaults={"_localeFromQuery" = true}) */ public function registrationsAction(Request $request) { try { $repository = $this->get('wio.edk.repo.published_data'); $registrations = $repository->getOpenRegistrations($this->project, $this->getProjectSettings()->get(EdkSettings::PUBLISHED_AREA_STATUS)->getValue()); $response = new JsonResponse($registrations); $response->setDate(new DateTime()); $exp = new DateTime(); $exp->add(new DateInterval('PT0H5M0S')); $response->setExpires($exp); return $response; } catch (ItemNotFoundException $exception) { return new JsonResponse(['success' => 0]); } }