gpt4 book ai didi

symfony - 将 Doctrine 实体管理器传递给服务

转载 作者:行者123 更新时间:2023-12-02 18:26:56 26 4
gpt4 key购买 nike

我想传递 Doctrine 实体管理器,以便我可以访问我的存储库等。但我遇到了一些麻烦。

我的服务已定义:

mlbp_beer.rest.controller:
class: MLBP\BeerBundle\Controller\RestController
arguments:
em: "@doctrine.orm.entity_manager"

这给了我一个错误:

ParameterNotFoundException: The service "mlbp_beer.rest.controller" has a dependency on a non-existent parameter "doctrine.orm.entity_manager".

感谢您的帮助!

最佳答案

看起来不错吧?确保在你的routing.yml中定义了rest,如下所示..也清除缓存!

rest:
resource: mlbp_beer.rest.controller
type: rest

关于symfony - 将 Doctrine 实体管理器传递给服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8337194/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com