我試圖關注Akrabats Tutorial應用程序/索引正在工作,而不是相冊部分。Zend Framework 2 MVC - 模塊路由映射不起作用
我試過它也與ZendSkeletonModule沒有運氣。
錯誤在這兩種情況是:
album/album (resolves to invalid controller class or alias: album/album)
我ZF2主人和BETA4標籤嘗試過(但BETA4標籤使PHP的錯誤有關缺少方法getEventManager)
我把代碼Akrabats教程,並在此之後使用代碼形式GitHub Repo。不幸的是,沒有一些論壇或評論部分尋求幫助。
我發現教程中的一些差異和module.config.php(我相信是問題的核心)的骨架(zfcUser具有相同的差異)。
本教程在控制器索引中使用classes
,zfcUser和使用invokables
的Skeleton,但它似乎並不重要,因爲錯誤不會改變。
我module.config目前看起來是這樣的:
<?php
return array(
// Controllers in this module
'controller' => array(
'invokables' => array(
'album/album' => 'Album\Controller\AlbumController',
),
),
// Routes for this module
'router' => array(
'routes' => array(
'album' => array(
'type' => 'Literal',
'priority' => 1000,
'options' => array(
'route' => '/album',
'defaults' => array(
'controller' => 'album/album',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'misc' => array (
'type' => 'segment',
'options' => array(
'route' => '/album/[:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'album/album',
'action' => 'index',
),
),
),
),
),
),
),
// View setup for this module
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
專輯\控制器\ AlbumController:
<?php
namespace Album\Controller;
use Zend\Mvc\Controller\ActionController,
Zend\View\Model\ViewModel,
Album\Model\AlbumTable,
Album\Model\Album,
Album\Form\AlbumForm;
class AlbumController extends ActionController
{
// [....]
}
我不知道去哪裏找解決這個錯誤,做你一個人有一個理念?
代碼與github上的原始代碼相同(請參閱上面的鏈接),除非另有說明。
TIA
歡迎來到SO,感謝您的發現。 – Rufinus 2012-07-08 08:35:37