Zend Framework 2 MVC - Moduły Mapowanie trasy nie działa
Staram się podążaćSamouczek Akrabats aplikacja / indeks działa, część albumu nie.
Próbowałem go także zZendSkeletonModule bez szczęścia.
Błąd w obu przypadkach:
album/album (resolves to invalid controller class or alias: album/album)
Spróbowałem tego z ZF2 master i tagiem beta4 (ale tag beta4 zawiera błąd php o brakującej metodzie getEventManager)
Wziąłem kod z Akrabats Tutorial, a po tym nie użyłem kodu zGitHub Repo. Niestety nie ma sekcji Forum ani komentarza, która mogłaby poprosić o pomoc.
Znalazłem pewne różnice w tutorialu i Skeleton (zfcUser ma tę samą różnicę) w module.config.php (co, jak sądzę, stanowi sedno problemu).
Samouczek używaclasses
w indeksie kontrolera, używając zfcUser i Skeletoninvokables
ale wydaje się, że nie ma to znaczenia, ponieważ błąd się nie zmienia.
mój module.config obecnie wygląda tak:
<?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',
),
),
);
Sterownik albumu Sterownik albumu:
<?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
{
// [....]
}
Nie wiem, gdzie szukać tego błędu, czy ktoś z was ma pomysł?
Kod jest podobny do oryginalnego na github (patrz linki powyżej), gdy nie podano inaczej.
TIA