src/PHPDish/Bundle/PaymentBundle/DependencyInjection/PHPDishPaymentExtension.php
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');

        if (isset($config['youzan'])) {
            $container->setDefinition('phpdish.payment_gateway.youzan.api_context', new Definition(ApiContext::class, [
                $config['youzan']['client_id'],
                $config['youzan']['client_secret'],
                $config['youzan']['kdt_id']
            ]));
            if ($container->hasDefinition('phpdish.payment_gateway.youzan')) {
                $youzanPayDef = $container->getDefinition('phpdish.payment_gateway.youzan');
                $youzanPayDef->replaceArgument(0, new Reference('phpdish.payment_gateway.youzan.api_context'));
            }
        }

        //注册到资源管理
        $this->registerResources($config['resources'], $container);
        $this->registerResourcesConfiguration($config['resources'], $config['templates'], $config['templates_namespace'], $container);
    }
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');

        if (isset($config['youzan'])) {
            $container->setDefinition('phpdish.payment_gateway.youzan.api_context', new Definition(ApiContext::class, [
                $config['youzan']['client_id'],
                $config['youzan']['client_secret'],
                $config['youzan']['kdt_id']
            ]));
            if ($container->hasDefinition('phpdish.payment_gateway.youzan')) {
                $youzanPayDef = $container->getDefinition('phpdish.payment_gateway.youzan');
                $youzanPayDef->replaceArgument(0, new Reference('phpdish.payment_gateway.youzan.api_context'));
            }
        }

        //注册到资源管理
        $this->registerResources($config['resources'], $container);
        $this->registerResourcesConfiguration($config['resources'], $config['templates'], $config['templates_namespace'], $container);
    }
{@inheritdoc}