Get Symfony Container in an EntityRepository

后端 未结 5 1221
无人共我
无人共我 2020-12-15 11:56

I\'ve set a variable in parameters.ini, but now I want to retrieve that variable from an EntityRepository and $this->container is unset so I can\'t do it

5条回答
  •  青春惊慌失措
    2020-12-15 12:33

    If you really only need to pass an argument to the service, you can just pass it without needing a manager, like:

    services:
        your_service:
            class: YourServiceClass
            arguments: [%some.parameter%]
    

提交回复
热议问题