问题
I created entity Users using reverse engineering and tried to create Controller and View from that entity using following command:-
$ php app/console generate:doctrine:crud --entity=AcmeDemoBundle:User --format=annotation
It did ask me to contain "write" action, configuration format and prefix. Everything went good and two scripts generated under Controller and Views. But when i call the below url to view the list page of users then i get error:-
http://localhost/Symfony/web/users
Error
No route found for "GET /users"
Does that mean once you generate CRUD, it does not add route for that entity in routing.yml or i am missing something?
回答1:
You need to import annoted route in routing.yml :
user:
resource: "@AcmeDemoBundle/Controller/UserController.php"
type: annotation
Then do a php app/console router:debug
to check that the routes are available.
来源:https://stackoverflow.com/questions/17855094/symfony2-crud-listview-of-users-not-working