Version 1
[yaffs-website] / vendor / symfony-cmf / routing / RouteObjectInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony CMF package.
5  *
6  * (c) 2011-2015 Symfony CMF
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Cmf\Component\Routing;
13
14 /**
15  * Classes for entries in the routing table may implement this interface in
16  * addition to extending Symfony\Component\Routing\Route.
17  *
18  * If they do, the DynamicRouter will request the route content and put it into
19  * the RouteObjectInterface::CONTENT_OBJECT field. The DynamicRouter will also
20  * request getRouteKey and this will be used instead of the symfony core compatible
21  * route name and can contain any characters.
22  *
23  * Some fields in defaults have a special meaning in the getDefaults(). In addition
24  * to the constants defined in this class, _locale and _controller are also used.
25  */
26 interface RouteObjectInterface
27 {
28     /**
29      * Field name that will hold the route name that was matched.
30      */
31     const ROUTE_NAME = '_route';
32
33     /**
34      * Field name of the route object that was matched.
35      */
36     const ROUTE_OBJECT = '_route_object';
37
38     /**
39      * Field name for an explicit controller name to be used with this route.
40      */
41     const CONTROLLER_NAME = '_controller';
42
43     /**
44      * Field name for an explicit template to be used with this route.
45      * i.e. CmfContentBundle:StaticContent:index.html.twig.
46      */
47     const TEMPLATE_NAME = '_template';
48
49     /**
50      * Field name for the content of the current route, if any.
51      */
52     const CONTENT_OBJECT = '_content';
53
54     /**
55      * Field name for the content id of the current route, if any.
56      */
57     const CONTENT_ID = '_content_id';
58
59     /**
60      * Get the content document this route entry stands for. If non-null,
61      * the ControllerClassMapper uses it to identify a controller and
62      * the content is passed to the controller.
63      *
64      * If there is no specific content for this url (i.e. its an "application"
65      * page), may return null.
66      *
67      * @return object the document or entity this route entry points to
68      */
69     public function getContent();
70
71     /**
72      * Get the route name.
73      *
74      * Normal symfony routes do not know their name, the name is only known
75      * from the route collection. In the CMF, it is possible to use route
76      * documents outside of collections, and thus useful to have routes provide
77      * their name.
78      *
79      * There are no limitations to allowed characters in the name.
80      *
81      * @return string|null the route name or null to use the default name
82      *                     (e.g. from route collection if known)
83      */
84     public function getRouteKey();
85 }