Move Symfony2 service config to bundle

后端 未结 3 909
有刺的猬
有刺的猬 2021-01-31 04:59

I have the following in my config.yml

services:
    my.user_provider:
        class: Acme\\MySecurityBundle\\Security\\UserProvider

but would l

3条回答
  •  孤街浪徒
    2021-01-31 05:27

    You need to create a class in that bundle called an 'extension' that tells Symfony what to do when loading the bundle. The naming convention is a little weird. For Acme\MySecurityBundle, the class will be named AcmeMySecurityExtension. It lives in {bundlepath}/DependencyInjection.

    Here is an example of one of mine (I am loading Resources/config/services.xml):

    load('services.xml');
        }
    }
    

提交回复
热议问题