ZF2-201: Layout rendering on JsonModel return

Description

When we return JsonModel from controller, and attach JsonStrategy with high priority, Zend\View will render layout as well. This effect solved by JsonModel "terminal" method:


public function testAction(){
  $result = new ViewModel\JsonModel(array(
     'success'=>true,
  ));
  $result->setTerminal(true);
  return $result;
}

But maybe better to set $terminate property to true by default, because often JsonModel is terminator.

Comments