i trying become familiar zend framework. have followed tutorials , created new module. reason cannot find controller. have registered module in application.config.php.
is there way debug module.config.php file?
zend\mvc\controller\controllermanager::createfrominvokable: failed retrieving "controlpanelcontrollercontrol(alias: controlpanel\controller\control)" via invokable class "controlpanel\controller\controlcontroller"; class not exist
this 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 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 route manager 'router' => array( //open configuration possible routes 'routes' => array( //route called controlpanel 'controlpanel' => array( //define zend\mvc\router/http/literal 'type' => 'literal', //configure route 'options' => array( //listen /control uri 'route' => '/control', //define default controller , 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', ), ), );
Comments
Post a Comment