1313namespace APY \DataGridBundle \Grid \Export ;
1414
1515use APY \DataGridBundle \Grid \Column \ArrayColumn ;
16+ use APY \DataGridBundle \Grid \Grid ;
1617use Symfony \Component \DependencyInjection \ContainerAwareInterface ;
1718use Symfony \Component \DependencyInjection \ContainerInterface ;
1819use Symfony \Component \HttpFoundation \Response ;
20+ use Twig \TemplateWrapper ;
1921
2022abstract class Export implements ExportInterface, ContainerAwareInterface
2123{
@@ -441,12 +443,12 @@ public function setTemplate($template)
441443 if (is_string ($ template )) {
442444 if (substr ($ template , 0 , 8 ) === '__SELF__ ' ) {
443445 $ this ->templates = $ this ->getTemplatesFromString (substr ($ template , 8 ));
444- $ this ->templates [] = $ this ->twig ->loadTemplate (static ::DEFAULT_TEMPLATE );
446+ $ this ->templates [] = $ this ->twig ->load (static ::DEFAULT_TEMPLATE );
445447 } else {
446448 $ this ->templates = $ this ->getTemplatesFromString ($ template );
447449 }
448450 } elseif ($ this ->templates === null ) {
449- $ this ->templates [] = $ this ->twig ->loadTemplate (static ::DEFAULT_TEMPLATE );
451+ $ this ->templates [] = $ this ->twig ->load (static ::DEFAULT_TEMPLATE );
450452 } else {
451453 throw new \Exception ('Unable to load template ' );
452454 }
@@ -457,13 +459,10 @@ public function setTemplate($template)
457459 protected function getTemplatesFromString ($ theme )
458460 {
459461 $ templates = [];
460-
461- $ template = $ this ->twig ->loadTemplate ($ theme );
462- while ($ template instanceof TemplateWrapper) {
462+ $ template = $ this ->twig ->load ($ theme );
463+ if ($ template instanceof TemplateWrapper) {
463464 $ templates [] = $ template ;
464- $ template = $ template ->getParent ([]);
465465 }
466-
467466 return $ templates ;
468467 }
469468
0 commit comments