A RouteCollection represents a set of Route instances.
When adding a route at the end of the collection, an existing route with the
same name is removed first. So there can only be one route with a given
name.
Methods summary
public
|
|
public
ArrayIterator|Symfony\Component\Routing\Route[]
|
#
getIterator( )
Gets the current RouteCollection as an Iterator that includes all routes.
Gets the current RouteCollection as an Iterator that includes all routes.
It implements \IteratorAggregate.
Returns
See
Implementation of
|
public
integer
|
#
count( )
Gets the number of Routes in this collection.
Gets the number of Routes in this collection.
Returns
integer The number of routes
Implementation of
|
public
|
|
public
Symfony\Component\Routing\Route[]
|
#
all( )
Returns all routes in this collection.
Returns all routes in this collection.
Returns
|
public
Symfony\Component\Routing\Route|null
|
#
get( string $name )
Gets a route by name.
Parameters
- $name
string $name The route name
Returns
|
public
|
#
remove( string|array $name )
Removes a route or an array of routes by name from the collection.
Removes a route or an array of routes by name from the collection.
Parameters
- $name
string|array $name The route name or an array of route names
|
public
|
#
addCollection( Symfony\Component\Routing\RouteCollection $collection )
Adds a route collection at the end of the current set by appending all routes
of the added collection.
Adds a route collection at the end of the current set by appending all routes
of the added collection.
Parameters
|
public
|
#
addPrefix( string $prefix, array $defaults = array(), array $requirements = array() )
Adds a prefix to the path of all child routes.
Adds a prefix to the path of all child routes.
Parameters
- $prefix
string $prefix An optional prefix to add before each pattern of the route collection
- $defaults
array $defaults An array of default values
- $requirements
array $requirements An array of requirements
|
public
|
#
setHost( string $pattern, array $defaults = array(), array $requirements = array() )
Sets the host pattern on all routes.
Sets the host pattern on all routes.
Parameters
- $pattern
string $pattern The pattern
- $defaults
array $defaults An array of default values
- $requirements
array $requirements An array of requirements
|
public
|
#
setCondition( string $condition )
Sets a condition on all routes.
Sets a condition on all routes.
Existing conditions will be overridden.
Parameters
- $condition
string $condition The condition
|
public
|
#
addDefaults( array $defaults )
Adds defaults to all routes.
Adds defaults to all routes.
An existing default value under the same name in a route will be
overridden.
Parameters
- $defaults
array $defaults An array of default values
|
public
|
#
addRequirements( array $requirements )
Adds requirements to all routes.
Adds requirements to all routes.
An existing requirement under the same name in a route will be
overridden.
Parameters
- $requirements
array $requirements An array of requirements
|
public
|
#
addOptions( array $options )
Adds options to all routes.
Adds options to all routes.
An existing option value under the same name in a route will be
overridden.
Parameters
- $options
array $options An array of options
|
public
|
#
setSchemes( string|array $schemes )
Sets the schemes (e.g. 'https') all child routes are restricted to.
Sets the schemes (e.g. 'https') all child routes are restricted to.
Parameters
- $schemes
string|array $schemes The scheme or an array of schemes
|
public
|
#
setMethods( string|array $methods )
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
Parameters
- $methods
string|array $methods The method or an array of methods
|
public
Symfony\Component\Config\Resource\ResourceInterface
|
#
getResources( )
Returns an array of resources loaded to build this collection.
Returns an array of resources loaded to build this collection.
Returns
Symfony\Component\Config\Resource\ResourceInterface An array of resources
|
public
|
#
addResource( Symfony\Component\Config\Resource\ResourceInterface $resource )
Adds a resource for this collection.
Adds a resource for this collection.
Parameters
- $resource
Symfony\Component\Config\Resource\ResourceInterface $resource A resource instance
|