11
11
12
12
namespace Symfony \Bundle \TwigBundle \Controller ;
13
13
14
- use Symfony \Bundle \FrameworkBundle \Templating \TemplateReference ;
15
14
use Symfony \Component \HttpKernel \Exception \FlattenException ;
16
15
use Symfony \Component \HttpKernel \Log \DebugLoggerInterface ;
17
16
use Symfony \Component \HttpFoundation \Request ;
18
17
use Symfony \Component \HttpFoundation \Response ;
19
- use Symfony \Component \Templating \TemplateReferenceInterface ;
20
18
21
19
/**
22
20
* ExceptionController renders error or exception pages for a given
@@ -96,7 +94,7 @@ protected function getAndCleanOutputBuffering($startObLevel)
96
94
* @param int $code An HTTP response status code
97
95
* @param bool $showException
98
96
*
99
- * @return TemplateReferenceInterface
97
+ * @return string
100
98
*/
101
99
protected function findTemplate (Request $ request , $ format , $ code , $ showException )
102
100
{
@@ -107,22 +105,22 @@ protected function findTemplate(Request $request, $format, $code, $showException
107
105
108
106
// For error pages, try to find a template for the specific HTTP status code and format
109
107
if (!$ showException ) {
110
- $ template = new TemplateReference ( ' TwigBundle ' , ' Exception ' , $ name. $ code , $ format, ' twig ' );
108
+ $ template = sprintf ( ' @Twig/ Exception/%s%s.%s.twig ' , $ name, $ code , $ format );
111
109
if ($ this ->templateExists ($ template )) {
112
110
return $ template ;
113
111
}
114
112
}
115
113
116
114
// 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 );
118
116
if ($ this ->templateExists ($ template )) {
119
117
return $ template ;
120
118
}
121
119
122
120
// default to a generic HTML exception
123
121
$ request ->setRequestFormat ('html ' );
124
122
125
- return new TemplateReference ( ' TwigBundle ' , ' Exception ' , $ showException ? 'exception_full ' : $ name, ' html ' , ' twig ' );
123
+ return sprintf ( ' @Twig/ Exception/%s.html.twig ' , $ showException ? 'exception_full ' : $ name );
126
124
}
127
125
128
126
// to be removed when the minimum required version of Twig is >= 3.0
0 commit comments