@@ -410,6 +410,35 @@ $ composer require zendframework/zend-validator
410
410
Note: the above assumes you have already installed zend-component-installer, per
411
411
the section above on [ dependency reduction] ( #dependency-reduction ) .
412
412
413
+ ## Zend\Mvc\View\InjectTemplateListener
414
+
415
+ The ` InjectTemplateListener ` attempts to map a controller * service* name to a
416
+ template using a variety of heuristics, including an explicit map provided
417
+ during configuration, or auto-detection based on the service name.
418
+
419
+ In version 2, the autodetection took into consideration the ` __NAMESPACE__ `
420
+ provided in routing configuration, and would omit the module subnamespace if a
421
+ match was found. This caused issues when multiple modules shared a top-level
422
+ namespace (e.g., ` ZF\Apigility ` and ` ZF\Apigility\Admin ` ) if each had a
423
+ controller with the same name.
424
+
425
+ To avoid naming conflicts, version 3 removes this aspect of autodetection, and
426
+ instead provides exactly one workflow for mapping:
427
+
428
+ - Strip the ` Controller ` subnamespace, if present (e.g.,
429
+ the namespace ` Application\Controller\\ ` is normalized to
430
+ ` Application\\ ` ).
431
+ - Strip the ` Controller ` suffix in the class name, if present (e.g.,
432
+ ` IndexController ` is normalized to ` Index ` ).
433
+ - Inflect CamelCasing to dash-separated (e.g., ` ShowUsers ` becomes
434
+ ` show-users ` ).
435
+ - Replace the namespace separator with a slash.
436
+
437
+ As a full example, the controller service name
438
+ ` TestSomething\With\Controller\CamelCaseController ` will always map to
439
+ ` test-something/with/camel-case ` , regardless of the ` __NAMESPACE__ ` value
440
+ provided in routing configuration.
441
+
413
442
## Zend\Mvc\View\SendResponseListener
414
443
415
444
` Zend\Mvc\View\SendResponseListener ` was deprecated with the 2.2 release, and
0 commit comments