0
這必須是一個簡單的疏忽 - 爲什麼我的entity_menus參數被注入StoreController?Symfony 3 - FOSRestBundle - 注入對服務的依賴
這是我看到的錯誤:
Catchable Fatal Error: Argument 1 passed to AppBundle\Controller\Api\Admin\Common\StoreController::__construct() must be of the type array, none given
services.yml的相關部分
parameters:
entity_menus: [ 'manufacturers', 'vendors' ]
services:
app.admin.store_controller:
class: AppBundle\Controller\Api\Admin\Common\StoreController
arguments:
- '%entity_menus%'
的控制器:
class StoreController extends FOSRestController
{
private $entityMenus;
public function __construct(Array $entityMenus)
{
$this->entityMenus = $entityMenus;
}