1 | <?php |
||
11 | trait RouterAware |
||
12 | { |
||
13 | /** |
||
14 | * @var RouterInterface |
||
15 | */ |
||
16 | protected $router; |
||
17 | |||
18 | /** |
||
19 | * @return RouterInterface |
||
20 | */ |
||
21 | public function getRouter() |
||
25 | |||
26 | /** |
||
27 | * @param RouterInterface $router |
||
28 | */ |
||
29 | public function setRouter(RouterInterface $router) |
||
33 | |||
34 | /** |
||
35 | * Generates a URL from the given parameters. |
||
36 | * |
||
37 | * @param string $route The name of the route |
||
38 | * @param mixed $parameters An array of parameters |
||
39 | * @param bool|string $referenceType The type of reference (one of the constants in UrlGeneratorInterface) |
||
40 | * |
||
41 | * @return string The generated URL |
||
42 | * |
||
43 | * @see UrlGeneratorInterface |
||
44 | */ |
||
45 | public function generateUrl($route, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) |
||
49 | |||
50 | /** |
||
51 | * Returns a RedirectResponse to the given URL. |
||
52 | * |
||
53 | * @param string $url The URL to redirect to |
||
54 | * @param int $status The status code to use for the Response |
||
55 | * |
||
56 | * @return RedirectResponse |
||
57 | */ |
||
58 | public function redirect($url, $status = 302) |
||
62 | |||
63 | /** |
||
64 | * Returns a RedirectResponse to the given route with the given parameters. |
||
65 | * |
||
66 | * @param string $route The name of the route |
||
67 | * @param array $parameters An array of parameters |
||
68 | * @param int $status The status code to use for the Response |
||
69 | * |
||
70 | * @return RedirectResponse |
||
71 | */ |
||
72 | protected function redirectToRoute($route, array $parameters = [], $status = 302) |
||
76 | } |
||
77 |