File tree Expand file tree Collapse file tree
src/Bridges/ApplicationDI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,10 +42,13 @@ public function __construct(bool $debugMode = false)
4242
4343 public function loadConfiguration ()
4444 {
45+ if (!$ this ->config ->routes ) {
46+ return ;
47+ }
48+
4549 $ builder = $ this ->getContainerBuilder ();
4650
4751 $ router = $ builder ->addDefinition ($ this ->prefix ('router ' ))
48- ->setType (Nette \Routing \Router::class)
4952 ->setFactory (Nette \Application \Routers \RouteList::class);
5053
5154 if ($ this ->config ->routeClass ) {
@@ -85,7 +88,9 @@ public function beforeCompile()
8588 public function afterCompile (Nette \PhpGenerator \ClassType $ class )
8689 {
8790 if ($ this ->config ->cache ) {
88- $ method = $ class ->getMethod (Nette \DI \Container::getMethodName ($ this ->prefix ('router ' )));
91+ $ builder = $ this ->getContainerBuilder ();
92+ $ def = $ builder ->getDefinitionByType (Nette \Routing \Router::class);
93+ $ method = $ class ->getMethod (Nette \DI \Container::getMethodName ($ def ->getName ()));
8994 try {
9095 $ router = eval ($ method ->getBody ());
9196 if ($ router instanceof Nette \Application \Routers \RouteList) {
You can’t perform that action at this time.
0 commit comments