按照这里,在 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
就启动成功了
最终的效果
原文地址:https://www.cnblogs.com/fsong/p/9937694.html
时间: 2024-11-02 17:50:21