Skip to content

Commit 38e8dad

Browse files
committed
Added use of addPrefix to define prefixes
1 parent 8420b02 commit 38e8dad

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

components/routing/introduction.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,23 +142,29 @@ Using Prefixes
142142
You can add routes or other instances of
143143
:class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection.
144144
This way you can build a tree of routes. Additionally you can define a prefix,
145-
default requirements, default options and hostname to all routes of a subtree::
145+
default requirements, default options and hostname to all routes of a subtree
146+
with the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix`
147+
method::
146148

147149
$rootCollection = new RouteCollection();
148150

149151
$subCollection = new RouteCollection();
150152
$subCollection->add(...);
151153
$subCollection->add(...);
152-
153-
$rootCollection->addCollection(
154-
$subCollection,
154+
$subCollection->addPrefix(
155155
'/prefix', // prefix
156156
array(), // requirements
157157
array(), // options
158158
'admin.example.com', // hostname
159159
array('https') // schemes
160160
);
161161

162+
$rootCollection->addCollection($subCollection);
163+
164+
.. versionadded:: 2.2
165+
The ``addPrefixs`` method is added in Symfony2.2. This was part of the
166+
``addCollection`` method in older versions.
167+
162168
Set the Request Parameters
163169
~~~~~~~~~~~~~~~~~~~~~~~~~~
164170

0 commit comments

Comments
 (0)