I try to follow Akrabats Tutorial the Application/Index is working, the Album part not.
I tried it also with the ZendSkeletonModule with no luck.
The error in both cases is:
album/album (resolves to invalid controller class or alias: album/album)
I tried it with ZF2 master and beta4 tag (but beta4 tag gives php error about missing method getEventManager)
I took the code from Akrabats Tutorial, and after that failed used the code form the GitHub Repo. Unfortunatly there isnt some Forum or Comment section to ask for help.
I found some diffrences in the tutorial and the Skeleton (zfcUser has the same diffrence) in the module.config.php (which i believe is the core of the problem).
The tutorial uses classes in the controller index, zfcUser and the Skeleton using invokables but it doesnt seem to matter, as the error dont change.
my module.config currently looks like this:
<?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',
),
),
);
Album\Controller\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
{
// [....]
}
I dont know where to look to fix this error, does someone of you have an idea?
Code is like orginal on github (see links above) when not mentioned otherwise.
TIA
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',
),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With