vendor/sylius/resource-bundle/src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php line 51

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler;
  12. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. @trigger_error(sprintf('The "%s" class is deprecated since Sylius 1.8. Migrate your Pagerfanta configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle, the configuration bridge will be removed in Sylius 2.0.'PagerfantaBridgePass::class), \E_USER_DEPRECATED);
  15. /**
  16.  * Compiler pass to bridge the configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle
  17.  *
  18.  * @internal
  19.  */
  20. final class PagerfantaBridgePass implements CompilerPassInterface
  21. {
  22.     public function process(ContainerBuilder $container): void
  23.     {
  24.         $this->changeViewFactoryClass($container);
  25.         $this->aliasRenamedServices($container);
  26.     }
  27.     private function changeViewFactoryClass(ContainerBuilder $container): void
  28.     {
  29.         if (!$container->hasParameter('white_october_pagerfanta.view_factory.class') || !$container->hasDefinition('pagerfanta.view_factory')) {
  30.             return;
  31.         }
  32.         /** @var string $viewFactoryClass */
  33.         $viewFactoryClass $container->getParameter('white_october_pagerfanta.view_factory.class');
  34.         $container->getDefinition('pagerfanta.view_factory')
  35.             ->setClass($viewFactoryClass);
  36.     }
  37.     private function aliasRenamedServices(ContainerBuilder $container): void
  38.     {
  39.         if ($container->hasDefinition('pagerfanta.twig_extension')) {
  40.             $container->setAlias('twig.extension.pagerfanta''pagerfanta.twig_extension')
  41.                 ->setDeprecated(true'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.twig_extension" service ID instead.');
  42.         }
  43.         if ($container->hasDefinition('pagerfanta.view_factory')) {
  44.             $container->setAlias('white_october_pagerfanta.view_factory''pagerfanta.view_factory')
  45.                 ->setDeprecated(true'The "%alias_id%" service alias is deprecated since Sylius 1.8, use the "pagerfanta.view_factory" service ID instead.');
  46.         }
  47.     }
  48. }