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

Commit bdf5b04

Browse files
committed
Added CHANGELOG for #163
1 parent df63e7e commit bdf5b04

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

CHANGELOG.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,37 @@ All notable changes to this project will be documented in this file, in reverse
66

77
### Added
88

9-
- Nothing.
9+
- [#163](https://github.com/zendframework/zend-mvc/pull/163) adds support to the
10+
`AcceptableViewModelSelector` plugin for controller maps in the `view_manager`
11+
configuration in the format:
12+
13+
```php
14+
[
15+
'ControllerClassName' => 'view/name',
16+
]
17+
```
18+
19+
This fixes an issue observed when running with Apigility.
20+
21+
- [#163](https://github.com/zendframework/zend-mvc/pull/163) adds support to the
22+
`InjectTemplateListener` for specifying whether or not to prefer the
23+
controller matched during routing via routing configuration:
24+
25+
```php
26+
'route-name' => [
27+
/* ... */
28+
'options' => [
29+
/* ... */
30+
'defaults' => [
31+
/* ... */
32+
'prefer_route_match_controller' => true,
33+
],
34+
],
35+
],
36+
```
37+
38+
This allows actions that might otherwise skip injection of the template
39+
to force the injection.
1040

1141
### Deprecated
1242

test/View/InjectTemplateListenerTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Zend\Router\RouteMatch;
1818
use Zend\Mvc\View\Http\InjectTemplateListener;
1919
use Zend\View\Model\ViewModel;
20+
use ZendTest\Mvc\Controller\TestAsset\SampleController;
2021

2122
class InjectTemplateListenerTest extends TestCase
2223
{
@@ -108,7 +109,7 @@ public function testBypassesTemplateInjectionIfResultViewModelAlreadyHasATemplat
108109
public function testMapsSubNamespaceToSubDirectory()
109110
{
110111
$myViewModel = new ViewModel();
111-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
112+
$myController = new SampleController();
112113
$this->event->setTarget($myController);
113114
$this->event->setResult($myViewModel);
114115

@@ -158,7 +159,7 @@ public function testMapsSubNamespaceToSubDirectoryWithControllerFromEventTarget(
158159
$moduleRouteListener->onRoute($this->event);
159160

160161
$myViewModel = new ViewModel();
161-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
162+
$myController = new SampleController();
162163

163164
$this->event->setTarget($myController);
164165
$this->event->setResult($myViewModel);
@@ -183,7 +184,7 @@ public function testMapsSubNamespaceToSubDirectoryWithControllerFromEventTargetS
183184
$template1 = $myViewModel->getTemplate();
184185

185186
$myViewModel = new ViewModel();
186-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
187+
$myController = new SampleController();
187188

188189
$this->event->setTarget($myController);
189190
$this->event->setResult($myViewModel);
@@ -204,7 +205,7 @@ public function testControllerMatchedByMapIsInflected()
204205

205206
$this->listener->setControllerMap(['ZendTest' => true]);
206207
$myViewModel = new ViewModel();
207-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
208+
$myController = new SampleController();
208209
$this->event->setTarget($myController);
209210
$this->event->setResult($myViewModel);
210211

@@ -332,7 +333,7 @@ public function testPrefersRouteMatchController()
332333
$this->listener->setPreferRouteMatchController(true);
333334
$this->routeMatch->setParam('controller', 'Some\Other\Service\Namespace\Controller\Sample');
334335
$myViewModel = new ViewModel();
335-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
336+
$myController = new SampleController();
336337

337338
$this->event->setTarget($myController);
338339
$this->event->setResult($myViewModel);
@@ -356,7 +357,7 @@ public function testPrefersRouteMatchControllerWithRouteMatchAndControllerMap()
356357
$this->listener->setControllerMap($controllerMap);
357358

358359
$myViewModel = new ViewModel();
359-
$myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
360+
$myController = new SampleController();
360361

361362
$this->event->setTarget($myController);
362363
$this->event->setResult($myViewModel);

0 commit comments

Comments
 (0)