4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing;
15 * Classes for entries in the routing table may implement this interface in
16 * addition to extending Symfony\Component\Routing\Route.
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.
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.
26 interface RouteObjectInterface
29 * Field name that will hold the route name that was matched.
31 const ROUTE_NAME = '_route';
34 * Field name of the route object that was matched.
36 const ROUTE_OBJECT = '_route_object';
39 * Field name for an explicit controller name to be used with this route.
41 const CONTROLLER_NAME = '_controller';
44 * Field name for an explicit template to be used with this route.
45 * i.e. CmfContentBundle:StaticContent:index.html.twig.
47 const TEMPLATE_NAME = '_template';
50 * Field name for the content of the current route, if any.
52 const CONTENT_OBJECT = '_content';
55 * Field name for the content id of the current route, if any.
57 const CONTENT_ID = '_content_id';
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.
64 * If there is no specific content for this url (i.e. its an "application"
65 * page), may return null.
67 * @return object the document or entity this route entry points to
69 public function getContent();
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
79 * There are no limitations to allowed characters in the name.
81 * @return string|null the route name or null to use the default name
82 * (e.g. from route collection if known)
84 public function getRouteKey();