0
votes

config/routes.yaml

admin_users:
    resource: '@ProjectUserBundle/Resources/config/routing.yml'
    prefix: /admin

app_locations:
    resource: '../src/Project/LocationBundle/Controller/'
    type:     annotation

Project/UserBundle/Resources/config/routing.yaml

admin_userslist:
    path: /users
    controller: ProjectUserBundle:Users:index

admin_useradd:
    path: /user/add
    defaults:
    controller: ProjectUserBundle:Users:add

admin_useredit:
    path: /user/edit/{id}
    defaults:
    controller: ProjectUserBundle:Users:edit

admin_usershow:
    path: /user/show/{id}
    defaults:
    controller: ProjectUserBundle:Users:show

php bin/console debug:router -> output

  homepage                   ANY      ANY      ANY    /
  _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}
  _wdt                       ANY      ANY      ANY    /_wdt/{token}
  _profiler_home             ANY      ANY      ANY    /_profiler/
  _profiler_search           ANY      ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results
  _profiler_open_file        ANY      ANY      ANY    /_profiler/open
  _profiler                  ANY      ANY      ANY    /_profiler/{token}
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css
  admin_userslist            ANY      ANY      ANY    /admin/users
  admin_useradd              ANY      ANY      ANY    /admin/user/add
  admin_useredit             ANY      ANY      ANY    /admin/user/edit/{id}
  admin_usershow             ANY      ANY      ANY    /admin/user/show/{id}
  admin_locations_index      ANY      ANY      ANY    /admin/locations/
  admin_location_add         ANY      ANY      ANY    /admin/locations/add

php bin/console debug:router admin_userslist -> output

+--------------+----------------------------------------------------------------+
| Property     | Value                                                          |
+--------------+----------------------------------------------------------------+
| Route Name   | admin_userslist                                                |
| Path         | /admin/users                                                   |
| Path Regex   | #^/admin/users$#sD                                             |
| Host         | ANY                                                            |
| Host Regex   |                                                                |
| Scheme       | ANY                                                            |
| Method       | ANY                                                            |
| Requirements | NO CUSTOM                                                      |
| Class        | Symfony\Component\Routing\Route                                |
| Defaults     | _controller: ProjectUserBundle:Users:index                     |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler        |
| Callable     | App\Project\UserBundle\Controller\UsersController::indexAction |
+--------------+----------------------------------------------------------------+

If i hit the example.com/admin/users/ I got this error -> See Title, Someone who knows whats wriong ?

Thank you!

1
What are you using as a web server? You seem to have a rather odd mixture of Symfony flex and old style routing. Consider commenting out the locations section just for grins. Do any of the other routes such as /admin/user/add work?Cerad
My web server atm is mamp.. Not a single route works with prefix /admin/..Mookum
Have you used security.yml to restrict some urls? If so, when you are not admin and try to access to admin route you will get a 404 error.Med
I do not use security atm. admin/users is a public pathMookum
Double check that your server is actually pointing to the correct project. I know it may seem unlikely but you could be editing one project while testing against a different one. Also consider using bin/console server:start for initial testing.Cerad

1 Answers

0
votes

In config/routes.yaml you write:

resource: '@ProjectUserBundle/Resources/config/routing.yml'

with .yml extension. But your file is routing.yaml, .yaml extension. Isnt it?