浏览代码

Instanciate a new class for each Filter, fix #3475

François MARTIN 9 年之前
父节点
当前提交
e2da96ad8f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      DependencyInjection/Compiler/AddFilterTypeCompilerPass.php

+ 2 - 2
DependencyInjection/Compiler/AddFilterTypeCompilerPass.php

@@ -33,9 +33,9 @@ class AddFilterTypeCompilerPass implements CompilerPassInterface
 
         foreach ($container->findTaggedServiceIds('sonata.admin.filter.type') as $id => $attributes) {
             if (method_exists($definition, 'setShared')) { // Symfony 2.8+
-                $definition->setShared(false);
+                $container->getDefinition($id)->setShared(false);
             } else { // For Symfony <2.8 compatibility
-                $definition->setScope(ContainerInterface::SCOPE_PROTOTYPE);
+                $container->getDefinition($id)->setScope(ContainerInterface::SCOPE_PROTOTYPE);
             }
 
             foreach ($attributes as $eachTag) {