0

我正在尝试使用依赖注入配置应用程序模块。但是依赖项似乎没有被注入。这是我的配置的一部分:

'di' => array(
    'instance' => array(
        'Zend\View\Resolver\AggregateResolver' => array(
                'injections' => array(
                        'Zend\View\Resolver\TemplateMapResolver',
                        'Zend\View\Resolver\TemplatePathStack',
                ),
        ),
        'Zend\View\Resolver\TemplateMapResolver' => array(
                'parameters' => array(
                        'map'  => array(
                                'home'        => __DIR__ . '/../view/home.phtml',
                                'site/layout' => __DIR__ . '/../view/site/layout.phtml',
                                'site/error'  => __DIR__ . '/../view/site/error.phtml',
                                'site/404'    => __DIR__ . '/../view/site/404.phtml',
                        ),
                ),
        ),
        'Zend\View\Resolver\TemplatePathStack' => array(
                'parameters' => array(
                        'paths'  => array(
                                'application' => __DIR__ . '/../view',
                        ),
                ),
        ),
        'Zend\View\Renderer\PhpRenderer' => array(
                'parameters' => array(
                        'resolver' => 'Zend\View\Resolver\AggregateResolver',
                ),
        ),
        'Zend\Mvc\View\DefaultRenderingStrategy' => array(
                'parameters' => array(
                        'layoutTemplate' => 'site/layout',
                ),
        ),
        'Zend\View\View' => array(
            'parameters' => array(
                        'renderer'=>'Zend\View\Renderer\PhpRenderer'
                    )
        ),
    )

),

Zend\View\Renderer\PhpRenderer对象未注入。如何配置我的应用程序以将 DI 用于视图和解析器?

4

0 回答 0