@@ -141,28 +141,26 @@ Using Prefixes
141
141
142
142
You can add routes or other instances of
143
143
:class: `Symfony\\ Component\\ Routing\\ RouteCollection ` to *another * collection.
144
- This way you can build a tree of routes. Additionally you can define a prefix,
145
- default requirements, default options and host to all routes of a subtree with
146
- the :method: `Symfony\\ Component\\ Routing\\ RouteCollection::addPrefix ` method::
144
+ This way you can build a tree of routes. Additionally you can define a prefix
145
+ and default values for the parameters, requirements, options, schemes and the
146
+ host to all routes of a subtree using methods provided by the
147
+ ``RouteCollection `` class::
147
148
148
149
$rootCollection = new RouteCollection();
149
150
150
151
$subCollection = new RouteCollection();
151
152
$subCollection->add(...);
152
153
$subCollection->add(...);
153
- $subCollection->addPrefix(
154
- '/prefix', // prefix
155
- array(), // requirements
156
- array(), // options
157
- 'admin.example.com', // host
158
- array('https') // schemes
159
- );
154
+ $subCollection->addPrefix('/prefix');
155
+ $subCollection->addDefaults(array(...));
156
+ $subCollection->addRequirements( array(...));
157
+ $subCollection->addOptions( array(...));
158
+ $subCollection->setHost( 'admin.example.com');
159
+ $subCollection->setMethods( array('POST'));
160
+ $subCollection->setSchemes(array('https') );
160
161
161
162
$rootCollection->addCollection($subCollection);
162
163
163
- .. versionadded :: 2.2
164
- The ``addPrefix `` method is added in Symfony2.2. This was part of the
165
- ``addCollection `` method in older versions.
166
164
167
165
Set the Request Parameters
168
166
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -177,7 +175,9 @@ with this class via its constructor::
177
175
$host = 'localhost',
178
176
$scheme = 'http',
179
177
$httpPort = 80,
180
- $httpsPort = 443
178
+ $httpsPort = 443,
179
+ $path = '/',
180
+ $queryString = ''
181
181
)
182
182
183
183
.. _components-routing-http-foundation :
0 commit comments