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

Commit eee1a35

Browse files
author
nikolay
committed
AcceptableViewModelSelector - notice fix
InjectTemplateListener - injectTemplate : set $preferRouteMatchController view config param if exists. This way apigility rest service can return proper view per api . prefer_route_match_controller should be set at the config route to true : controller_map should be set at the config view_manager also .
1 parent 3845c2d commit eee1a35

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Controller/Plugin/AcceptableViewModelSelector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ public function getDefaultMatchAgainst()
209209
protected function injectViewModelName($modelAcceptString, $modelName)
210210
{
211211
$modelName = str_replace('\\', '|', $modelName);
212+
$modelAcceptString = (is_array($modelAcceptString ))
213+
? $modelAcceptString[key($modelAcceptString)]
214+
: $modelAcceptString;
212215
return $modelAcceptString . '; ' . self::INJECT_VIEWMODEL_NAME . '="' . $modelName . '", ';
213216
}
214217

src/View/Http/InjectTemplateListener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function injectTemplate(MvcEvent $e)
6161
}
6262

6363
$routeMatch = $e->getRouteMatch();
64+
$preferRouteMatchController = $routeMatch->getParam('prefer_route_match_controller', false);
65+
$this->setPreferRouteMatchController($preferRouteMatchController);
66+
6467
$controller = $e->getTarget();
6568
if (is_object($controller)) {
6669
$controller = get_class($controller);

0 commit comments

Comments
 (0)