Agrego un poco de aclaración a lo que dijo Daniel sobre "asegúrese de tener una ruta que satisfaga su propósito ...". Para mi propósito, estaba tratando de acomodar rutas al módulo/Application/src/Application/Controller/IndexController.php y module/Application/src/Application/Controller/ProfileController.php, sin embargo tuve problemas para resolver cualquier cosa con mi ProfileController. Tampoco estaba claro si ZF2 podría acomodar múltiples controladores en un solo módulo. ¡Pensé que seguramente debe y lo hace! Dado los dos controladores anteriores, así es como diseñé mi matriz 'enrutador' dentro del módulo/Application/config/module.config.php.
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
'application' => array(
'type' => 'Literal',
'options' => array(
'route' => '/application',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
'profile' => array(
'type' => 'literal',
'options' => array(
'route' => '/profile',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Profile',
'action' => 'index',
),
),
),
),
),
También esto es lo invokables mis 'controladores' se ve como en modules.config.php siguiente éxito.
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController',
'Application\Controller\Profile' => 'Application\Controller\ProfileController'
),
),
zf1 wasnt newbei ready, zf2 aún más difícil :))) – SMka
No diría eso. No he usado ZF1 pero ZF2 tiene tantos aspectos agradables que ZF1 no tiene (de acuerdo con la opinión de otras personas). –
trabajando con zf1 durante cinco años. zf2: realmente muy bueno :) – SMka