I think I figured it out,
1: Add this to your di config:
'Zend\View\Renderer\JsonRenderer' => array(
'parameters' => array(
'mergeUnnamedChildren' => true
)
),
Bugfixes:
2: Make sure line 60 in Zend\View\Variables reads:
ArrayObject::ARRAY_AS_PROPS,
3: Update Zend\View\Renderer\JsonRenderer in the recurseModel method for
loop
from:
if ($captureTo) {
// Capturing to a specific key
$values[$captureTo] = $childValues;
} elseif ($mergeChildren) {
// Merging values with parent
$values = array_replace_recursive($values, $childValues);
}
to:
if ($mergeChildren) {
// Merging values with parent
$values = array_replace_recursive($values, $childValues);
} else {
// Capturing to a specific key
$values[$captureTo] = $childValues;
}
If I understand the intended use properly, this should work. I've submitted
the following PR: https://github.com/zendframework/zf2/pull/899
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/ZF2-contextSwitch-to-json-tp4418147p4454381.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]