AssetBundleRegistrationCompilerPass example

Framework::class,
            FrameworkBundle::class,
        ]);

        $service = new Definition(Packages::class);
        $service->setPublic(true);
        $container->setDefinition('assets.packages', $service);

        $container->setDefinition('shopware.asset.asset_without_versioning', new Definition(Package::class));
        $container->setDefinition('shopware.asset.asset.version_strategy', new Definition(EmptyVersionStrategy::class));

        $compilerPass = new AssetBundleRegistrationCompilerPass();

        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $container->set('shopware.asset.asset_without_versioning', $this->createMock(Package::class));

        /** @var Packages $assetService */
        $assetService = $container->get('assets.packages');

        $assetService->getPackage('@Framework');

        
// make sure to remove services behind a feature flag, before some other compiler passes may reference them, therefore the high priority         $container->addCompilerPass(new FeatureFlagCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1000);
        $container->addCompilerPass(new EntityCompilerPass());
        $container->addCompilerPass(new MigrationCompilerPass(), PassConfig::TYPE_AFTER_REMOVING);
        $container->addCompilerPass(new ActionEventCompilerPass());
        $container->addCompilerPass(new DisableTwigCacheWarmerCompilerPass());
        $container->addCompilerPass(new DefaultTransportCompilerPass());
        $container->addCompilerPass(new TwigLoaderConfigCompilerPass());
        $container->addCompilerPass(new TwigEnvironmentCompilerPass());
        $container->addCompilerPass(new RouteScopeCompilerPass());
        $container->addCompilerPass(new AssetRegistrationCompilerPass());
        $container->addCompilerPass(new AssetBundleRegistrationCompilerPass());
        $container->addCompilerPass(new FilesystemConfigMigrationCompilerPass());
        $container->addCompilerPass(new RateLimiterCompilerPass());
        $container->addCompilerPass(new IncrementerGatewayCompilerPass());
        $container->addCompilerPass(new RedisPrefixCompilerPass());
        $container->addCompilerPass(new AutoconfigureCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1000);

        if ($container->getParameter('kernel.environment') === 'test') {
            $container->addCompilerPass(new DisableRateLimiterCompilerPass());
            $container->addCompilerPass(new ContainerVisibilityCompilerPass());
        }

        
Home | Imprint | This part of the site doesn't use cookies.