RouteCollectionBuilder (Component\Routing)
Symfony\Component\Routing\RouteCollectionBuilder
class RouteCollectionBuilder
Helps add and import routes into a RouteCollection.
Methods
__construct(LoaderInterface $loader = null) | ||
RouteCollectionBuilder | import(mixed $resource, string|null $prefix = '/', string $type = null) Import an external routing resource and returns the RouteCollectionBuilder. | |
Route | add(string $path, string $controller, string|null $name = null) Adds a route and returns it for future modification. | |
RouteCollectionBuilder | createBuilder() Returns a RouteCollectionBuilder that can be configured and then added with mount(). | |
mount($prefix, RouteCollectionBuilder $builder) Add a RouteCollectionBuilder. | ||
$this | addRoute(Route $route, string|null $name = null) Adds a Route object to the builder. | |
$this | setHost(string $pattern) Sets the host on all embedded routes (unless already set). | |
$this | setCondition(string $condition) Sets a condition on all embedded routes (unless already set). | |
$this | setDefault(string $key, mixed $value) Sets a default value that will be added to all embedded routes (unless that default value is already set. | |
$this | setRequirement(string $key, mixed $regex) Sets a requirement that will be added to all embedded routes (unless that requirement is already set. | |
$this | setOption(string $key, mixed $value) Sets an opiton that will be added to all embedded routes (unless that option is already set. | |
$this | setSchemes(array|string $schemes) Sets the schemes on all embedded routes (unless already set). | |
$this | setMethods(array|string $methods) Sets the methods on all embedded routes (unless already set). | |
RouteCollection | build() Creates the final RouteCollection and returns it. |
Details
public __construct(LoaderInterface $loader = null)
public RouteCollectionBuilder import(mixed $resource, string|null $prefix = '/', string $type = null)
Import an external routing resource and returns the RouteCollectionBuilder.
$routes->import('blog.yml', '/blog');
public Route add(string $path, string $controller, string|null $name = null)
Adds a route and returns it for future modification.
public RouteCollectionBuilder createBuilder()
Returns a RouteCollectionBuilder that can be configured and then added with mount().
public mount($prefix, RouteCollectionBuilder $builder)
Add a RouteCollectionBuilder.
public $this addRoute(Route $route, string|null $name = null)
Adds a Route object to the builder.
public $this setHost(string $pattern)
Sets the host on all embedded routes (unless already set).
public $this setCondition(string $condition)
Sets a condition on all embedded routes (unless already set).
public $this setDefault(string $key, mixed $value)
Sets a default value that will be added to all embedded routes (unless that default value is already set.
public $this setRequirement(string $key, mixed $regex)
Sets a requirement that will be added to all embedded routes (unless that requirement is already set.
public $this setOption(string $key, mixed $value)
Sets an opiton that will be added to all embedded routes (unless that option is already set.
public $this setSchemes(array|string $schemes)
Sets the schemes on all embedded routes (unless already set).
public $this setMethods(array|string $methods)
Sets the methods on all embedded routes (unless already set).
public RouteCollection build()
Creates the final RouteCollection and returns it.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Routing/RouteCollectionBuilder.html