-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See the [blog post](https://blog.nette.org/en/one-line-in-configuration-will-speed-up-your-nette-application-how-is-that-possible). The speedup is tiny in my case, if any at all, as the database connection is already created on-demand only (since 7766444 #14) but it generally seems like a good idea. Needed a bit of a refactoring because `RouterFactory::getLocaleRouters()` returned an empty list in tests when the lazy mode was enabled because `RouterFactory::createRouter()` has not been called yet.
- Loading branch information
Showing
7 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ di: | |
export: | ||
parameters: false | ||
tags: false | ||
lazy: true | ||
|
||
latte: | ||
strictParsing: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace MichalSpacekCz\Application\Routing; | ||
|
||
use Nette\Application\Routers\RouteList; | ||
|
||
readonly class LocaleRouter | ||
{ | ||
|
||
/** | ||
* @param array<string, RouteList> $localeRouters | ||
*/ | ||
public function __construct( | ||
private array $localeRouters, | ||
private RouteList $routeList, | ||
) { | ||
} | ||
|
||
|
||
/** | ||
* @return array<string, RouteList> | ||
*/ | ||
public function getLocaleRouters(): array | ||
{ | ||
return $this->localeRouters; | ||
} | ||
|
||
|
||
public function getRouteList(): RouteList | ||
{ | ||
return $this->routeList; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters