"symfony 4.3: user deprecated: the symfonybundletwigbundleloaderfilesystemloader class is deprecated since version 4.3 and will be removed in 5.0 …" Code Answer

3

this is due to the deprecation of the templating component, see https://symfony.com/blog/new-in-symfony-4-3-deprecated-the-templating-component-integration

solution:

  1. remove "symfony/templating" from composer.json
  2. remove this from framework.yaml:
    templating:
        engines:
            - twig
    
  3. run composer update

this should remove all the deprecation warnings.

if you're getting this error

cannot autowire service "...": argument "$templating" of method "__construct()" references interface "symfonybundleframeworkbundletemplatingengineinterface" but no such service exists. did you create a class that implements this interface?

... you're still using the old templating in some service.
solution: change the dependency from symfonybundleframeworkbundletemplatingengineinterface to twigenvironment:

use twigenvironment;

private $twig;

public function __construct(environment $twig)
{
    $this->twig = $twig;
}

see also https://github.com/symfony/symfony/issues/31645

By Suchit kumar on September 6 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.