Guides
Tutorials
Symfony router decorator.
class ApiPlatform\Symfony\Routing\Router implements Symfony\Component\Routing\RouterInterface, `<a href="/docs/reference/Api/UrlGeneratorInterface">ApiPlatform\Api\UrlGeneratorInterface</a>`, Symfony\Component\Routing\RequestContextAwareInterface, Symfony\Component\Routing\Generator\UrlGeneratorInterface, Symfony\Component\Routing\Matcher\UrlMatcherInterface
{
public __construct(Symfony\Component\Routing\RouterInterface $router, int $urlGenerationStrategy)
public setContext(Symfony\Component\Routing\RequestContext $context): null
public getContext(): Symfony\Component\Routing\RequestContext
public getRouteCollection(): Symfony\Component\Routing\RouteCollection
public match(string $pathInfo): array
public generate(string $name, array $parameters, null|int $referenceType): string
}
class ApiPlatform\Symfony\Routing\Router implements Symfony\Component\Routing\RouterInterface, `<a href="/docs/reference/Api/UrlGeneratorInterface">ApiPlatform\Api\UrlGeneratorInterface</a>`, Symfony\Component\Routing\RequestContextAwareInterface, Symfony\Component\Routing\Generator\UrlGeneratorInterface, Symfony\Component\Routing\Matcher\UrlMatcherInterface
{
public __construct(Symfony\Component\Routing\RouterInterface $router, int $urlGenerationStrategy)
public setContext(Symfony\Component\Routing\RequestContext $context): null
public getContext(): Symfony\Component\Routing\RequestContext
public getRouteCollection(): Symfony\Component\Routing\RouteCollection
public match(string $pathInfo): array
public generate(string $name, array $parameters, null|int $referenceType): string
}
public __construct(Symfony\Component\Routing\RouterInterface $router, int $urlGenerationStrategy)
public __construct(Symfony\Component\Routing\RouterInterface $router, int $urlGenerationStrategy)
router | Symfony\Component\Routing\RouterInterface | |
urlGenerationStrategy | int |
Sets the request context.Sets the request context.Sets the request context.Sets the request context.
public setContext(Symfony\Component\Routing\RequestContext $context): null
public setContext(Symfony\Component\Routing\RequestContext $context): null
context | Symfony\Component\Routing\RequestContext |
null
Gets the request context.Gets the request context.Gets the request context.Gets the request context.
public getContext(): Symfony\Component\Routing\RequestContext
public getContext(): Symfony\Component\Routing\RequestContext
Symfony\Component\Routing\RequestContext
Gets the RouteCollection instance associated with this Router.WARNING: This method should never be used at runtime as it is SLOW. You might use it in a cache warmer though.
public getRouteCollection(): Symfony\Component\Routing\RouteCollection
public getRouteCollection(): Symfony\Component\Routing\RouteCollection
Symfony\Component\Routing\RouteCollection
Tries to match a URL path with a set of routes.If the matcher cannot find information, it must throw one of the exceptions documented below.Tries to match a URL path with a set of routes.If the matcher cannot find information, it must throw one of the exceptions documented below.
public match(string $pathInfo): array
public match(string $pathInfo): array
pathInfo | string |
array
Generates a URL or path for a specific route based on the given parameters.Parameters that reference placeholders in the route pattern will substitute them in the path or host. Extra params are added as query string to the URL.When the passed reference type cannot be generated for the route because it requires a different host or scheme than the current one, the method will return a more comprehensive reference that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH but the route requires the https scheme whereas the current scheme is http, it will instead return an ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches the route in any case.If there is no route with the given name, the generator must throw the RouteNotFoundException.The special parameter _fragment will be used as the document fragment suffixed to the final URL.Generates a URL or path for a specific route based on the given parameters.Parameters that reference placeholders in the route pattern will substitute them in the path or host. Extra params are added as query string to the URL.When the passed reference type cannot be generated for the route because it requires a different host or scheme than the current one, the method will return a more comprehensive reference that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH but the route requires the https scheme whereas the current scheme is http, it will instead return an ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches the route in any case.If there is no route with the given name, the generator must throw the RouteNotFoundException.The special parameter _fragment will be used as the document fragment suffixed to the final URL.Generates a URL or path for a specific route based on the given parameters.Parameters that reference placeholders in the route pattern will substitute them in the path or host. Extra params are added as query string to the URL.When the passed reference type cannot be generated for the route because it requires a different host or scheme than the current one, the method will return a more comprehensive reference that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH but the route requires the https scheme whereas the current scheme is http, it will instead return an ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches the route in any case.If there is no route with the given name, the generator must throw the RouteNotFoundException.The special parameter _fragment will be used as the document fragment suffixed to the final URL.
public generate(string $name, array $parameters, null|int $referenceType): string
public generate(string $name, array $parameters, null|int $referenceType): string
name | string | |
parameters | array | |
referenceType | int |
string