Symfony 3 - FOSRestBundle - 将依赖注入服务

Symfony 3 - FOSRestBundle - Inject Dependency into Service

这一定是一个简单的疏忽 - 为什么我的 entity_menus 参数没有被注入 StoreController?

这是我看到的错误:

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;
    }

我像这样更新了services.yml来设置服务容器:

app.admin.store_controller:
    class: AppBundle\Controller\Api\Admin\Common\StoreController
    arguments: ['%entity_menus%']
    calls:
        - [setContainer, ["@service_container"]]

感谢:

我更新了 routing_rest.yml 以使用服务名称和 class:

app_admin_common_store_menu:
    type:     rest
    class: AppBundle\Controller\Api\Admin\Common\StoreController
    resource: app.admin.store_controller
    name_prefix:   app_admin_api_store_
    prefix: /api/store

感谢:https://github.com/FriendsOfSymfony/FOSRestBundle/issues/990