当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpDumper::setProxyDumper方法代码示例

本文整理汇总了PHP中Symfony\Component\DependencyInjection\Dumper\PhpDumper::setProxyDumper方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpDumper::setProxyDumper方法的具体用法?PHP PhpDumper::setProxyDumper怎么用?PHP PhpDumper::setProxyDumper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\DependencyInjection\Dumper\PhpDumper的用法示例。


在下文中一共展示了PhpDumper::setProxyDumper方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDumper

 protected function getDumper(SymfonyBuilder $container) : DumperInterface
 {
     $dumper = new PhpDumper($container);
     if (class_exists(ProxyDumper::class)) {
         $dumper->setProxyDumper(new ProxyDumper());
     }
     return $dumper;
 }
开发者ID:lcobucci,项目名称:di-builder,代码行数:8,代码来源:Compiler.php

示例2: testDumpContainerWithProxyService

 public function testDumpContainerWithProxyService()
 {
     $container = new ContainerBuilder();
     $container->register('foo', 'stdClass');
     $container->getDefinition('foo')->setLazy(true);
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumper->setProxyDumper(new ProxyDumper());
     $dumpedString = $dumper->dump();
     $this->assertStringMatchesFormatFile(__DIR__ . '/../Fixtures/php/lazy_service_structure.txt', $dumpedString, '->dump() does generate proxy lazy loading logic.');
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:11,代码来源:PhpDumperTest.php

示例3: dumpContainer

 /**
  * @param ContainerBuilder $container
  */
 protected function dumpContainer(ContainerBuilder $container)
 {
     $debug = $container->getParameter('debug');
     $randomId = mt_rand();
     $className = sprintf('dic_%d', $randomId);
     $containerFile = ROOT . 'cache/dic.php';
     $versionFile = ROOT . 'cache/dic.txt';
     $configFile = ROOT . 'cache/config.json';
     $dumper = new PhpDumper($container);
     $dumper->setProxyDumper(new ProxyDumper());
     $containerContent = $dumper->dump(['class' => $className, 'debug' => $debug]);
     file_put_contents($containerFile, $containerContent);
     file_put_contents($versionFile, $className);
     file_put_contents($configFile, json_encode($container->getParameterBag()->all(), JSON_PRETTY_PRINT));
     @chmod($containerFile, 0777);
     @chmod($versionFile, 0777);
     @chmod($configFile, 0777);
 }
开发者ID:brainexe,项目名称:core,代码行数:21,代码来源:Rebuild.php

示例4: dumpContainer

    /**
     * Dumps the service container to PHP code in the cache.
     *
     * @param ConfigCache      $cache     The config cache
     * @param ContainerBuilder $container The service container
     * @param string           $class     The name of the class to generate
     * @param string           $baseClass The name of the container's base class
     */
    protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
    {
        // cache the container
        $dumper = new PhpDumper($container);

        if (class_exists('ProxyManager\Configuration')) {
            $dumper->setProxyDumper(new ProxyDumper());
        }

        $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass));
        if (!$this->debug) {
            $content = static::stripComments($content);
        }

        $cache->write($content, $container->getResources());
    }
开发者ID:hendryguna,项目名称:laravel-basic,代码行数:24,代码来源:Kernel.php

示例5: dumpDrupalContainer

 /**
  * Dumps the service container to PHP code in the config directory.
  *
  * This method is based on the dumpContainer method in the parent class, but
  * that method is reliant on the Config component which we do not use here.
  *
  * @param ContainerBuilder $container
  *   The service container.
  * @param string $baseClass
  *   The name of the container's base class
  *
  * @return bool
  *   TRUE if the container was successfully dumped to disk.
  */
 protected function dumpDrupalContainer(ContainerBuilder $container, $baseClass)
 {
     if (!$this->storage()->writeable()) {
         return FALSE;
     }
     // Cache the container.
     $dumper = new PhpDumper($container);
     $dumper->setProxyDumper(new ProxyDumper(new ProxyBuilder()));
     $class = $this->getClassName();
     $namespace = $this->getClassNamespace();
     $content = $dumper->dump(['class' => $class, 'base_class' => $baseClass, 'namespace' => $namespace]);
     return $this->storage()->save($class . '.php', $content);
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:27,代码来源:DrupalKernel.php

示例6: dumpContainer

 /**
  * {@inheritdoc}
  */
 protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
 {
     // cache the container
     $dumper = new PhpDumper($container);
     if ($container->getParameter('installed') && class_exists('ProxyManager\\Configuration') && class_exists('Symfony\\Bridge\\ProxyManager\\LazyProxy\\PhpDumper\\ProxyDumper')) {
         $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
     }
     $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath()));
     if (!$this->debug) {
         $content = static::stripComments($content);
     }
     $cache->write($content, $container->getResources());
 }
开发者ID:antrampa,项目名称:platform,代码行数:16,代码来源:OroKernel.php

示例7: dumpContainer

 /**
  * {@inheritdoc}
  */
 protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
 {
     // cache the container
     $dumper = new PhpDumper($container);
     if ($container->getParameter('installed') && class_exists('ProxyManager\\Configuration')) {
         $dumper->setProxyDumper(new ProxyDumper());
     }
     $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass));
     $cache->write($content, $container->getResources());
     if (!$this->debug) {
         $cache->write(php_strip_whitespace($cache), $container->getResources());
     }
 }
开发者ID:northdakota,项目名称:platform,代码行数:16,代码来源:OroKernel.php

示例8: dumpContainer

    /**
     * Dumps the service container to PHP code in the cache.
     *
     * @param ConfigCache      $cache     The config cache
     * @param ContainerBuilder $container The service container
     * @param string           $class     The name of the class to generate
     * @param string           $baseClass The name of the container's base class
     */
    protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
    {
        // cache the container
        $dumper = new PhpDumper($container);

        if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
            $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
        }

        $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'debug' => $this->debug));

        $cache->write($content, $container->getResources());
    }
开发者ID:nwdrupal,项目名称:nwdrupalwebsite,代码行数:21,代码来源:Kernel.php

示例9: dumpContainer

 /**
  * Dumps the service container to PHP code in the cache
  *
  * @param \Symfony\Component\Config\ConfigCache $cache
  */
 protected function dumpContainer(ConfigCache $cache)
 {
     $dumper = new PhpDumper($this->innerContainer);
     if (class_exists('ProxyManager\\Configuration')) {
         $dumper->setProxyDumper(new ProxyDumper());
     }
     $content = $dumper->dump(array('class' => $this->containerClassName, 'base_class' => "Container"));
     $cache->write($content, $this->innerContainer->getResources());
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:ServiceContainer.php

示例10: dump_container

 /**
  * Dump the container to the disk.
  *
  * @param ConfigCache $cache The config cache
  */
 protected function dump_container($cache)
 {
     try {
         $dumper = new PhpDumper($this->container);
         $proxy_dumper = new ProxyDumper();
         $dumper->setProxyDumper($proxy_dumper);
         $cached_container_dump = $dumper->dump(array('class' => 'phpbb_cache_container', 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder'));
         $cache->write($cached_container_dump, $this->container->getResources());
     } catch (IOException $e) {
         // Don't fail if the cache isn't writeable
     }
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:17,代码来源:container_builder.php

示例11: dumpContainer

 /**
  * {@inheritdoc}
  */
 protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
 {
     // cache the container
     $dumper = new PhpDumper($container);
     if ($container->getParameter('installed') && class_exists('ProxyManager\\Configuration') && class_exists('Symfony\\Bridge\\ProxyManager\\LazyProxy\\PhpDumper\\ProxyDumper')) {
         $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
     }
     $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath()));
     $cache->write($content, $container->getResources());
     // we should not use parent::stripComments method to cleanup source code from the comments to avoid
     // memory leaks what generate token_get_all function.
     if (!$this->debug) {
         $cache->write(php_strip_whitespace($cache->getPath()), $container->getResources());
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:18,代码来源:OroKernel.php

示例12: dumpContainer

 /**
  * @param \Heystack\Core\DependencyInjection\SilverStripe\HeystackSilverStripeContainerBuilder $container
  * @param stirng $mode
  * @param bool|void $debug
  * @return string
  */
 protected function dumpContainer(HeystackSilverStripeContainerBuilder $container, $mode, $debug = false)
 {
     $container->compile();
     if ($debug) {
         $dumper = new YamlDumper($container);
         return $dumper->dump();
     } else {
         $location = $this->heystackBasePath . '/cache/';
         if (!file_exists($location)) {
             mkdir($location, 0777, true);
         }
         $class = "HeystackServiceContainer{$mode}";
         $dumper = new PhpDumper($container);
         if (class_exists('Symfony\\Bridge\\ProxyManager\\LazyProxy\\PhpDumper\\ProxyDumper')) {
             $dumper->setProxyDumper(new ProxyDumper());
         }
         file_put_contents($this->getRealPath($location) . "/{$class}.php", $dumper->dump(['class' => $class, 'base_class' => "Heystack\\Core\\DependencyInjection\\SilverStripe\\HeystackSilverStripeContainer"]));
         return 'Container generated';
     }
 }
开发者ID:helpfulrobot,项目名称:heystack-heystack,代码行数:26,代码来源:GenerateContainer.php

示例13: testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices

    public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices()
    {
        /*
         *   test graph:
         *              [connection] -> [event_manager] --> [entity_manager](lazy)
         *                                                           |
         *                                                           --(call)- addEventListener ("@lazy_service")
         *
         *              [lazy_service](lazy) -> [entity_manager](lazy)
         *
         */

        $container = new ContainerBuilder();

        $eventManagerDefinition = new Definition('stdClass');

        $connectionDefinition = $container->register('connection', 'stdClass');
        $connectionDefinition->addArgument($eventManagerDefinition);

        $container->register('entity_manager', 'stdClass')
            ->setLazy(true)
            ->addArgument(new Reference('connection'));

        $lazyServiceDefinition = $container->register('lazy_service', 'stdClass');
        $lazyServiceDefinition->setLazy(true);
        $lazyServiceDefinition->addArgument(new Reference('entity_manager'));

        $eventManagerDefinition->addMethodCall('addEventListener', array(new Reference('lazy_service')));

        $container->compile();

        $dumper = new PhpDumper($container);

        $dumper->setProxyDumper(new DummyProxyDumper());
        $dumper->dump();
    }
开发者ID:symfony,项目名称:symfony,代码行数:36,代码来源:PhpDumperTest.php


注:本文中的Symfony\Component\DependencyInjection\Dumper\PhpDumper::setProxyDumper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。