There are already issues where people are getting tripped up by not having the symfony/templating component enabled. It's not just that they need to have it installed (they don't, it's a dependency of this bundle), but they will need to add the templating config to framework.yaml.
But, as far as I can see (search the code for "templating"), the component is only used in one spot. Let's just replace it by Twig and simplify :).
@weaverryan templating is used only in fos_user.mailer.default service. This service could be replaced with fos_user.mailer.twig_swift by configuration:
fos_user:
service:
mailer: fos_user.mailer.twig_swift
This could be a part of future FOSUserBundle recipe for Flex, or default value for fos_user.service.mailer could be changed in FOS\UserBundle\DependencyInjection\Configuration::addServiceSection to fos_user.mailer.twig_swift or something else.
Perhaps somebody is willing to create a PR and replace fos_user.service.mailer by fos_user.mailer.twig_swift?
@XWB i created PR
How do you think, should i have been deprecate old fos_user.mailer service with templating dependency or remove symfony/templating from composer.json?
FOSUserBundle can be used without templating and mailer services! This can be done with disabling _resetting_ feature. Without _resetting_, mailer service is not needed, and with mailer - templating is not needed too. But, there is a error occured, when resetting is disabled. See https://github.com/FriendsOfSymfony/FOSUserBundle/pull/2707
I had a look at the code base and will have to withdraw my suggestion above. We cannot just remove features in a 2.x release, thus we must keep the mailer services, at least for now.
According to the topic starter, the issue is:
but they will need to add the templating config to framework.yaml
Can't this be done with a recipe? The Templating component is already installed via the composer file.
This can be done with recipe. This:
fos_user:
service:
mailer: fos_user.mailer.twig_swift
will use twig instead of templating.
That makes little sense as fos_user.mailer.default is by definition the default mailer service.
As symfony/templating is being installed by Composer, the only thing that needs to be done is adding to following configuration:
framework:
templating:
engines: ['twig']
The fos_user.mailer.twig_swift is a much better implementation of the Mailer, so using it makes sense. fos_user.mailer.default was named default at the time it was the only implementation available in the bundle. But it is worse than the other one (no support for HTML emails for instance).
So I'm totally in favor of using fos_user.mailer.twig_swift for new projects.
Shouldn't it be better to rename fos_user.mailer.twig_swift to fos_user.mailer.default?
@XWB see my comment in the PR doing it: this is a BC break, so it would require providing a migration path with deprecation and changing it only in 3.0 of the bundle (and then, we should rather have no implementation at all named .default, but naming each implementation based on what makes it specific)
With symfony/templating integration in Symfony 5 being disabled (it's deprecated since 4.3) the bundle must possibly remove the dependency to be usable.
Most helpful comment
With symfony/templating integration in Symfony 5 being disabled (it's deprecated since 4.3) the bundle must possibly remove the dependency to be usable.