j.doe
j.doe

Reputation: 69

Route with name "Admin\Controller\AdminController" not found zend 2.3

Hello all I have the folowing problem. Once I tryed to create a form using zend form and saw an error that sad that class with my form was not found. Discussion ot form class not found zend 2.3

As recomended I changed files names to start with capital latters. and now I am getting an error that says root with name admin/controller/AdminController not found. Module was created with zend studio new->zend item->create module. Here is the stack trace of the error if it's helpful:

#0 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\Helper\Url.php(100): Zend\Mvc\Router\Http\TreeRouteStack->assemble(Array, Array)
#1 [internal function]: Zend\View\Helper\Url->__invoke('Admin\Controlle...', Array)
#2 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php(399): call_user_func_array(Object(Zend\View\Helper\Url), Array)
#3 C:\xampp\htdocs\disability\module\Admin\view\admin\admin\addstudent.phtml(5): Zend\View\Renderer\PhpRenderer->__call('url', Array)
#4 C:\xampp\htdocs\disability\module\Admin\view\admin\admin\addstudent.phtml(5): Zend\View\Renderer\PhpRenderer->url('Admin\Controlle...', Array)
#5 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php(506): include('C:\xampp\htdocs...')
#6 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
#7 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\View.php(233): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#8 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\View\View.php(198): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
#9 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(103): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#10 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#11 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#12 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('render', Object(Zend\Mvc\MvcEvent), Array)
#13 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(352): Zend\EventManager\EventManager->trigger('render', Object(Zend\Mvc\MvcEvent))
#14 C:\xampp\htdocs\disability\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(327): Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
#15 C:\xampp\htdocs\disability\public\index.php(17): Zend\Mvc\Application->run()
#16 {main}

What could cause this or what additional information would you need to help resolve this?

Upvotes: 0

Views: 381

Answers (1)

j.doe
j.doe

Reputation: 69

Simes like I have found the solution to this. The problem I think was that in module 's view file I gave the whol path to admin controller insted of just it's name. Now link to action lookes like this:

$form->setAttribute('action', $this->url('admin', array('action' => 'addstudent')));

instead of

$form->setAttribute('action', $this->url('admin/controller/AdminController', array('action' => 'addstudent')));

Upvotes: 1

Related Questions