用户的Symfony2的CRUD列表视图不工作 [英] Symfony2 CRUD Listview of Users Not Working
问题描述
我创建实体的用户使用反向工程,并试图建立使用以下命令该实体控制器和视图: -
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
它没有问我要遏制写操作,配置格式和preFIX。一切都很好,控制器和视图下产生两个脚本。但是,当我拨打以下网址查看用户的列表页面,然后我得到的错误: -
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
错误
No route found for "GET /users"
这是否意味着一旦你生成CRUD,它不会在routing.yml中的实体或我思念的东西添加路线?
Does that mean once you generate CRUD, it does not add route for that entity in routing.yml or i am missing something?
推荐答案
您需要导入的routing.yml annoted路线:
You need to import annoted route in routing.yml :
user:
resource: "@AcmeDemoBundle/Controller/UserController.php"
type: annotation
然后做一个 PHP应用程序/控制台路由器:调试
来检查路由可用
这篇关于用户的Symfony2的CRUD列表视图不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!