Bonjour à tous,

Je débute sur Zend 2 et je suis confronté à une 404 sur l'ajout d'un controller que j'ai créé pour tester.

l'erreur de la 404 est la suivante :

Page not found.
L'URL demandée n'a pas pu trouver de route correspondante.

Le module.config.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
return array(
     'controllers' => array(
         'invokables' => array(
             'Album\Controller\Album' => 'Album\Controller\AlbumController',
             'Album\Controller\Artiste' => 'Album\Controller\ArtisteController',
         ),
     ),
 
     // The following section is new and should be added to your file
     'router' => array(
         'routes' => array(
             'album' => array(
                 'type'    => 'segment',
                 'options' => array(
                     'route'    => '/album[/][:action][/:id]',
                     'constraints' => array(
                         'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                         'id'     => '[0-9]+',
                     ),
                     'defaults' => array(
                         'controller' => 'Album\Controller\Album',
                         '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(
                            ),
                        ),
                    ),
                ),
             ),
         ),
     ),
 
     'view_manager' => array(
         'template_path_stack' => array(
             'album' => __DIR__ . '/../view',
 
         ),
     ),
 );
et une partie de mon controller ArtisteController.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
namespace Album\Controller;
 
 use Zend\Mvc\Controller\AbstractActionController;
 use Zend\View\Model\ViewModel;
 use Album\Model\Album;     
 use Album\Form\AlbumForm;
 
 class ArtisteController extends AbstractActionController
 {
 
 }
Toutes les .phtml du controller sont dans le bon dossier egalement.

Pourriez vous m'aider s'il vous plait ?

je vous remercie d'avance.

Cordialement,