Zend Framework 2 MVC - Modules Route mapping not working

天大地大妈咪最大 提交于 2019-12-01 01:03:08

The difference here is not only the invokables, but also that the array key is now "controllers" in plural, wich did the trick for me. In your code "invokables" is already changed, but you seem to use "controller" as key.

    'controllers' => array(
            'invokables' => array(
                    'album/album' => 'Album\Controller\AlbumController',
            ),
    ),

Apparently there is a change in the array for the controller. Now the classes key is changed to invokables: At the module.config.php

    'controller' => array(
            'classes' => array(
                    'album/album' => 'Album\Controller\AlbumController',
            ),
    ),

has to be changed to

    'controllers' => array(
            'invokables' => array(
                    'album/album' => 'Album\Controller\AlbumController',
            ),
    ),

Found it, it The ActionController class seems to be gone on ZF2-beta4 so your AlbumController needs to be this way:

use Zend\Mvc\Controller\AbstractActionController,
    Zend\View\Model\ViewModel;

class AlbumController extends AbstractActionController {
   .....
}

You must right config/application.config.php

<?php
return array(
    'modules' => array(
        'Application',
        'Album',
    ),
    'module_listener_options' => array(
        'config_glob_paths'    => array(
            'config/autoload/{,*.}{global,local}.php',
        ),
        'module_paths' => array(
            './module',
            './vendor',
        ),
    ),
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!