Skip to content

Commit 882c0a4

Browse files
committed
minor symfony#13908 Don't use Twig as a public service (javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Don't use Twig as a public service Fixes symfony#13900. This is the only occurrence I found in the docs. Commits ------- 44ca44f Don't use Twig as a public service
2 parents 3a82166 + 44ca44f commit 882c0a4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

templates.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,9 @@ Checking if a Template Exists
565565
Templates are loaded in the application using a `Twig template loader`_, which
566566
also provides a method to check for template existence. First, get the loader::
567567

568-
// in a controller extending from AbstractController
569-
$loader = $this->get('twig')->getLoader();
570-
571-
// in a service using autowiring
572568
use Twig\Environment;
573569

570+
// this code assumes that your service uses autowiring to inject dependencies
574571
public function __construct(Environment $twig)
575572
{
576573
$loader = $twig->getLoader();

0 commit comments

Comments
 (0)