ソースを参照

Avoid error for nested admin configuration

Thomas Rabaix 13 年 前
コミット
95b08eddd2
2 ファイル変更10 行追加0 行削除
  1. 5 0
      Route/PathInfoBuilder.php
  2. 5 0
      Route/QueryStringBuilder.php

+ 5 - 0
Route/PathInfoBuilder.php

@@ -45,6 +45,11 @@ class PathInfoBuilder implements RouteBuilderInterface
             $collection->add('history_view_revision', $admin->getRouterIdParameter().'/history/{revision}/view');
         }
 
+        // an admin can have only one level of nested child
+        if ($admin->getParent()) {
+            return;
+        }
+
         // add children urls
         foreach ($admin->getChildren() as $children) {
             $collection->addCollection($children->getRoutes());

+ 5 - 0
Route/QueryStringBuilder.php

@@ -45,6 +45,11 @@ class QueryStringBuilder implements RouteBuilderInterface
             $collection->add('history_view_revision', '/audit-history-view');
         }
 
+        // an admin can have only one level of nested child
+        if ($admin->getParent()) {
+            return;
+        }
+
         // add children urls
         foreach ($admin->getChildren() as $children) {
             $collection->addCollection($children->getRoutes());