Skip to content

[FrameworkBundle] Deprecate the Templating component integration #21035

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2019

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Dec 23, 2016

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

This PR deprecates the Templating component integration in FrameworkBundle. Only a few people use it because almost everybody use Twig or the serializer to output data. Removing this component will facilitate the maintenance.

@stof
Copy link
Member

stof commented Dec 23, 2016

you also need to deprecate the TwigEngine (in the bridge and the bundle), as they are about integrating Twig in this component.

@stof
Copy link
Member

stof commented Dec 23, 2016

And this requires deprecating the AppBundle:foo:bar.html.twig syntax too, as it comes from the Templating system (and this one is used)

@dunglas
Copy link
Member Author

dunglas commented Dec 23, 2016

Do we want to deprecate this syntax or not?

@stof
Copy link
Member

stof commented Dec 23, 2016

Well, if we don't want to deprecate it, you need to undeprecate the TemplateNameParser system in your PR.

@mvrhov
Copy link

mvrhov commented Dec 23, 2016

The @AppBundle/foo/bar.html.twig syntax is recommended since 2.5 or something like that.
But deprecating the symfony specific syntax might show some resistance :P

@dunglas
Copy link
Member Author

dunglas commented Dec 23, 2016

So let's deprecate this notation.

@javiereguiluz
Copy link
Member

@dunglas last time we tried to deprecate that syntax (in June 2014) they almost killed us 😁 See #11051

By the way, in #20130 we discussed about a big inconsistency in the Twig syntax. Maybe we should take care of that too?

@dunglas
Copy link
Member Author

dunglas commented Dec 23, 2016

@javiereguiluz but we have an advantage this time, people already using Twig alone (without the templating bridge) can only use the @AppBundle syntax. We're deprecating the Templating component, other syntaxes - not supported by the Twig Bundle - will be deprecated with it. Does it looks reasonable?

@fabpot
Copy link
Member

fabpot commented Dec 23, 2016

Indeed, #11051 is very different. Here we are deprecating everything related to the Templating component, including the way we reference templates. There is no need to discuss how to reference templates as we are just using "pure" Twig, nothing more.

@xabbuh
Copy link
Member

xabbuh commented Dec 23, 2016

But I think we should indeed look into #20130 and try to find a way to resolve the inconsistency if we force everyone to use the Twig schema to reference templates.

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Dec 26, 2016
@xabbuh
Copy link
Member

xabbuh commented Dec 28, 2016

One even more important thing: The native Twig namespace syntax as it is currently integrated in the framework fails on bundle inheritance (see #6919). Please take a look at #19586 which provides a fix.

@dunglas dunglas force-pushed the deprecate_templating_fwb branch from 84512fd to 942e80b Compare January 10, 2017 22:35
@chalasr
Copy link
Member

chalasr commented Jan 13, 2017

Should the TemplatingPass be deprecated?
Maybe should it trigger deprecations for each service in the loop too (i.e. tagged templating.*)?

@dunglas
Copy link
Member Author

dunglas commented Jan 28, 2017

@chalasr good catch, done.

@dunglas dunglas force-pushed the deprecate_templating_fwb branch from ac6ec3b to 3320f5f Compare February 3, 2017 20:13
@@ -33,6 +36,8 @@ public function process(ContainerBuilder $container)
if ($container->hasDefinition('templating.engine.php')) {
$helpers = array();
foreach ($container->findTaggedServiceIds('templating.helper') as $id => $attributes) {
@trigger_error('The '.self::class.' class is deprecated since version 3.3 and will be removed in 4.0. Use Twig instead.', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be even better to have this deprecation only when using the class itself and trigger something like The "templating.helper" tag is deprecated as of 3.3... here instead?

@dunglas dunglas force-pushed the deprecate_templating_fwb branch from c03495c to 1086047 Compare February 5, 2017 18:59
@@ -20,6 +22,8 @@
* This engine knows how to render Twig templates.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated The TwigEngine class will be removed in Symfony 4.0. You should use \Twig_Environment directly instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deprecated since version 3.3, to be removed in 4.0. Use Twig instead. (same below)

@dunglas dunglas force-pushed the deprecate_templating_fwb branch 2 times, most recently from b0ef3c6 to 245ffd0 Compare February 13, 2017 13:12
@adrienrn
Copy link

One question remains on my end : templating was giving a layer of abstraction to twig and if @templating goes away, do we need to inject @twig directly or some other component will provide an abstraction ?

@nicolas-grekas
Copy link
Member

Status: needs work

@fabpot fabpot force-pushed the deprecate_templating_fwb branch 5 times, most recently from 248a9c0 to 71683bd Compare March 19, 2019 17:10
@fabpot fabpot force-pushed the deprecate_templating_fwb branch 3 times, most recently from 9c96d27 to 715b7d9 Compare March 19, 2019 17:48
@fabpot fabpot force-pushed the deprecate_templating_fwb branch from 715b7d9 to 7169f4d Compare March 19, 2019 17:58
@fabpot
Copy link
Member

fabpot commented Mar 19, 2019

Thank you @dunglas.

@fabpot fabpot merged commit 7169f4d into symfony:master Mar 19, 2019
fabpot added a commit that referenced this pull request Mar 19, 2019
…ntegration (dunglas, fabpot)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] Deprecate the Templating component integration

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

This PR deprecates the Templating component integration in FrameworkBundle. Only a few people use it because almost everybody use Twig or the serializer to output data. Removing this component will facilitate the maintenance.

Commits
-------

7169f4d [Templating] added more deprecation
224c891 [FrameworkBundle] Deprecate the Templating component integration
@dunglas
Copy link
Member Author

dunglas commented Mar 19, 2019

Thanks for finishing this!

@javiereguiluz
Copy link
Member

I'm trying to make the doc changes for this. I have two questions:

  1. Is using PHP templates (normal templates, form themes, etc) deprecated in 4.3 and will be removed in 5.0? If not, which are the steps needed to render PHP templates in 5.0?

  2. What will happen with config like this? Is deprecated too? Is there an alternative?

        # config/packages/framework.yaml
        framework:
            # ...
            templating:
                hinclude_default_template: hinclude.html.twig

Thanks!

@fabpot
Copy link
Member

fabpot commented Mar 29, 2019

@javiereguiluz

To answer your questions (and this is just my point of view):

  1. Yes, we will remove support for the PHP form themes and other PHP template support in 5.0. If people want to keep using them, we will need to find volunteers to create a new PHPTemplateBundle that bundles all deprecated classes and support files.

  2. We need to fix those and see where they belongs to now.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Apr 9, 2019
…javiereguiluz)

This PR was squashed before being merged into the master branch (closes #11231).

Discussion
----------

Documented the deprecation of the Templating component

Documents symfony/symfony#21035 but there are some things I'm not sure about. Please, review.

Commits
-------

57fadaf Documented the deprecation of the Templating component
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
@fabpot fabpot mentioned this pull request May 9, 2019
fabpot added a commit that referenced this pull request Jun 3, 2019
… for PHP templating layer (yceruto)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][TwigBundle] Add missing deprecations for PHP templating layer

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As part of #21035 and 7169f4d

Commits
-------

61613d0 Add missing deprecations for PHP templating layer
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jun 3, 2019
… for PHP templating layer (yceruto)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][TwigBundle] Add missing deprecations for PHP templating layer

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As part of symfony/symfony#21035 and symfony/symfony@7169f4d

Commits
-------

61613d0bf0 Add missing deprecations for PHP templating layer
fabpot added a commit that referenced this pull request Jun 4, 2019
This PR was merged into the 5.0-dev branch.

Discussion
----------

Removed support for PHP templating everywhere

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Ref: #21035 and 7169f4d

**TODO:**
Missing deprecations in 4.4 (#31800):
 - [x] `Symfony\Bundle\FrameworkBundle\Controller\TemplateController` 2nd argument.
 - [x] `Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer` class and service.

**Labels:** `FrameworkBundle`, `TwigBundle`, `TwigBridge`, `SecurityBundle`, `Form`, `HttpKernel`

Friendly ping @fabpot and @dunglas

Commits
-------

d5be373 Removed support for PHP templating everywhere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.