[sonata admin] argument "$code" of method

2. CREATING AN ADMINphp

按照這裏,在 AppBundle中的Controller建立了 CategoryAdmin 類,當運行html

php bin/console server:start

出現code

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 就啓動成功了server

最終的效果htm

相關文章
相關標籤/搜索