Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
added RouterFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 7, 2012
1 parent ba77776 commit 2efee7e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
6 changes: 0 additions & 6 deletions app/bootstrap.php
Expand Up @@ -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';
Expand All @@ -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('<presenter>/<action>[/<id>]', 'Homepage:default');


// Configure and run the application!
$container->application->run();
2 changes: 2 additions & 0 deletions app/config/config.neon
Expand Up @@ -25,6 +25,8 @@ nette:

services:
authenticator: Authenticator
routerFactory: RouterFactory
router: @routerFactory::createRouter


factories:
25 changes: 25 additions & 0 deletions app/router/RouterFactory.php
@@ -0,0 +1,25 @@
<?php

use Nette\Application\Routers\RouteList,
Nette\Application\Routers\Route,
Nette\Application\Routers\SimpleRouter;


/**
* Router factory.
*/
class RouterFactory
{

/**
* @return Nette\Application\IRouter
*/
public function createRouter()
{
$router = new RouteList();
$router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
return $router;
}

}

0 comments on commit 2efee7e

Please sign in to comment.