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

[Components][Routing] Fix addPrefix() sample code#3622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:2.3frombicpi:fix_route_collection_sample_code
Mar 12, 2014
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Components][Routing] Fix addPrefix() sample code
  • Loading branch information
@bicpi
bicpi committedMar 11, 2014
commite095c134eb7269fd93998b484434f7f86b269bd1
4 changes: 2 additions & 2 deletionsbook/routing.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ The route is simple:
return $collection;

.. versionadded:: 2.2
The ``path`` option is new inSymfony2.2, ``pattern`` is used in older
The ``path`` option is new inSymfony 2.2, ``pattern`` is used in older
versions.

The path defined by the ``blog_show`` route acts like ``/blog/*`` where
Expand DownExpand Up@@ -704,7 +704,7 @@ be accomplished with the following route configuration:
return $collection;

.. versionadded:: 2.2
The ``methods`` option is added inSymfony2.2. Use the ``_method``
The ``methods`` option is added inSymfony 2.2. Use the ``_method``
requirement in older versions.

Despite the fact that these two routes have identical paths (``/contact``),
Expand Down
28 changes: 14 additions & 14 deletionscomponents/routing/introduction.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -141,28 +141,26 @@ Using Prefixes

You can add routes or other instances of
:class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection.
This way you can build a tree of routes. Additionally you can define a prefix,
default requirements, default options and host to all routes of a subtree with
the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix` method::
This way you can build a tree of routes. Additionally you can define a prefix
and default values for the parameters, requirements, options, schemes and the
host to all routes of a subtree using methods provided by the
``RouteCollection`` class::

$rootCollection = new RouteCollection();

$subCollection = new RouteCollection();
$subCollection->add(...);
$subCollection->add(...);
$subCollection->addPrefix(
'/prefix', // prefix
array(), // requirements
array(), // options
'admin.example.com', // host
array('https') // schemes
);
$subCollection->addPrefix('/prefix');
$subCollection->addDefaults(array(...));
$subCollection->addRequirements(array(...));
$subCollection->addOptions(array(...));
$subCollection->setHost('admin.example.com');
$subCollection->setMethods(array('POST'));
$subCollection->setSchemes(array('https'));

$rootCollection->addCollection($subCollection);

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

Set the Request Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All@@ -177,7 +175,9 @@ with this class via its constructor::
$host = 'localhost',
$scheme = 'http',
$httpPort = 80,
$httpsPort = 443
$httpsPort = 443,
$path = '/',
$queryString = ''
)

.. _components-routing-http-foundation:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp