getDoctrine() ->getRepository(AbstractSource::class) ->find($id); if (!$source) { throw $this->createNotFoundException('No source found for id '.$id); } $templateGenerator = new TemplateGenerator($source, $request); return $this->render($templateGenerator->getTemplatePath(), ['source' => $source]); } }