Symfony的依赖注入模块,ServiceDefinitions在使用Extension时不会加载

时间:2018-02-28 20:01:09

标签: symfony symfony-3.4 symfony-dependency-injection

根据例子,我做的是正确的。

但是,定义是空的。

这些是我的设置:

services:
    form_manager:
        public: true
        alias: BI\GRV\Application\Services\FormManager\FormManager
    integration_layer_client:
        class: BI\GRV\Application\Services\IntegrationLayerClient\IntegrationLayerClient
        public: true

这是扩展文件的一部分

class IntegrationLayerClientExtension implements ExtensionInterface {

    public function load(array $configs, ContainerBuilder $container) {
        $configuration = new IntegrationLayerClientConfiguration();
        $processor = new Processor();
        $config = $processor->processConfiguration($configuration, $configs);
    dump($container->getDefinitions());
        $def = $container->findDefinition('integration_layer_client'); // Exception here
        #$def->replaceArgument(0, $config['twitter']['client_id']);
    #$def->replaceArgument(1, $config['twitter']['client_secret']);
    }
  

PHP致命错误:未捕获的异常   '的Symfony \元器件\ DependencyInjection \异常\ ServiceNotFoundException的'   消息'您已请求不存在的服务   “integration_layer_client”。”在   XXX \ PROYECTOS \ GRV \回购\ GRV核\厂商\ symfony的\依赖注入\ ContainerBuilder.php:1022

0 个答案:

没有答案