Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony CMF package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) 2011-2015 Symfony CMF
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Cmf\Component\Routing;
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Document for redirection entries with the RedirectController.
|
Chris@0
|
16 *
|
Chris@0
|
17 * Defines additional methods needed by the RedirectController to redirect
|
Chris@0
|
18 * based on the route.
|
Chris@0
|
19 *
|
Chris@0
|
20 * This document may define (in order of precedence - the others can be empty):
|
Chris@0
|
21 *
|
Chris@0
|
22 * - uri: an absolute uri
|
Chris@0
|
23 * - routeName and routeParameters: to be used with the standard symfony router
|
Chris@0
|
24 * or a route entry in the routeParameters for the DynamicRouter. Precedency
|
Chris@0
|
25 * between these is determined by the order of the routers in the chain
|
Chris@0
|
26 * router.
|
Chris@0
|
27 *
|
Chris@0
|
28 * With standard Symfony routing, you can just use uri / routeName and a
|
Chris@0
|
29 * hashmap of parameters.
|
Chris@0
|
30 *
|
Chris@0
|
31 * For the dynamic router, you can return a RouteInterface instance in the
|
Chris@0
|
32 * field 'route' of the parameters.
|
Chris@0
|
33 *
|
Chris@0
|
34 * Note: getRedirectContent must return the redirect route itself for the
|
Chris@0
|
35 * integration with DynamicRouter to work.
|
Chris@0
|
36 *
|
Chris@0
|
37 * @author David Buchmann <david@liip.ch>
|
Chris@0
|
38 */
|
Chris@0
|
39 interface RedirectRouteInterface extends RouteObjectInterface
|
Chris@0
|
40 {
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Get the absolute uri to redirect to external domains.
|
Chris@0
|
43 *
|
Chris@0
|
44 * If this is non-empty, the other methods won't be used.
|
Chris@0
|
45 *
|
Chris@0
|
46 * @return string target absolute uri
|
Chris@0
|
47 */
|
Chris@0
|
48 public function getUri();
|
Chris@0
|
49
|
Chris@0
|
50 /**
|
Chris@0
|
51 * Get the target route document this route redirects to.
|
Chris@0
|
52 *
|
Chris@0
|
53 * If non-null, it is added as route into the parameters, which will lead
|
Chris@0
|
54 * to have the generate call issued by the RedirectController to have
|
Chris@0
|
55 * the target route in the parameters.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @return RouteObjectInterface the route this redirection points to
|
Chris@0
|
58 */
|
Chris@0
|
59 public function getRouteTarget();
|
Chris@0
|
60
|
Chris@0
|
61 /**
|
Chris@0
|
62 * Get the name of the target route for working with the symfony standard
|
Chris@0
|
63 * router.
|
Chris@0
|
64 *
|
Chris@0
|
65 * @return string target route name
|
Chris@0
|
66 */
|
Chris@0
|
67 public function getRouteName();
|
Chris@0
|
68
|
Chris@0
|
69 /**
|
Chris@0
|
70 * Whether this should be a permanent or temporary redirect.
|
Chris@0
|
71 *
|
Chris@0
|
72 * @return bool
|
Chris@0
|
73 */
|
Chris@0
|
74 public function isPermanent();
|
Chris@0
|
75
|
Chris@0
|
76 /**
|
Chris@0
|
77 * Get the parameters for the target route router::generate().
|
Chris@0
|
78 *
|
Chris@0
|
79 * Note that for the DynamicRouter, you return the target route
|
Chris@0
|
80 * document as field 'route' of the hashmap.
|
Chris@0
|
81 *
|
Chris@0
|
82 * @return array Information to build the route
|
Chris@0
|
83 */
|
Chris@0
|
84 public function getParameters();
|
Chris@0
|
85 }
|