This repository was archived by the owner on Jan 21, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
3
* @see https://github.com/zendframework/zend-expressive-zendviewrenderer for the canonical source repository
4
- * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (https://www.zend.com)
4
+ * @copyright Copyright (c) 2015-2019 Zend Technologies USA Inc. (https://www.zend.com)
5
5
* @license https://github.com/zendframework/zend-expressive-zendviewrenderer/blob/master/LICENSE.md New BSD License
6
6
*/
7
7
@@ -44,7 +44,7 @@ class ZendViewRenderer implements TemplateRendererInterface
44
44
use DefaultParamsTrait;
45
45
46
46
/**
47
- * @var ViewModel
47
+ * @var null|ModelInterface
48
48
*/
49
49
private $ layout ;
50
50
@@ -207,6 +207,7 @@ private function renderModel(
207
207
$ root = $ model ;
208
208
}
209
209
210
+ /** @var ModelInterface $child */
210
211
foreach ($ model as $ child ) {
211
212
if ($ child ->terminate ()) {
212
213
throw new Exception \RenderingException ('Cannot render; encountered a child marked terminal ' );
@@ -219,7 +220,8 @@ private function renderModel(
219
220
220
221
$ child = $ this ->mergeViewModel ($ child ->getTemplate (), $ child );
221
222
222
- if ($ child !== $ root ) {
223
+ if ($ renderer instanceof PhpRenderer && $ child !== $ root ) {
224
+ /** @var Helper\ViewModel $viewModelHelper */
223
225
$ viewModelHelper = $ renderer ->plugin (Helper \ViewModel::class);
224
226
$ viewModelHelper ->setRoot ($ root );
225
227
}
You can’t perform that action at this time.
0 commit comments