[sonata admin] argument "$code" of method

2. CREATING AN ADMIN

按照这里,在 AppBundle中的Controller创建了 CategoryAdmin 类,当运行

php bin/console server:start

出现

Cannot autowire service "AppBundle\Controller\CategoryAdmin": argument "$code" of method "Sonata\AdminBundle\Admin\AbstractAdmin::__construct()" has no  
   type-hint, you should configure its value explicitly. 

通过搜索资料,找到 Empty Dashboard Symfony3 sonata adminBundle 最后比对才发现,需要把 src/AppBundle/Controller/CategoryAdmin.php 放入到 src/AppBundle/Admin/CategoryAdmin.php
然后再运行 php bin/console server:start 就启动成功了

最终的效果

posted @ 2018-11-09 23:29  五毛钱的饼  阅读(410)  评论(0编辑  收藏  举报