Symfony\Component\DependencyInjection\ContainerBuilder::setProxyInstantiator PHP Method

setProxyInstantiator() public method

Sets the instantiator to be used when fetching proxies.
public setProxyInstantiator ( Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface $proxyInstantiator )
$proxyInstantiator Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface
    public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator)
    {
        $this->proxyInstantiator = $proxyInstantiator;
    }

Usage Example

Example #1
0
 /**
  * @param string $path path to grumphp.yml
  *
  * @return ContainerBuilder
  */
 public static function buildFromConfiguration($path)
 {
     $container = new ContainerBuilder();
     $container->setProxyInstantiator(new RuntimeInstantiator());
     // Add compiler passes:
     $container->addCompilerPass(new Compiler\ExtensionCompilerPass());
     $container->addCompilerPass(new Compiler\PhpParserCompilerPass());
     $container->addCompilerPass(new Compiler\TaskCompilerPass());
     $container->addCompilerPass(new RegisterListenersPass('event_dispatcher', 'grumphp.event_listener', 'grumphp.event_subscriber'));
     // Load basic service file + custom user configuration
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../../resources/config'));
     $loader->load('formatter.yml');
     $loader->load('linters.yml');
     $loader->load('parameters.yml');
     $loader->load('parsers.yml');
     $loader->load('services.yml');
     $loader->load('subscribers.yml');
     $loader->load('tasks.yml');
     $loader->load('util.yml');
     // Load grumphp.yml file:
     $filesystem = new Filesystem();
     if ($filesystem->exists($path)) {
         $loader->load($path);
     }
     // Compile configuration to make sure that tasks are added to the taskrunner
     $container->compile();
     return $container;
 }
All Usage Examples Of Symfony\Component\DependencyInjection\ContainerBuilder::setProxyInstantiator