bootstrap.php chyba v routování

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Turbo
Člen | 24
+
0
-

Zdravim vas vsechn, potrebuji poradit s bootstrap.php mam nekde chybu a vubec netusim kde jsem tuto chybu udelal.
bootstrap.php

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


// Load Nette Framework
$params['libsDir'] = LIBS_DIR;
require $params['libsDir'] . '/Nette/loader.php';


// Enable Nette Debugger for error visualisation & logging
Debugger::$logDirectory = __DIR__ . '/../log';
Debugger::$strictMode = TRUE;
Debugger::enable(Debugger::DEVELOPMENT);


// Load configuration from config.neon file
$configurator = new Nette\Configurator;
$configurator->loadConfig(__DIR__ . '/config.neon');


// Configure application
$application = $configurator->container->application;
$application->errorPresenter = 'Error';
$application->catchExceptions = TRUE;


// Session
$configurator->container->session->setExpiration('+ 90 days');
$configurator->container->session->start();


// Translator
/*$configurator->container->getService("translator")->addFile("%appDir%/lang/","");
NetteTranslator\Panel::register($configurator->container, $configurator->container->translator);
  */

// dibi
dibi::connect($configurator->container->params['database']);


  // Setup router
  $application->router = $router = new RouteList;
  $router[] = new Route('index.php', 'Front:Default:default', Route::ONE_WAY);

  $router[] = $adminRouter = new RouteList('Admin');
  $adminRouter[] = new Route('admin/<presenter>/<action>', 'Default:default');

  $router[] = $frontRouter = new RouteList('Front');
  $frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Default:default');



// Run the application!
$application->run();

chybu mi hlasi rotovani

Nette\MemberAccessException

Cannot write to a read-only property Nette\Application\Application::$router

Vsem moc dekuji za rady.

nanuqcz
Člen | 822
+
0
-

Ahoj, nevím, jakou máš verzi Nette, ale ve 2.0 je potřeba brát $router z $configurator->container, ne z $application.

Viz sandbox.