We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a72b26 commit 44ca44fCopy full SHA for 44ca44f
templates.rst
@@ -565,12 +565,9 @@ Checking if a Template Exists
565
Templates are loaded in the application using a `Twig template loader`_, which
566
also provides a method to check for template existence. First, get the loader::
567
568
- // in a controller extending from AbstractController
569
- $loader = $this->get('twig')->getLoader();
570
-
571
- // in a service using autowiring
572
use Twig\Environment;
573
+ // this code assumes that your service uses autowiring to inject dependencies
574
public function __construct(Environment $twig)
575
{
576
$loader = $twig->getLoader();
0 commit comments