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 @@ -45,10 +45,13 @@ public function __construct(bool $debugMode = false)
4545
4646 public function loadConfiguration ()
4747 {
48+ if (!$ this ->config ->routes ) {
49+ return ;
50+ }
51+
4852 $ builder = $ this ->getContainerBuilder ();
4953
5054 $ router = $ builder ->addDefinition ($ this ->prefix ('router ' ))
51- ->setType (Nette \Routing \Router::class)
5255 ->setFactory (Nette \Application \Routers \RouteList::class);
5356
5457 if ($ this ->config ->routeClass ) {
@@ -88,7 +91,9 @@ public function beforeCompile()
8891 public function afterCompile (Nette \PhpGenerator \ClassType $ class )
8992 {
9093 if ($ this ->config ->cache ) {
91- $ method = $ class ->getMethod (Nette \DI \Container::getMethodName ($ this ->prefix ('router ' )));
94+ $ builder = $ this ->getContainerBuilder ();
95+ $ def = $ builder ->getDefinitionByType (Nette \Routing \Router::class);
96+ $ method = $ class ->getMethod (Nette \DI \Container::getMethodName ($ def ->getName ()));
9297 try {
9398 $ router = eval ($ method ->getBody ());
9499 if ($ router instanceof Nette \Application \Routers \RouteList) {
You can’t perform that action at this time.
0 commit comments