After upgrading to Symfony 4.3, I\'m getting the following 22 deprecation warnings:
User Deprecated: The Symfony\\Bundle\\TwigBundle\\Loader\\FilesystemLoade
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:
"symfony/templating" from composer.jsonframework.yaml:
templating:
engines:
- twig
composer updateThis should remove all the deprecation warnings.
If you're getting this error
Cannot autowire service "...": argument "$templating" of method "__construct()" references interface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface" 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 Symfony\Bundle\FrameworkBundle\Templating\EngineInterface to Twig\Environment:
use Twig\Environment;
private $twig;
public function __construct(Environment $twig)
{
$this->twig = $twig;
}
See also https://github.com/symfony/symfony/issues/31645