Skip to content

[TwigBundle] removed usage of Templating classes #15970

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
Sep 28, 2015

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Sep 28, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? yes (but frankly, I don't see how that would break anything out there)
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

@@ -63,7 +61,7 @@ public function showAction(Request $request, FlattenException $exception, DebugL
$code = $exception->getStatusCode();

return new Response($this->twig->render(
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
$this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
Copy link
Member Author

Choose a reason for hiding this comment

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

That's kind of useless to use a TemplateReference everywhere as Twig only know about plain string templates anyway. It was needed before we added support for proper Twig namespace paths, which we did earlier this year. This is a leftover that forbids to disable the templating component in 2.8/3.0.

Copy link
Member

Choose a reason for hiding this comment

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

this is a protected method, meaning it is an extension point. I think we should keep the string casting for now, for cases where a child class returns a TemplateReferenceInterface (which is likely as it was the expected output).

Casting the TemplateReferenceInterface will give you a template name, and so will work.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can indeed do that even if I doubt anyone has ever used this "extension point".

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

@fabpot FOSRestBundle is using it (it was the reason it was introduced at first btw)

Copy link
Contributor

Choose a reason for hiding this comment

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

we could add a deprecation warning when it doesn't return a string

@@ -1,4 +1,4 @@
{% extends 'TwigBundle::layout.html.twig' %}
{% extends '@TwigBundle/layout.html.twig' %}
Copy link
Member

Choose a reason for hiding this comment

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

@Twig instead of @TwigBundle ?

@fabpot fabpot force-pushed the twig-bundle-templating-removal branch from 81cdf2f to 2f62cfc Compare September 28, 2015 13:53
@fabpot
Copy link
Member Author

fabpot commented Sep 28, 2015

For the record, this notation has been available since Symfony 2.2 and Twig 1.10.

@fabpot fabpot force-pushed the twig-bundle-templating-removal branch from 2f62cfc to ff3c107 Compare September 28, 2015 14:10
@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

👍

Status: Reviewed

@fabpot fabpot merged commit ff3c107 into symfony:2.8 Sep 28, 2015
fabpot added a commit that referenced this pull request Sep 28, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

[TwigBundle] removed usage of Templating classes

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes (but frankly, I don't see how that would break anything out there)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

ff3c107 [TwigBundle] removed usage of Templating classes
7f13f95 [WebProfilerBundle] fixed a template reference
@fabpot fabpot mentioned this pull request Nov 16, 2015
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
…s (fabpot)

This PR was merged into the 2.8 branch.

Discussion
----------

[TwigBundle] removed usage of Templating classes

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes (but frankly, I don't see how that would break anything out there)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

ff3c107 [TwigBundle] removed usage of Templating classes
7f13f95 [WebProfilerBundle] fixed a template reference
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.

5 participants