interface RouteProviderInterface

Interface for the route provider the DynamicRouter is using.

Typically this could be a doctrine orm or odm repository, but you can implement something else if you need to.

Hierarchy

Expanded class hierarchy of RouteProviderInterface

All classes that implement RouteProviderInterface

6 files declare their use of RouteProviderInterface
MenuLinkStorageController.php in drupal/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php
Contains \Drupal\menu_link\MenuLinkStorageController.
MockRouteProvider.php in drupal/core/modules/system/lib/Drupal/system/Tests/Routing/MockRouteProvider.php
Contains Drupal\system\Tests\Routing\MockRouteProvider.
NestedMatcher.php in drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/NestedMatcher/NestedMatcher.php
ProviderBasedGenerator.php in drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/ProviderBasedGenerator.php
RouteProvider.php in drupal/core/lib/Drupal/Core/Routing/RouteProvider.php
Contains Drupal\Core\Routing\RouteProvider.

... See full list

File

drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/RouteProviderInterface.php, line 13

Namespace

Symfony\Cmf\Component\Routing
View source
interface RouteProviderInterface {

  /**
   * Finds routes that may potentially match the request.
   *
   * This may return a mixed list of class instances, but all routes returned
   * must extend the core symfony route. The classes may also implement
   * RouteObjectInterface to link to a content document.
   *
   * This method may not throw an exception based on implementation specific
   * restrictions on the url. That case is considered a not found - returning
   * an empty array. Exceptions are only used to abort the whole request in
   * case something is seriously broken, like the storage backend being down.
   *
   * Note that implementations may not implement an optimal matching
   * algorithm, simply a reasonable first pass.  That allows for potentially
   * very large route sets to be filtered down to likely candidates, which
   * may then be filtered in memory more completely.
   *
   * @param Request $request A request against which to match.
   *
   * @return \Symfony\Component\Routing\RouteCollection with all Routes that
   *      could potentially match $request. Empty collection if nothing can
   *      match.
   */
  public function getRouteCollectionForRequest(Request $request);

  /**
   * Find the route using the provided route name (and parameters)
   *
   * @param string $name       the route name to fetch
   * @param array  $parameters the parameters as they are passed to the
   *      UrlGeneratorInterface::generate call
   *
   * @return \Symfony\Component\Routing\Route
   *
   * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException if
   *      there is no route with that name in this repository
   */
  public function getRouteByName($name, $parameters = array());

  /**
   * Find many routes by their names using the provided list of names
   *
   * Note that this method may not throw an exception if some of the routes
   * are not found. It will just return the list of those routes it found.
   *
   * This method exists in order to allow performance optimizations. The
   * simple implementation could be to just repeatedly call
   * $this->getRouteByName()
   *
   * @param array $names      the list of names to retrieve
   * @param array $parameters the parameters as they are passed to the
   *      UrlGeneratorInterface::generate call. (Only one array, not one for
   *      each entry in $names.
   *
   * @return \Symfony\Component\Routing\Route[] iterable thing with the keys
   *      the names of the $names argument.
   */
  public function getRoutesByNames($names, $parameters = array());

}

Members

Namesort descending Modifiers Type Description Overrides
RouteProviderInterface::getRouteByName public function Find the route using the provided route name (and parameters) 2
RouteProviderInterface::getRouteCollectionForRequest public function Finds routes that may potentially match the request. 2
RouteProviderInterface::getRoutesByNames public function Find many routes by their names using the provided list of names 2