Skip to content

Commit 2f62cfc

Browse files
committed
[TwigBundle] removed usage of Templating classes
1 parent 7f13f95 commit 2f62cfc

16 files changed

+24
-26
lines changed

src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111

1212
namespace Symfony\Bundle\TwigBundle\Controller;
1313

14-
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
1514
use Symfony\Component\HttpKernel\Exception\FlattenException;
1615
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
1716
use Symfony\Component\HttpFoundation\Request;
1817
use Symfony\Component\HttpFoundation\Response;
19-
use Symfony\Component\Templating\TemplateReferenceInterface;
2018

2119
/**
2220
* ExceptionController renders error or exception pages for a given
@@ -63,7 +61,7 @@ public function showAction(Request $request, FlattenException $exception, DebugL
6361
$code = $exception->getStatusCode();
6462

6563
return new Response($this->twig->render(
66-
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
64+
$this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
6765
array(
6866
'status_code' => $code,
6967
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
@@ -96,7 +94,7 @@ protected function getAndCleanOutputBuffering($startObLevel)
9694
* @param int $code An HTTP response status code
9795
* @param bool $showException
9896
*
99-
* @return TemplateReferenceInterface
97+
* @return string
10098
*/
10199
protected function findTemplate(Request $request, $format, $code, $showException)
102100
{
@@ -107,22 +105,22 @@ protected function findTemplate(Request $request, $format, $code, $showException
107105

108106
// For error pages, try to find a template for the specific HTTP status code and format
109107
if (!$showException) {
110-
$template = new TemplateReference('TwigBundle', 'Exception', $name.$code, $format, 'twig');
108+
$template = sprintf('@Twig/Exception/%s%s.%s.twig', $name, $code, $format);
111109
if ($this->templateExists($template)) {
112110
return $template;
113111
}
114112
}
115113

116114
// try to find a template for the given format
117-
$template = new TemplateReference('TwigBundle', 'Exception', $name, $format, 'twig');
115+
$template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
118116
if ($this->templateExists($template)) {
119117
return $template;
120118
}
121119

122120
// default to a generic HTML exception
123121
$request->setRequestFormat('html');
124122

125-
return new TemplateReference('TwigBundle', 'Exception', $showException ? 'exception_full' : $name, 'html', 'twig');
123+
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
126124
}
127125

128126
// to be removed when the minimum required version of Twig is >= 3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include 'TwigBundle:Exception:error.xml.twig' %}
1+
{% include '@Twig/Exception/error.xml.twig' %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include 'TwigBundle:Exception:error.xml.twig' %}
1+
{% include '@Twig/Exception/error.xml.twig' %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %}
1+
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/*
2-
{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %}
2+
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
33
*/

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</div>
3838

3939
{% for position, e in exception.toarray %}
40-
{% include 'TwigBundle:Exception:traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %}
40+
{% include '@Twig/Exception/traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %}
4141
{% endfor %}
4242

4343
{% if logger %}
@@ -63,7 +63,7 @@
6363
</div>
6464

6565
<div id="logs">
66-
{% include 'TwigBundle:Exception:logs.html.twig' with { 'logs': logger.logs } only %}
66+
{% include '@Twig/Exception/logs.html.twig' with { 'logs': logger.logs } only %}
6767
</div>
6868
</div>
6969
{% endif %}
@@ -88,7 +88,7 @@
8888
</div>
8989
{% endif %}
9090

91-
{% include 'TwigBundle:Exception:traces_text.html.twig' with { 'exception': exception } only %}
91+
{% include '@Twig/Exception/traces_text.html.twig' with { 'exception': exception } only %}
9292

9393
<script type="text/javascript">//<![CDATA[
9494
function toggle(id, clazz) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/*
2-
{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %}
2+
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
33
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %}
1+
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.txt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
[message] {{ exception.message }}
33
{% for i, e in exception.toarray %}
44
[{{ i + 1 }}] {{ e.class }}: {{ e.message }}
5-
{% include 'TwigBundle:Exception:traces.txt.twig' with { 'exception': e } only %}
5+
{% include '@Twig/Exception/traces.txt.twig' with { 'exception': e } only %}
66

77
{% endfor %}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.xml.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<error code="{{ status_code }}" message="{{ status_text }}">
44
{% for e in exception.toarray %}
55
<exception class="{{ e.class }}" message="{{ e.message }}">
6-
{% include 'TwigBundle:Exception:traces.xml.twig' with { 'exception': e } only %}
6+
{% include '@Twig/Exception/traces.xml.twig' with { 'exception': e } only %}
77
</exception>
88
{% endfor %}
99
</error>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy