From 2efee7ebfce4b6c278da060d25079da8a78462f0 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 2 Nov 2012 19:04:34 +0100 Subject: [PATCH] added RouterFactory --- app/bootstrap.php | 6 ------ app/config/config.neon | 2 ++ app/router/RouterFactory.php | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 app/router/RouterFactory.php diff --git a/app/bootstrap.php b/app/bootstrap.php index c81f4517..9e297ff0 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -3,8 +3,6 @@ /** * My Application bootstrap file. */ -use Nette\Application\Routers\Route; - // Load Nette Framework or autoloader generated by Composer require LIBS_DIR . '/autoload.php'; @@ -29,10 +27,6 @@ $configurator->addConfig(__DIR__ . '/config/config.local.neon'); $container = $configurator->createContainer(); -// Setup router -$container->router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY); -$container->router[] = new Route('/[/]', 'Homepage:default'); - // Configure and run the application! $container->application->run(); diff --git a/app/config/config.neon b/app/config/config.neon index 70486bee..f35cb0b2 100644 --- a/app/config/config.neon +++ b/app/config/config.neon @@ -25,6 +25,8 @@ nette: services: authenticator: Authenticator + routerFactory: RouterFactory + router: @routerFactory::createRouter factories: diff --git a/app/router/RouterFactory.php b/app/router/RouterFactory.php new file mode 100644 index 00000000..ac70c26a --- /dev/null +++ b/app/router/RouterFactory.php @@ -0,0 +1,25 @@ +/[/]', 'Homepage:default'); + return $router; + } + +}