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


PHP Container::compile方法代码示例

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


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

示例1: testIsFrozen

 public function testIsFrozen()
 {
     $sc = new Container(new ParameterBag(array('foo' => 'bar')));
     $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen');
     $sc->compile();
     $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:ContainerTest.php

示例2: getDumpedContainer

 private function getDumpedContainer()
 {
     static $i = 0;
     $class = 'WebProfilerExtensionTestContainer' . $i++;
     $this->container->compile();
     $dumper = new PhpDumper($this->container);
     eval('?>' . $dumper->dump(array('class' => $class)));
     $container = new $class();
     $container->set('kernel', $this->kernel);
     return $container;
 }
开发者ID:nuwe1,项目名称:symfony,代码行数:11,代码来源:WebProfilerExtensionTest.php

示例3: getContainer

 /**
  * Returns ContainerBuilder by including the default file 'containerBuilder.php' from settings directory.
  *
  * @throws \RuntimeException
  */
 protected function getContainer()
 {
     if ($this->innerContainer instanceof ContainerInterface) {
         // Do nothing
     } elseif (!is_readable($this->innerContainer)) {
         throw new RuntimeException(sprintf("Unable to read file %s\n", $this->innerContainer));
     } else {
         // 'containerBuilder.php' file expects $installDir variable to be set by caller
         $installDir = $this->installDir;
         $this->innerContainer = (require_once $this->innerContainer);
     }
     // Compile container if necessary
     if ($this->innerContainer instanceof ContainerBuilder && !$this->innerContainer->isFrozen()) {
         $this->innerContainer->compile();
     }
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:21,代码来源:ServiceContainer.php

示例4: compile

 /**
  * Compiles the container.
  *
  * This method passes the container to compiler
  * passes whose job is to manipulate and optimize
  * the container.
  *
  * The main compiler passes roughly do four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is frozen;
  *  * Extension loading is disabled.
  */
 public function compile()
 {
     $compiler = $this->getCompiler();
     if ($this->trackResources) {
         foreach ($compiler->getPassConfig()->getPasses() as $pass) {
             $this->addObjectResource($pass);
         }
     }
     $compiler->compile($this);
     if ($this->trackResources) {
         foreach ($this->definitions as $definition) {
             if ($definition->isLazy() && ($class = $definition->getClass()) && class_exists($class)) {
                 $this->addClassResource(new \ReflectionClass($class));
             }
         }
     }
     $this->extensionConfigs = array();
     parent::compile();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:33,代码来源:ContainerBuilder.php

示例5: compile

 /**
  * Compiles the container.
  *
  * This method passes the container to compiler
  * passes whose job is to manipulate and optimize
  * the container.
  *
  * The main compiler passes roughly do four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is frozen;
  *  * Extension loading is disabled.
  *
  * @api
  */
 public function compile()
 {
     if (null === $this->compiler) {
         $this->compiler = new Compiler();
     }
     foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
         $this->addObjectResource($pass);
     }
     $this->compiler->compile($this);
     $this->extensionConfigs = array();
     parent::compile();
 }
开发者ID:hykz,项目名称:Depot,代码行数:28,代码来源:ContainerBuilder.php

示例6: compile

 /**
  * Compiles the container.
  *
  * This method passes the container to compiler
  * passes whose job is to manipulate and optimize
  * the container.
  *
  * The main compiler passes roughly do four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is frozen;
  *  * Extension loading is disabled.
  */
 public function compile()
 {
     $this->compiler->compile($this);
     $this->setExtensionConfigs(array());
     parent::compile();
 }
开发者ID:notbrain,项目名称:symfony,代码行数:20,代码来源:ContainerBuilder.php

示例7: compile

 /**
  * Compiles the container.
  *
  * This method passes the container to compiler
  * passes whose job is to manipulate and optimize
  * the container.
  *
  * The main compiler passes roughly do four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is frozen;
  *  * Extension loading is disabled.
  */
 public function compile()
 {
     $compiler = $this->getCompiler();
     if ($this->trackResources) {
         foreach ($compiler->getPassConfig()->getPasses() as $pass) {
             $this->addObjectResource($pass);
         }
     }
     $compiler->compile($this);
     $this->compiled = true;
     foreach ($this->definitions as $id => $definition) {
         if (!$definition->isPublic()) {
             $this->privates[$id] = true;
         }
         if ($this->trackResources && $definition->isLazy() && ($class = $definition->getClass()) && class_exists($class)) {
             $this->addClassResource(new \ReflectionClass($class));
         }
     }
     $this->extensionConfigs = array();
     $bag = $this->getParameterBag();
     parent::compile();
     $this->envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : array();
 }
开发者ID:kmiladi,项目名称:symfony,代码行数:37,代码来源:ContainerBuilder.php

示例8: createTranslator

 protected function createTranslator($em, $cacheDir)
 {
     $listener = new GetDatabaseResourcesListener($this->getORMStorage($em), 'xxxxx');
     $dispatcher = new EventDispatcher();
     $dispatcher->addListener('lexik_translation.event.get_database_resources', array($listener, 'onGetDatabaseResources'));
     $container = new Container();
     $container->set('event_dispatcher', $dispatcher);
     $container->compile();
     $loaderIds = array();
     $options = array('cache_dir' => $cacheDir);
     return new TranslatorMock($container, new MessageSelector(), $loaderIds, $options);
 }
开发者ID:StuartApp,项目名称:LexikTranslationBundle,代码行数:12,代码来源:TranslatorTest.php

示例9: compile

 /**
  * Compiles the container.
  *
  * This method passes the container to compiler
  * passes whose job is to manipulate and optimize
  * the container.
  *
  * The main compiler passes roughly do four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is frozen;
  *  * Extension loading is disabled.
  */
 public function compile()
 {
     if (null === $this->compiler) {
         $this->initializeCompiler();
     }
     $this->compiler->compile($this);
     $this->setExtensionConfigs(array());
     parent::compile();
 }
开发者ID:GromNaN,项目名称:GitWikiApp,代码行数:23,代码来源:ContainerBuilder.php

示例10: dumpContainer

 /**
  * Dump a container
  * @param Container $container
  * @param $class
  * @param $location
  * @param string $baseClass
  * @throws \RuntimeException
  */
 public static function dumpContainer(Container $container, $class, $location, $baseClass = 'Symfony\\Component\\DependencyInjection\\Container')
 {
     if (!file_exists($location)) {
         throw new RuntimeException('Dump location does not exist');
     }
     $container->compile();
     $dumper = new PhpDumper($container);
     file_put_contents(realpath($location) . "/{$class}.php", $dumper->dump(array('class' => $class, 'base_class' => $baseClass)));
 }
开发者ID:camspiers,项目名称:shared-dependency-injection,代码行数:17,代码来源:SharedContainerFactory.php


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