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

The host parameter has to be in defaults, not requirements#3368

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

Closed
MarieMinasyan wants to merge2 commits intosymfony:2.4fromMarieMinasyan:patch-1
Closed
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
18 changes: 11 additions & 7 deletionscomponents/routing/hostname_pattern.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -176,25 +176,27 @@ instance, if you want to match both ``m.example.com`` and

return $collection;

.. tip::

Make sure you also include a default option for the ``subdomain``
placeholder, otherwise you need to include the subdomains value each time
you generate the route.

.. sidebar:: Using Service Parameters

You can also use service parameters if you do not want to hardcode the
hostname:

.. tip::

Make sure you also include a default option for the ``subdomain``
placeholder, otherwise you need to include the subdomains value each time
you generate the route.

.. configuration-block::

.. code-block:: yaml

mobile_homepage:
path: /
host: "m.{domain}"
defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage }
defaults:
_controller: AcmeDemoBundle:Main:mobileHomepage
domain: "%domain%"
requirements:
domain: "%domain%"

Expand All@@ -212,6 +214,7 @@ instance, if you want to match both ``m.example.com`` and

<route id="mobile_homepage" path="/" host="m.example.com">
<default key="_controller">AcmeDemoBundle:Main:mobileHomepage</default>
<default key="domain">%domain%</requirement>
<requirement key="domain">%domain%</requirement>
</route>

Expand All@@ -228,6 +231,7 @@ instance, if you want to match both ``m.example.com`` and
$collection = new RouteCollection();
$collection->add('mobile_homepage', new Route('/', array(
'_controller' => 'AcmeDemoBundle:Main:mobileHomepage',
'domain' => '%domain%',
), array(
'domain' => '%domain%',
), array(), 'm.{domain}'));
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp