diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 3da9a49..c1582c7 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -64,7 +64,6 @@ final class MainController extends AbstractController foreach ($finder as $file) { $current = &$tree; - // Dunno why it is undefined, it works foreach (explode('/', $file->getRelativePath()) as $part) { if ($part === '') break; @@ -74,7 +73,9 @@ final class MainController extends AbstractController $current = &$current[$part]; } - $current[$file->getFilenameWithoutExtension()] = []; + if (!isset($current[$part])) { + $current[$file->getFilenameWithoutExtension()] = []; + } } return $this->render('main/index.html.twig', [