Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Twig] Remove TemplatedEmail::template()#30853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
javiereguiluz left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I agree.
While documenting the Mime component (pending PR here:symfony/symfony-docs#11280) I also found a bit confusing to have multiple ways of doing the same thing.
Also, using pure Twig code to define all email parts (such as the priority, subject, from, to, etc.) looks appealing at first but it generates complex and not very readable code in real-world applications. Better use PHP to create the message and (optionally) Twig to render its contents.
stof commentedApr 3, 2019
👍 for me. My current system in the Incenteev codebase looks like this |
nicolas-grekas commentedApr 3, 2019
(but see fabbot ;) ) |
1775552 to5e61b75CompareThis PR was merged into the 4.3-dev branch.Discussion----------[Twig] Remove TemplatedEmail::template()| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a| License | MIT| Doc PR | n/aI propose to remove `TemplatedEmail::template()` for several reasons: * There is no real benefit over using `textTemplate` and `htmlTemplate` (ok, you only have one template instead of two... but the text template can only be automatically created based on the HTML one, so...); * It means having more than one way to do the same thing (do I set the subject on the object directly or in the template for instance); * A major drawback that is not easy to spot: the template is HTML, so the `subject` and `text` block must be carefully crafted to avoid avoid HTML escaping.Commits-------5e61b75 [Twig] removed TemplatedEmail::template()
This PR was merged into the 4.3-dev branch.Discussion----------[Twig] Remove TemplatedEmail::template()| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a| License | MIT| Doc PR | n/aI propose to remove `TemplatedEmail::template()` for several reasons: * There is no real benefit over using `textTemplate` and `htmlTemplate` (ok, you only have one template instead of two... but the text template can only be automatically created based on the HTML one, so...); * It means having more than one way to do the same thing (do I set the subject on the object directly or in the template for instance); * A major drawback that is not easy to spot: the template is HTML, so the `subject` and `text` block must be carefully crafted to avoid avoid HTML escaping.Commits-------5e61b75 [Twig] removed TemplatedEmail::template()
lyrixx commentedApr 4, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This is not really true about link : |
fabpot commentedApr 4, 2019
@lyrixx Not if you have Markdown installed :) |
I propose to remove
TemplatedEmail::template()for several reasons:There is no real benefit over using
textTemplateandhtmlTemplate(ok, you only have one template instead of two... but the text template can only be automatically created based on the HTML one, so...);It means having more than one way to do the same thing (do I set the subject on the object directly or in the template for instance);
A major drawback that is not easy to spot: the template is HTML, so the
subjectandtextblock must be carefully crafted to avoid avoid HTML escaping.