getChecksum()) { throw new BadRequestHttpException('Checksum URL is required'); } $params = [ 'json' => [ 'checksum' => $data->getChecksum() ] ]; $bootServer = $data->getBootServer(); if (!$bootServer) { throw new BadRequestHttpException('This OgLive is not attached to any BootServer.'); } $content = $this->createRequestFromBootServer($bootServer, 'PUT', '/ogboot/v1/oglives/default', $params); if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR ) { throw new BadRequestHttpException('An error occurred: ' . $content['error'] . ' (' . $content['details'] . ')'); } $oldDefaultOgLive = $this->entityManager->getRepository(OgLive::class)->findBy(['isDefault' => true, 'bootServer' => $bootServer]); foreach ($oldDefaultOgLive as $oldOgLive) { $oldOgLive->setIsDefault(false); $this->entityManager->persist($oldOgLive); } $data->setIsDefault(true); $this->entityManager->persist($data); $this->entityManager->flush(); return new JsonResponse(status: Response::HTTP_OK); } }