فهرست منبع

merged branch Seldaek/toolbar_debugging (PR #2019)

Commits
-------

89f477e [WebProfilerBundle] Throw exception if a collector template isn't found
6ca72cf [WebProfilerBundle] Allow .html.twig in collector template names

Discussion
----------

WDT debugging

While implementing collectors I did a mistake in the template name and it never told me, so I was left wondering why my stuff didn't show up. Not so nice IMO. Also the first commit is to allow template names to be specified fully. I don't see why this shouldn't be allowed, since it is the way you specify templates everywhere else.
Fabien Potencier 13 سال پیش
والد
کامیت
8cdedd13c5
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

+ 11 - 1
src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

@@ -265,9 +265,19 @@ class ProfilerController extends ContainerAware
             }
 
             list($name, $template) = $arguments;
-            if (!$profiler->has($name) || !$this->container->get('templating')->exists($template.'.html.twig')) {
+            if (!$profiler->has($name)) {
                 continue;
             }
+            if ('.html.twig' === substr($template, -10)) {
+                $template = substr($template, 0, -10);
+            }
+            if (!$this->container->get('templating')->exists($template.'.html.twig')) {
+                throw new \UnexpectedValueException(sprintf(
+                    'The profiler template "%s.html.twig" for data collector "%s" does not exist.',
+                    $template,
+                    $name
+                ));
+            }
 
             $templates[$name] = $template.'.html.twig';
         }