addShopwareConfig example


        $loader = new XmlFileLoader($containernew FileLocator(__DIR__ . '/Components/DependencyInjection/'));
        $loader->load('services.xml');
        $loader->load('theme.xml');
        $loader->load('logger.xml');
        $loader->load('commands.xml');

        if (is_file($file = __DIR__ . '/Components/DependencyInjection/services_local.xml')) {
            $loader->load($file);
        }

        $this->addShopwareConfig($container, 'shopware', $this->config);
        $this->addResources($container);

        $container->addCompilerPass(new EventListenerCompilerPass(), PassConfig::TYPE_BEFORE_REMOVING);
        $container->addCompilerPass(new EventSubscriberCompilerPass(), PassConfig::TYPE_BEFORE_REMOVING);
        $container->addCompilerPass(new DoctrineEventSubscriberCompilerPass());
        $container->addCompilerPass(new FormPass());
        $container->addCompilerPass(new AddConstraintValidatorsPass());
        $container->addCompilerPass(new StaticResourcesCompilerPass());
        $container->addCompilerPass(new AddConsoleCommandPass());
        $container->addCompilerPass(new ConfigureContainerAwareCommands());
        $container->addCompilerPass(new LegacyApiResourcesPass());
        
/** * {@inheritdoc} */
    public function getAlias(): string
    {
        return self::ALIAS;
    }

    public function load(array $configs, ContainerBuilder $container): void
    {
        $config = $this->processConfiguration(new Configuration()$configs);
        $this->addShopwareConfig($container$this->getAlias()$config);
    }

    private function addShopwareConfig(ContainerBuilder $container, string $alias, array $options): void
    {
        foreach ($options as $key => $option) {
            $key = $alias . '.' . $key;
            $container->setParameter($key$option);

            /* * The route cache in dev mode checks on each request if its fresh. If you use the following expression * `defaults={"auth_required"="%shopware.api.api_browser.auth_required%"}` it also checks if the parameter * matches the value in the container. The expression always results in a string, but the value in the * container is a boolean. So they never match. To workaround this, we add this as an additional string * parameter. So in the dynamic use case you have to use `defaults={"auth_required"="%shopware.api.api_browser.auth_required_str%"}` */
Home | Imprint | This part of the site doesn't use cookies.