Cannot inject Templating on Symfony 4 Service
I managed to do it with Twig Environment and HTTP Response
<?phpnamespace App\Controller;use Twig\Environment;use Symfony\Component\HttpFoundation\Response;class MyClass{ private $twig; public function __construct(Environment $twig) { $this->twig = $twig; } public function renderTemplateAction($msg) { return new Response($this->twig->render('myTemplate.html.twig')); }}