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

Commitb1e8f56

Browse files
committed
featuresymfony#3368 The host parameter has to be in defaults, not requirements (MarieMinasyan)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closessymfony#3368).Discussion----------The host parameter has to be in defaults, not requirements Q | A ------------- | --- Doc fix? | yes New docs? | no Applies to | 2.2+Also has to be applied to 2.2 & 2.3 branchesCommits-------8a1afae Moved tip block to remove confusion9c30509 The host parameter has to be in defaults, not requirements
2 parents5a3ba1b +d552e69 commitb1e8f56

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎components/routing/hostname_pattern.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,25 +176,27 @@ instance, if you want to match both ``m.example.com`` and
176176
177177
return $collection;
178178
179-
..tip::
180-
181-
Make sure you also include a default option for the ``subdomain``
182-
placeholder, otherwise you need to include the subdomains value each time
183-
you generate the route.
184-
185179
..sidebar::Using Service Parameters
186180

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

184+
..tip::
185+
186+
Make sure you also include a default option for the ``subdomain``
187+
placeholder, otherwise you need to include the subdomains value each time
188+
you generate the route.
189+
190190
..configuration-block::
191191

192192
..code-block::yaml
193193
194194
mobile_homepage:
195195
path:/
196196
host:"m.{domain}"
197-
defaults:{ _controller: AcmeDemoBundle:Main:mobileHomepage }
197+
defaults:
198+
_controller:AcmeDemoBundle:Main:mobileHomepage
199+
domain:"%domain%"
198200
requirements:
199201
domain:"%domain%"
200202
@@ -212,6 +214,7 @@ instance, if you want to match both ``m.example.com`` and
212214
213215
<routeid="mobile_homepage"path="/"host="m.example.com">
214216
<defaultkey="_controller">AcmeDemoBundle:Main:mobileHomepage</default>
217+
<defaultkey="domain">%domain%</requirement>
215218
<requirementkey="domain">%domain%</requirement>
216219
</route>
217220
@@ -228,6 +231,7 @@ instance, if you want to match both ``m.example.com`` and
228231
$collection = new RouteCollection();
229232
$collection->add('mobile_homepage', new Route('/', array(
230233
'_controller' => 'AcmeDemoBundle:Main:mobileHomepage',
234+
'domain' => '%domain%',
231235
), array(
232236
'domain' => '%domain%',
233237
), array(), 'm.{domain}'));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp