本文整理匯總了PHP中Symfony\Component\DependencyInjection\ContainerInterface::compile方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContainerInterface::compile方法的具體用法?PHP ContainerInterface::compile怎麽用?PHP ContainerInterface::compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\DependencyInjection\ContainerInterface
的用法示例。
在下文中一共展示了ContainerInterface::compile方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: build
/**
* @return \Ikwattro\GithubEvent\EventHandler
*/
public function build()
{
$extension = new GithubEventExtension();
$this->serviceContainer->registerExtension($extension);
$this->serviceContainer->loadFromExtension($extension->getAlias(), $this->getConfiguration());
$this->serviceContainer->compile();
return $this;
}
示例2: loadConfigurations
protected function loadConfigurations($configFile)
{
$locator = new FileLocator('.');
$yaml = new YamlFileLoader($this->container, $locator);
$xml = new XmlFileLoader($this->container, $locator);
$delegatingLoader = new DelegatingLoader(new LoaderResolver(array($yaml, $xml)));
$delegatingLoader->load($configFile);
$this->container->compile();
}
示例3: build
/**
* @return \Neoxygen\Neogen\Neogen
*/
public function build()
{
$extension = new NeogenExtension();
$this->serviceContainer->registerExtension($extension);
$this->serviceContainer->loadFromExtension($extension->getAlias(), $this->getConfiguration());
$this->serviceContainer->compile();
$this->getParserManager()->registerParser(new YamlFileParser());
$this->getParserManager()->registerParser(new CypherPattern());
return $this;
}
示例4: boot
/**
* {@inheritdoc}
*/
public function boot()
{
if ($this->booted) {
return;
}
if (!$this->configCache->isFresh()) {
$this->container = $this->createContainerBuilder();
$this->container->compile();
$dumper = new PhpDumper($this->container);
$cache = $dumper->dump(['namespace' => __NAMESPACE__, 'class' => 'CachedContainer', 'file' => $this->configCache->getPath()]);
$this->configCache->write($cache, $this->container->getResources());
}
require_once $this->configCache->getPath();
$this->container = new CachedContainer();
$this->booted = true;
}
示例5: buildContainer
/**
* Builds the container with extensions
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws InvalidArgumentException
*/
private function buildContainer(InputInterface $input, OutputInterface $output)
{
$nonContainerCommands = ['blocks-install', 'blocks-update', 'blocks-dumpautoload', 'help'];
if (in_array($input->getFirstArgument(), $nonContainerCommands)) {
return;
}
$this->container = new ContainerBuilder($this, $input, $output);
$this->container->compile();
}
示例6: build_container
/**
* Build dependency injection container
*
* @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built
*/
protected function build_container()
{
// If the container has been already built just return.
// Although this should never happen
if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) {
return;
}
// Check whether container can be built
// We need config.php for that so let's check if it has been set up yet
if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) {
throw new cannot_build_container_exception();
}
$phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext);
$phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext);
// For BC with functions that we need during install
global $phpbb_container, $table_prefix;
$disable_super_globals = $this->request->super_globals_disabled();
// This is needed because container_builder::get_env_parameters() uses $_SERVER
if ($disable_super_globals) {
$this->request->enable_super_globals();
}
$other_config_path = $this->phpbb_root_path . 'install/update/new/config';
$config_path = is_dir($other_config_path) ? $other_config_path : $this->phpbb_root_path . 'config';
$this->container = $phpbb_container_builder->with_environment('production')->with_config($phpbb_config_php_file)->with_config_path($config_path)->without_cache()->without_compiled_container()->get_container();
// Setting request is required for the compatibility globals as those are generated from
// this container
$this->container->register('request')->setSynthetic(true);
$this->container->set('request', $this->request);
$this->container->register('language')->setSynthetic(true);
$this->container->set('language', $this->language);
// Replace cache service, as config gets cached, and we don't want that when we are installing
if (!is_dir($other_config_path)) {
$this->container->register('cache.driver')->setSynthetic(true);
$this->container->set('cache.driver', new dummy());
}
$this->container->compile();
$phpbb_container = $this->container;
$table_prefix = $phpbb_config_php_file->get('table_prefix');
// Restore super globals to previous state
if ($disable_super_globals) {
$this->request->disable_super_globals();
}
// Get compatibilty globals and constants
$this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext);
$this->update_helper->include_file('includes/constants.' . $this->php_ext);
}
示例7: initializeContainer
/**
* Initialize the container
*/
protected function initializeContainer($config)
{
$this->container = $this->buildContainer($config);
$this->container->compile();
}