|
26 | 26 | use Symfony\Component\HttpFoundation\RedirectResponse; |
27 | 27 | use Symfony\Component\HttpFoundation\Request; |
28 | 28 | use Symfony\Component\HttpFoundation\Response; |
| 29 | +use Twig\TemplateWrapper; |
29 | 30 |
|
30 | 31 | class Grid implements GridInterface |
31 | 32 | { |
@@ -359,8 +360,10 @@ public function initialize() |
359 | 360 | $this->setPersistence($config->isPersisted()); |
360 | 361 |
|
361 | 362 | // Route parameters |
362 | | - $routeParameters = $config->getRouteParameters(); |
363 | | - if (!empty($routeParameters)) { |
| 363 | + $routeParameters = []; |
| 364 | + $parameters = $config->getRouteParameters(); |
| 365 | + if (!empty($parameters)) { |
| 366 | + $routeParameters = $parameters; |
364 | 367 | foreach ($routeParameters as $parameter => $value) { |
365 | 368 | $this->setRouteParameter($parameter, $value); |
366 | 369 | } |
@@ -1135,7 +1138,7 @@ protected function set($key, $data) |
1135 | 1138 |
|
1136 | 1139 | protected function saveSession() |
1137 | 1140 | { |
1138 | | - if (!empty($this->sessionData)) { |
| 1141 | + if (!empty($this->sessionData) && !empty($this->hash)) { |
1139 | 1142 | $this->session->set($this->hash, $this->sessionData); |
1140 | 1143 | } |
1141 | 1144 | } |
@@ -1395,12 +1398,11 @@ public function getRowActions() |
1395 | 1398 | public function setTemplate($template) |
1396 | 1399 | { |
1397 | 1400 | if ($template !== null) { |
1398 | | - if ($template instanceof \Twig_Template) { |
| 1401 | + if ($template instanceof TemplateWrapper) { |
1399 | 1402 | $template = '__SELF__' . $template->getTemplateName(); |
1400 | 1403 | } elseif (!is_string($template)) { |
1401 | 1404 | throw new \Exception(self::TWIG_TEMPLATE_LOAD_EX_MSG); |
1402 | 1405 | } |
1403 | | - |
1404 | 1406 | $this->set(self::REQUEST_QUERY_TEMPLATE, $template); |
1405 | 1407 | $this->saveSession(); |
1406 | 1408 | } |
@@ -2147,7 +2149,7 @@ public function getGridResponse($param1 = null, $param2 = null, Response $respon |
2147 | 2149 | if ($view === null) { |
2148 | 2150 | return $parameters; |
2149 | 2151 | } else { |
2150 | | - return $this->container->get('templating')->renderResponse($view, $parameters, $response); |
| 2152 | + return new Response($this->container->get('twig')->render($view, $parameters, $response)); |
2151 | 2153 | } |
2152 | 2154 | } |
2153 | 2155 | } |
|
0 commit comments