forked from symfony-cmf/Routing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRouteProviderInterface.php
73 lines (68 loc) · 2.9 KB
/
RouteProviderInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace Symfony\Cmf\Component\Routing;
use Symfony\Component\HttpFoundation\Request;
/**
* 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.
*/
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 urls 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());
}