Parcourir la source

Avoid error for nested admin configuration

Thomas Rabaix il y a 13 ans
Parent
commit
95b08eddd2
2 fichiers modifiés avec 10 ajouts et 0 suppressions
  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());