@@ -635,7 +635,7 @@ class Module
635
635
636
636
The above will register the ` JsonStrategy ` with the "render" event, such that it
637
637
executes prior to the ` PhpRendererStrategy ` , and thus ensure that a JSON payload
638
- is created when the controller returns an ` JsonModel ` .
638
+ is created when the controller returns a ` JsonModel ` .
639
639
640
640
You could also use the module configuration to add the strategies:
641
641
``` php
@@ -651,8 +651,9 @@ class Module implements \Zend\ModuleManager\Feature\ConfigProviderInterface
651
651
public function getConfig()
652
652
{
653
653
return [
654
- // ...
654
+ /* ... */
655
655
'view_manager' => [
656
+ /* ... */
656
657
'strategies' => [
657
658
'ViewJsonStrategy',
658
659
],
@@ -726,7 +727,7 @@ class MyController extends \Zend\Mvc\Controller\AbstractActionController
726
727
*/
727
728
public function listAction()
728
729
{
729
- $items = /* ... get items .. . */;
730
+ $items = /* ... get items ... */;
730
731
$viewModel = new \Zend\View\Model\ViewModel();
731
732
$viewModel->setVariable('items', $items);
732
733
return $viewModel;
@@ -737,7 +738,7 @@ class MyController extends \Zend\Mvc\Controller\AbstractActionController
737
738
*/
738
739
public function listJsonAction()
739
740
{
740
- $items = /* ... get items .. . */;
741
+ $items = /* ... get items ... */;
741
742
$viewModel = new \Zend\View\Model\JsonModel();
742
743
$viewModel->setVariable('items', $items);
743
744
return $viewModel;
@@ -748,13 +749,13 @@ class MyController extends \Zend\Mvc\Controller\AbstractActionController
748
749
*/
749
750
public function listFeedAction()
750
751
{
751
- $items = /* ... get items .. . */;
752
+ $items = /* ... get items ... */;
752
753
$viewModel = new \Zend\View\Model\FeedModel();
753
754
$viewModel->setVariable('items', $items);
754
755
return $viewModel;
755
756
}
756
757
}
757
758
```
758
759
759
- Or you could switch the ` ViewModel ` dynamically based on the "Accept" HTTP Header:
760
- [ Zend-Mvc: AcceptableViewModelSelector Plugin ] ( http://zendframework.github.io/zend-mvc/plugins/#acceptableviewmodelselector-plugin ) .
760
+ Or you could switch the ` ViewModel ` dynamically based on the "Accept" HTTP Header with the
761
+ [ Zend-Mvc-Plugin AcceptableViewModelSelector] ( http://zendframework.github.io/zend-mvc/plugins/#acceptableviewmodelselector-plugin ) .
0 commit comments