Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite095c13

Browse files
committed
[Components][Routing] Fix addPrefix() sample code
1 parentfc0aa8b commite095c13

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

‎book/routing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The route is simple:
6969
return $collection;
7070
7171
..versionadded::2.2
72-
The ``path`` option is new inSymfony2.2, ``pattern`` is used in older
72+
The ``path`` option is new inSymfony 2.2, ``pattern`` is used in older
7373
versions.
7474

7575
The path defined by the ``blog_show`` route acts like ``/blog/*`` where
@@ -704,7 +704,7 @@ be accomplished with the following route configuration:
704704
return $collection;
705705
706706
..versionadded::2.2
707-
The ``methods`` option is added inSymfony2.2. Use the ``_method``
707+
The ``methods`` option is added inSymfony 2.2. Use the ``_method``
708708
requirement in older versions.
709709

710710
Despite the fact that these two routes have identical paths (``/contact``),

‎components/routing/introduction.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,26 @@ Using Prefixes
141141

142142
You can add routes or other instances of
143143
: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::
147148

148149
$rootCollection = new RouteCollection();
149150

150151
$subCollection = new RouteCollection();
151152
$subCollection->add(...);
152153
$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'));
160161

161162
$rootCollection->addCollection($subCollection);
162163

163-
..versionadded::2.2
164-
The ``addPrefix`` method is added in Symfony2.2. This was part of the
165-
``addCollection`` method in older versions.
166164

167165
Set the Request Parameters
168166
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -177,7 +175,9 @@ with this class via its constructor::
177175
$host = 'localhost',
178176
$scheme = 'http',
179177
$httpPort = 80,
180-
$httpsPort = 443
178+
$httpsPort = 443,
179+
$path = '/',
180+
$queryString = ''
181181
)
182182

183183
.. _components-routing-http-foundation:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp