modules/XC/ProductVariants/src/ProductVariantsBundle.php line 26

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2001-present X-Cart Holdings LLC. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. declare(strict_types=1);
  7. namespace XC\ProductVariants;
  8. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  9. use Symfony\Component\DependencyInjection\ContainerBuilder;
  10. use Symfony\Component\HttpKernel\Bundle\Bundle;
  11. use XC\ProductVariants\DependencyInjection\Compiler\AddCallForPriceFieldsForProductVariantPass;
  12. use XC\ProductVariants\DependencyInjection\Compiler\AddSaleFieldsForProductVariantPass;
  13. use XC\ProductVariants\DependencyInjection\Compiler\AddSystemFieldsForProductVariantPass;
  14. use XC\ProductVariants\DependencyInjection\Compiler\AddWholesaleFieldsForProductVariantPass;
  15. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductTransformerDecoratorBySaleBundlePass;
  16. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductVariantTransformerDecoratorBySaleBundlePass;
  17. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductTransformerDecoratorByCallForPriceBundlePass;
  18. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductVariantTransformerDecoratorByCallForPriceBundlePass;
  19. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductVariantTransformerDecoratorBySystemFieldsBundlePass;
  20. use XC\ProductVariants\DependencyInjection\Compiler\RegisterProductGetOneActionDecoratorByWholesaleBundlePass;
  21. final class ProductVariantsBundle extends Bundle
  22. {
  23.     public function build(ContainerBuilder $container): void
  24.     {
  25.         parent::build($container);
  26.         $bundles $container->getParameter('kernel.bundles');
  27.         if (isset($bundles['SaleBundle'])) {
  28.             $container->addCompilerPass(new AddSaleFieldsForProductVariantPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION710);
  29.             $container->addCompilerPass(new RegisterProductTransformerDecoratorBySaleBundlePass());
  30.             $container->addCompilerPass(new RegisterProductVariantTransformerDecoratorBySaleBundlePass());
  31.         }
  32.         if (isset($bundles['CallForPriceBundle'])) {
  33.             $container->addCompilerPass(new AddCallForPriceFieldsForProductVariantPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION710);
  34.             $container->addCompilerPass(new RegisterProductTransformerDecoratorByCallForPriceBundlePass());
  35.             $container->addCompilerPass(new RegisterProductVariantTransformerDecoratorByCallForPriceBundlePass());
  36.         }
  37.         if (isset($bundles['SystemFieldsBundle'])) {
  38.             $container->addCompilerPass(new AddSystemFieldsForProductVariantPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION710);
  39.             $container->addCompilerPass(new RegisterProductVariantTransformerDecoratorBySystemFieldsBundlePass());
  40.         }
  41.         if (isset($bundles['WholesaleBundle'])) {
  42.             $container->addCompilerPass(new AddWholesaleFieldsForProductVariantPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION710);
  43.             $container->addCompilerPass(new RegisterProductGetOneActionDecoratorByWholesaleBundlePass());
  44.         }
  45.     }
  46. }