Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\CompilerPass;
  4.  
  5. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  6. use Symfony\Component\DependencyInjection\ContainerBuilder;
  7. use Symfony\Component\DependencyInjection\Definition;
  8. use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
  9.  
  10. class SessionCompilerPass implements CompilerPassInterface
  11. {
  12.     public function process(ContainerBuilder $container)
  13.     {
  14.         $fooBag = new Definition(AttributeBag::class, ['_foo']);
  15.         $fooBag->addMethodCall('setName', ['foo_bag']);
  16.  
  17.         $container->getDefinition('session')
  18.             ->addMethodCall('registerBag', [$fooBag]);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement