getDoctrine() ->getRepository(AbstractSource::class) ->find($id); if (!$source) { throw $this->createNotFoundException('No source found for id '.$id); } $templateGenerator = new StringGenerator($request, $source, $this->container->get('twig')); return new Response($templateGenerator->render()); } }