Ver código fonte

Merge pull request #4235 from wouterj/fix-deprecations

Fix deprecations
Grégoire Paris 8 anos atrás
pai
commit
a1faa2e521

+ 7 - 4
Admin/AbstractAdmin.php

@@ -2174,10 +2174,13 @@ EOT;
      */
     public function setTranslator(TranslatorInterface $translator)
     {
-        @trigger_error(
-            'The '.__METHOD__.' method is deprecated since version 3.9 and will be removed in 4.0.',
-            E_USER_DEPRECATED
-        );
+        $args = func_get_args();
+        if (isset($args[1]) && $args[1]) {
+            @trigger_error(
+                'The '.__METHOD__.' method is deprecated since version 3.9 and will be removed in 4.0.',
+                E_USER_DEPRECATED
+            );
+        }
 
         $this->translator = $translator;
     }

+ 6 - 1
DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php

@@ -275,7 +275,12 @@ class AddDependencyCallsCompilerPass implements CompilerPassInterface
             $method = 'set'.Inflector::classify($attr);
 
             if (isset($overwriteAdminConfiguration[$attr]) || !$definition->hasMethodCall($method)) {
-                $definition->addMethodCall($method, array(new Reference(isset($overwriteAdminConfiguration[$attr]) ? $overwriteAdminConfiguration[$attr] : $addServiceId)));
+                $args = array(new Reference(isset($overwriteAdminConfiguration[$attr]) ? $overwriteAdminConfiguration[$attr] : $addServiceId));
+                if ('translator' === $attr) {
+                    $args[] = false;
+                }
+
+                $definition->addMethodCall($method, $args);
             }
         }
 

+ 12 - 12
Resources/views/standard_layout.html.twig

@@ -8,18 +8,18 @@ For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 
 #}
-{% set _preview              = block('preview') %}
-{% set _form                 = block('form') %}
-{% set _show                 = block('show') %}
-{% set _list_table           = block('list_table') %}
-{% set _list_filters         = block('list_filters') %}
-{% set _tab_menu             = block('tab_menu') %}
-{% set _content              = block('content') %}
-{% set _title                = block('title') %}
-{% set _breadcrumb           = block('breadcrumb') %}
-{% set _actions              = block('actions') %}
-{% set _navbar_title         = block('navbar_title') %}
-{% set _list_filters_actions = block('list_filters_actions') %}
+{% set _preview              = block('preview') is defined ? block('preview') : null %}
+{% set _form                 = block('form') is defined ? block('form') : null %}
+{% set _show                 = block('show') is defined ? block('show') : null %}
+{% set _list_table           = block('list_table') is defined ? block('list_table') : null %}
+{% set _list_filters         = block('list_filters') is defined ? block('list_filters') : null %}
+{% set _tab_menu             = block('tab_menu') is defined ? block('tab_menu') : null %}
+{% set _content              = block('content') is defined ? block('content') : null %}
+{% set _title                = block('title') is defined ? block('title') : null %}
+{% set _breadcrumb           = block('breadcrumb') is defined ? block('breadcrumb') : null %}
+{% set _actions              = block('actions') is defined ? block('actions') : null %}
+{% set _navbar_title         = block('navbar_title') is defined ? block('navbar_title') : null %}
+{% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions') : null %}
 
 <!DOCTYPE html>
 <html {% block html_attributes %}class="no-js"{% endblock %}>