Symfony2 CRUD Listview of Users Not Working

為{幸葍}努か 提交于 2019-12-12 04:59:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!