Browse Source

use the context argument

The special "exception" argument is better because it can even be used
to display a stack trace.
Grégoire Paris 9 years ago
parent
commit
7db49e7330

+ 1 - 2
Tests/Twig/Extension/SonataAdminExtensionTest.php

@@ -976,8 +976,7 @@ EOT
                 "SonataAdminBundle:CRUD:list_nonexistent_template.html.twig"
                 for the field "Foo_name", the default template
                     "SonataAdminBundle:CRUD:base_list_field.html.twig" was used
-                    instead: "Unable to find template
-                    "list_nonexistent_template.html.twig'
+                    instead.'
             ))));
 
         $this->twigExtension->renderListElement($this->environment, $this->object, $this->fieldDescription);

+ 3 - 4
Twig/Extension/SonataAdminExtension.php

@@ -114,12 +114,11 @@ class SonataAdminExtension extends \Twig_Extension implements \Twig_Extension_In
             if (null !== $this->logger) {
                 $this->logger->warning(sprintf(
                     'An error occured trying to load the template "%s" for the field "%s", '.
-                    'the default template "%s" was used instead: "%s". ',
+                    'the default template "%s" was used instead.',
                     $templateName,
                     $fieldDescription->getFieldName(),
-                    $defaultTemplate,
-                    $e->getMessage()
-                ));
+                    $defaultTemplate
+                ), array('exception' => $e));
             }
         }