symfony / swiftmailer-bundle

Symfony Swiftmailer Bundle
https://symfony.com/swiftmailer-bundle
MIT License
1.56k stars 151 forks source link

Twig 2.10 Deprecation Update to swiftmailer.html.twig, without filter #283

Closed KrisCarr closed 5 years ago

KrisCarr commented 5 years ago

This change addresses the following Twig deprecation:

Adding an if condition on a for tag is deprecated in Twig 2.10. Use a filter filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop). https://twig.symfony.com/doc/2.x/deprecated.html

This solution uses a separate "if" block instead of a "filter", which requires Twig 1.41 or higher. (https://twig.symfony.com/doc/2.x/filters/filter.html)

A solution that does use "filter" can be found at https://github.com/symfony/swiftmailer-bundle/pull/282