downloadRepository->insert( $this->getUser(), $input->url, $input->title, $input->filename, $input->imdbId, $input->mediaType, "", ); $this->downloadRepository->getEntityManager()->persist($download); $this->downloadRepository->getEntityManager()->flush(); $input->downloadId = $download->getId(); $input->userId = $this->getUser()->getId(); try { $this->bus->dispatch($input->toCommand()); } catch (\Throwable $exception) { return $this->json(['error' => $exception->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR); } $this->hub->publish(new Update( $request->getSession()->get('mercure_alert_topic'), $this->renderView('broadcast/Alert.stream.html.twig', [ 'alert_id' => uniqid(), 'title' => 'Success', 'message' => '"' . $input->title . '" added to Queue', ]) )); return $this->json(['status' => 200, 'message' => 'Added to Queue']); } }