|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Routers; |
|
4
|
|
|
|
|
5
|
|
|
use Nette, |
|
6
|
|
|
Nette\Application\Routers\RouteList, |
|
7
|
|
|
Nette\Application\Routers\Route, |
|
8
|
|
|
Nette\Application\Routers\SimpleRouter; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Router factory. |
|
13
|
|
|
*/ |
|
14
|
|
|
class RouterFactory |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @return \Nette\Application\IRouter |
|
19
|
|
|
*/ |
|
20
|
|
|
public function createRouter() |
|
21
|
|
|
{ |
|
22
|
|
|
$router = new RouteList(); |
|
23
|
|
|
$router[] = new Route('', 'Dashboard:default', Route::ONE_WAY); |
|
|
|
|
|
|
24
|
|
|
$router[] = new Route('index.php', 'Dashboard:default', Route::ONE_WAY); |
|
|
|
|
|
|
25
|
|
|
$router[] = new Route('dashboard/', 'Dashboard:default'); |
|
|
|
|
|
|
26
|
|
|
$router[] = new Route('registrace/[<action>/[<guid>/]]', 'Registration:default', Route::ONE_WAY); |
|
|
|
|
|
|
27
|
|
|
$router[] = new Route('registration/[<action>/[<guid>/]]', 'Registration:default'); |
|
|
|
|
|
|
28
|
|
|
$router[] = new Route('export/[<action>/[<type>/[<id>/]]]', 'Export:default'); |
|
|
|
|
|
|
29
|
|
|
$router[] = new Route('block/annotation/<guid>', [ |
|
30
|
|
|
'presenter' => 'Annotation', |
|
31
|
|
|
'action' => 'edit', |
|
32
|
|
|
'type' => 'block', |
|
33
|
|
|
], Route::ONE_WAY); |
|
34
|
|
|
$router[] = new Route('program/annotation/<guid>', [ |
|
35
|
|
|
'presenter' => 'Annotation', |
|
36
|
|
|
'action' => 'edit', |
|
37
|
|
|
'type' => 'program', |
|
38
|
|
|
], Route::ONE_WAY); |
|
39
|
|
|
$router[] = new Route('annotation/<action>/<type>/<guid>/', 'Annotation:default'); |
|
|
|
|
|
|
40
|
|
|
$router[] = new Route('<presenter>/[<action>/[<id>/]]', 'Dashboard:listing'); |
|
|
|
|
|
|
41
|
|
|
$router[] = new Route('<presenter>/[<action>/[<guid>/]]', 'Dashboard:listing'); |
|
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
return $router; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: