@@ -159,7 +159,11 @@ protected function denyAccessUnlessGranted($attributes, $object = null, $message
159
159
*/
160
160
public function renderView ($ view , array $ parameters = array ())
161
161
{
162
- return $ this ->container ->get ('templating ' )->render ($ view , $ parameters );
162
+ if ($ this ->container ->has ('templating ' )) {
163
+ return $ this ->container ->get ('templating ' )->render ($ view , $ parameters );
164
+ }
165
+
166
+ return $ this ->container ->get ('twig ' )->render ($ view , $ parameters );
163
167
}
164
168
165
169
/**
@@ -173,7 +177,17 @@ public function renderView($view, array $parameters = array())
173
177
*/
174
178
public function render ($ view , array $ parameters = array (), Response $ response = null )
175
179
{
176
- return $ this ->container ->get ('templating ' )->renderResponse ($ view , $ parameters , $ response );
180
+ if ($ this ->container ->has ('templating ' )) {
181
+ return $ this ->container ->get ('templating ' )->renderResponse ($ view , $ parameters , $ response );
182
+ }
183
+
184
+ if (null === $ response ) {
185
+ $ response = new Response ();
186
+ }
187
+
188
+ $ response ->setContent ($ this ->container ->get ('twig ' )->render ($ view , $ parameters ));
189
+
190
+ return $ response ;
177
191
}
178
192
179
193
/**
@@ -187,11 +201,19 @@ public function render($view, array $parameters = array(), Response $response =
187
201
*/
188
202
public function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
189
203
{
190
- $ templating = $ this ->container ->get ('templating ' );
191
-
192
- $ callback = function () use ($ templating , $ view , $ parameters ) {
193
- $ templating ->stream ($ view , $ parameters );
194
- };
204
+ if ($ this ->container ->has ('templating ' )) {
205
+ $ templating = $ this ->container ->get ('templating ' );
206
+
207
+ $ callback = function () use ($ templating , $ view , $ parameters ) {
208
+ $ templating ->stream ($ view , $ parameters );
209
+ };
210
+ } else {
211
+ $ twig = $ this ->container ->get ('twig ' );
212
+
213
+ $ callback = function () use ($ twig , $ view , $ parameters ) {
214
+ $ twig ->load ($ view )->display ($ parameters );
215
+ };
216
+ }
195
217
196
218
if (null === $ response ) {
197
219
return new StreamedResponse ($ callback );
0 commit comments