1

I am trying to become familiar with the zend framework. I have followed the tutorials and created a new module. for some reason it cannot find my controller. I have registered the module in the application.config.php.

is there a way to debug the module.config.php file?

Zend\Mvc\Controller\ControllerManager::createFromInvokable: failed retrieving "controlpanelcontrollercontrol(alias: Controlpanel\Controller\Control)" via invokable class "Controlpanel\Controller\ControlController"; class does not exist

This is my controller

namespace Controlpanel\Controller;

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

class ControlController extends AbstractActionController
{

protected $albumTable;

public function indexAction()
{
    return new ViewModel();
}

public function addAction()
{
}

public function editAction()
{
}

public function deleteAction()
{
}


public function getAlbumTable()
{
    if (!$this->controlTable) {
        $sm = $this->getServiceLocator();
        $this->controlTable = $sm->get('Controlpanel\Model\ControlTable');
    }
    return $this->controlTable;
}


}

This is my module.php

<?php
namespace Controlpanel;

use Controlpanel\Controller;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; 
use Zend\ModuleManager\Feature\ConfigProviderInterface;

class Module implements AutoloaderProviderInterface,        
ConfigProviderInterface
{
public function getAutoloaderConfig()
{
    return array(

        'Zend\Loader\StandardAutoloader' => array(
            'namespaces' => array(
                __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
            ),
        ),
    );
}

public function getConfig()
{
    return include __DIR__ . '/config/module.config.php';
}
}

my module.config.php

<?php

//Filename: /module/Controlpanel/config/module.config.php
return array(
'controllers' => array(
    'invokables' => array(
          'Controlpanel\Controller\Control' =>       'Controlpanel\Controller\ControlController',
    ),
),
  //open config for route manager
 'router' => array(
    //Open configuration for all possible routes
    'routes' => array(
        //route called controlpanel
        'controlpanel' => array(
            //define Zend\Mvc\Router/Http/Literal
            'type'    => 'Literal',
            //configure the route itself
            'options' => array(
                //listen to /control as uri
                'route'    => '/control',
                //define default controller and action
                'defaults' => array(
                    '__NAMESPACE__' => 'Controlpanel\Controller',
                    'controller' => 'Control',
                    'action'     => 'index',
                ),
            ),
           /*'may_terminate' => true,
            'child_routes'  => array(
                'route' => '[/controller[/action][/:id]]]',
                'constraints' => array(
                    'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                ),
                'defaults' => array(
                    'id'  => '0'
                ),
                ) */
            ),
        ),
    ),


'view_manager' => array(
    'template_path_stack' => array(
        'controlpanel' => __DIR__ . '/../view',
    ),
),


);
Progrock
  • 7,373
  • 1
  • 19
  • 25
gibbles
  • 26
  • 4

0 Answers0