RouteObjectInterface.php 2.3 KB

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