Skip to content
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

[FrameworkBundle] Deprecate the Templating component integration #21035

Merged
merged 2 commits into from Mar 19, 2019

Conversation

@dunglas
Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2016

Do we want to deprecate this syntax or not?

@stof

This comment has been minimized.

Copy link
Member

commented Dec 23, 2016

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

@mvrhov

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2016

So let's deprecate this notation.

@javiereguiluz

This comment has been minimized.

Copy link
Member

commented Dec 23, 2016

@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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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 dunglas:deprecate_templating_fwb branch from 84512fd to 942e80b Jan 10, 2017

@chalasr

This comment has been minimized.

Copy link
Member

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 dunglas force-pushed the dunglas:deprecate_templating_fwb branch from 942e80b to b4c2b91 Jan 28, 2017

@dunglas

This comment has been minimized.

Copy link
Member Author

commented Jan 28, 2017

@chalasr good catch, done.

@dunglas dunglas force-pushed the dunglas:deprecate_templating_fwb branch from ac6ec3b to 3320f5f Feb 3, 2017

@@ -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);

This comment has been minimized.

Copy link
@chalasr

chalasr Feb 3, 2017

Member

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 dunglas:deprecate_templating_fwb branch from c03495c to 1086047 Feb 5, 2017

@@ -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.

This comment has been minimized.

Copy link
@nicolas-grekas

nicolas-grekas Feb 11, 2017

Member

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

@dunglas dunglas force-pushed the dunglas:deprecate_templating_fwb branch 2 times, most recently from b0ef3c6 to 245ffd0 Feb 13, 2017

@adrienrn

This comment has been minimized.

Copy link

commented Feb 24, 2017

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

This comment has been minimized.

Copy link
Member

commented Mar 6, 2017

Status: needs work

@fabpot fabpot force-pushed the dunglas:deprecate_templating_fwb branch 2 times, most recently from fab5834 to dbbb32e Mar 19, 2019

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

@dunglas Taking over.

@fabpot fabpot force-pushed the dunglas:deprecate_templating_fwb branch 7 times, most recently from 248a9c0 to 71683bd Mar 19, 2019

@fabpot fabpot force-pushed the dunglas:deprecate_templating_fwb branch 3 times, most recently from 9c96d27 to 715b7d9 Mar 19, 2019

@fabpot fabpot force-pushed the dunglas:deprecate_templating_fwb branch from 715b7d9 to 7169f4d Mar 19, 2019

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

Thank you @dunglas.

@fabpot fabpot merged commit 7169f4d into symfony:master Mar 19, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Mar 19, 2019

feature #21035 [FrameworkBundle] Deprecate the Templating component i…
…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

This comment has been minimized.

Copy link
Member Author

commented Mar 19, 2019

Thanks for finishing this!

@javiereguiluz

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

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

This comment has been minimized.

Copy link
Member

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.

@chalasr chalasr referenced this pull request Apr 9, 2019

Merged

DI-test-autowiring #2

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

minor #11231 Documented the deprecation of the Templating component (…
…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 referenced this pull request May 9, 2019

Merged

Release v4.3.0-BETA1 #31435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.