Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 14d26fa

Browse files
committed
Minor edits for #155
- Minor edits to use an active voice, provide cross-document links, and correct formatting.
1 parent 08f5593 commit 14d26fa

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

doc/book/migration/to-v3-0.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,16 @@ template using a variety of heuristics, including an explicit map provided
417417
during configuration, or auto-detection based on the controller class name.
418418

419419
In version 2, the autodetection took into consideration the `__NAMESPACE__`
420-
route match parameter to derive subnamespaces or would omit them completely if
421-
`__NAMESPACE__` is not present. This caused issues when multiple modules shared
422-
a top-level namespace (e.g., `ZF\Apigility` and `ZF\Apigility\Admin`) if each
420+
route match parameter to derive subnamespaces, or would omit them completely if
421+
`__NAMESPACE__` was not present. This caused issues when multiple modules shared
422+
a top-level namespace (e.g., `ZF\Apigility` and `ZF\Apigility\Admin`) and each
423423
had a controller with the same name.
424424

425425
To avoid naming conflicts, version 3 removes this aspect of autodetection, and
426426
instead provides exactly one workflow for mapping:
427427

428-
- Strip the `Controller` subnamespace, if present (e.g.,
429-
the namespace `Application\Controller\` is normalized to
430-
`Application\`).
428+
- Strip the `Controller` subnamespace, if present (e.g., the namespace
429+
`Application\Controller\\` is normalized to `Application\\`).
431430
- Strip the `Controller` suffix in the class name, if present (e.g.,
432431
`IndexController` is normalized to `Index`).
433432
- Inflect CamelCasing to dash-separated (e.g., `ShowUsers` becomes
@@ -439,8 +438,8 @@ As a full example, the controller service name
439438
`test-something/with/camel-case`, regardless of the `__NAMESPACE__` value
440439
provided in routing configuration.
441440

442-
Similar behavior in version 2 could be achieved with namespace whitelisting in
443-
controller to template map
441+
If needed, you can emulate the version 2 behavior in version 3 via namespace
442+
whitelisting in the controller <=> template map.
444443

445444
## Zend\Mvc\View\SendResponseListener
446445

doc/book/quick-start.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,23 +178,25 @@ That's it. Save the file.
178178

179179
As per PSR-0, modules should be named following the rule: `<Vendor Name>\<Namespace>\*`.
180180

181-
Since version 3.0 default template name resolver uses fully qualified controller
182-
class name, stripping only `\Controller\` subnamespace, if present.
183-
For example, `AwesomeMe\MyModule\Controller\HelloWorldController` is resolved
184-
to template name `awesome-me/my-module/hello-world`.
185-
186-
For prior versions default was to strip subnamespaces but optional mapping rules
187-
allowed to whitelist namespaces in module configuration to enable current
188-
resolver behavior:
181+
Since version 3.0, the default template name resolver uses fully qualified
182+
controller class names, stripping only the `\Controller\\` subnamespace, if
183+
present. For example, `AwesomeMe\MyModule\Controller\HelloWorldController`
184+
resolves to the template name `awesome-me/my-module/hello-world` via the
185+
following configuration:
189186

190187
```php
191188
'view_manager' => array(
192189
'controller_map' => array(
193-
'<AwesomeMe\MyModule>' => true,
190+
'AwesomeMe\MyModule' => true,
194191
),
195192
),
196193
```
197194

195+
(In v2 releases, the default was to strip subnamespaces, but optional mapping rules
196+
allowed whitelisting namespaces in module configuration to enable current
197+
resolver behavior. See the [migration guide](migration/to-v3-0.md#zendmvcviewinjecttemplatelistener)
198+
for more details.)
199+
198200
## Create a Route
199201

200202
Now that we have a controller and a view script, we need to create a route to it.

0 commit comments

Comments
 (0)