浏览代码

Fix nested admin filtering

Thomas Rabaix 14 年之前
父节点
当前提交
0cb5e14670
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      Admin/Admin.php

+ 8 - 6
Admin/Admin.php

@@ -575,12 +575,6 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
             return;
             return;
         }
         }
 
 
-        // ok, try to limit to add parent filter
-        if ($this->getParentAssociationMapping()) {
-            $fieldDescription = $this->getModelManager()->getParentFieldDescription($this->getParentAssociationMapping(), $this->getClass());
-            $this->filterFieldDescriptions[$this->getParentAssociationMapping()] = $fieldDescription;
-        }
-
         $parameters = $this->getFilterParameters();
         $parameters = $this->getFilterParameters();
 
 
         // initialize the datagrid
         // initialize the datagrid
@@ -592,6 +586,14 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
 
         // build the datagrid filter
         // build the datagrid filter
         $this->configureDatagridFilters($mapper);
         $this->configureDatagridFilters($mapper);
+
+        // ok, try to limit to add parent filter
+        if ($this->getParentAssociationMapping()) {
+            $fieldDescription = $this->getModelManager()->getParentFieldDescription($this->getParentAssociationMapping(), $this->getClass());
+            $this->filterFieldDescriptions[$this->getParentAssociationMapping()] = $fieldDescription;
+
+            $mapper->add($fieldDescription);
+        }
     }
     }
 
 
     /**
     /**