0

Hi how can i call another controller in my module in zend app? i found some code in the documentation of zend framework but it didn't work.

Here's my current code:

 array( 'invokables' => array( 'Users\Controller\User' => 'Users\Controller\UserController', 'Users\Controller\Role' => 'Users\Controller\RoleController', ), ), 'router' => array( 'routes' => array( 'users' => array( 'type' => 'Segment', 'options' => array( 'route' => '/users[/][:action[/:id]]', 'constraints' => array( 'controller' => '[a-zA-Z][a-zA-Z-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z-Z0-9_-]*', 'id' => '[0-9]*', ), 'defaults' => array( '__NAMESPACE__' => 'Users\Controller', 'controller' => 'User', 'action' => 'index', ), ), ), 'roles' => array( 'type' => 'Segment', 'options' => array( 'route' => 'roles', 'defaults' => array( 'controller' => 'Users\Controller\RoleController', 'action' => 'index' ), ), ), ), ), 'view_manager' => array( 'template_path_stack' => array( 'users' => __DIR__.'/../view', ), ), ); ?> 

The users controller worked fine. but when im trying to access myApp/public/roles it returns a 404 error. How can i fix this? please help, Thanks

1 Answer 1

0
 'roles' => array( 'type' => 'Segment', 'options' => array( 'route' => '/roles[/]', 'defaults' => array( '__NAMESPACE__' => 'Users\Controller', 'controller' => 'Role', 'action' => 'index' ), ), ), 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.