本文整理汇总了PHP中Symfony\Component\DependencyInjection\Loader\YamlFileLoader::load方法的典型用法代码示例。如果您正苦于以下问题:PHP YamlFileLoader::load方法的具体用法?PHP YamlFileLoader::load怎么用?PHP YamlFileLoader::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\Loader\YamlFileLoader
的用法示例。
在下文中一共展示了YamlFileLoader::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration(array(), $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
$loader->load('console.yml');
$loader->load('version_strategy.yml');
$loader->load('manifest.yml');
if ($config['livereload']['enabled']) {
$loader->load('livereload.yml');
$container->getDefinition($this->id('livereload.listener'))->addArgument($config['livereload']['url']);
}
$helper = Util::hasAssetComponent() ? new AssetExtensionHelper($this->getAlias(), $container, $loader) : new TemplatingExtensionHelper($this->getAlias(), $container, $loader);
if ($config['override_default_package']) {
$loader->load('fallback.yml');
$defaultPackage = $helper->createPackage('default', array('prefix' => $config['prefix'], 'manifest' => $config['manifest']));
$defaultPackageId = $helper->getPackageId('default');
$container->setDefinition($defaultPackageId, $defaultPackage);
$fallbackPackage = $helper->createFallbackPackage($config['fallback_patterns'], new Reference($defaultPackageId));
$container->setDefinition($this->id('package.fallback'), $fallbackPackage);
}
foreach ($config['packages'] as $name => $packageConfig) {
$package = $helper->createPackage($name, $packageConfig)->addTag($helper->getPackageTag(), array('alias' => $name));
$container->setDefinition($helper->getPackageId($name), $package);
}
}
示例2: load
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$loader->load('form_type.yml');
$this->addClassesToCompile(['Oro\\Bundle\\DataAuditBundle\\EventListener\\KernelListener']);
}
示例3: loadSerializerConfig
/**
* Load serializer related configuration
*
* @param array $configs
* @param ContainerBuilder $container
*/
protected function loadSerializerConfig(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/serializer'));
$loader->load('flat.yml');
$loader->load('serializer.yml');
$loader->load('structured.yml');
}
示例4: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load(sprintf('services.%s.yml', $config['db_driver']));
$container->setParameter($this->getAlias() . '.db_driver', $config['db_driver']);
$container->setParameter($this->getAlias() . '.model_manager_name', $config['model_manager_name']);
$container->setParameter($this->getAlias() . '.cronjob_class', $config['cronjob_class']);
$container->setParameter($this->getAlias() . '.cronjob_console', $config['cronjob_console']);
$container->setParameter($this->getAlias() . '.logs_path', $config['logs_path']);
if ('orm' === $config['db_driver']) {
$managerService = $this->getAlias() . '.entity_manager';
$doctrineService = 'doctrine';
} else {
$managerService = '';
$doctrineService = '';
}
$definition = $container->getDefinition($managerService);
if (method_exists($definition, 'setFactory')) {
$definition->setFactory(array(new Reference($doctrineService), 'getManager'));
} else {
$definition->setFactoryService($doctrineService);
$definition->setFactoryMethod('getManager');
}
$container->setAlias($this->getAlias() . '.manager', $config['crontab_manager']);
$definition = $container->getDefinition($config['crontab_manager']);
$definition->addMethodCall('registryConfigCronjobs', array($config['jobs']));
$loader->load('services.yml');
}
示例5: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('fixture_loader.yml');
$loader->load('services.yml');
$this->addInstallerDataFiles($container);
}
示例6: load
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$yamlloader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$yamlloader->load("form_extensions.yml");
if (isset($config['form'])) {
foreach ($config['form'] as $key => $value) {
if (is_array($value)) {
foreach ($config['form'][$key] as $subkey => $subvalue) {
$container->setParameter('mopa_bootstrap.form.' . $key . '.' . $subkey, $subvalue);
}
} else {
$container->setParameter('mopa_bootstrap.form.' . $key, $value);
}
}
}
if (isset($config['navbar'])) {
$yamlloader->load("navbar_extension.yml");
foreach ($config['navbar'] as $key => $value) {
$container->setParameter('mopa_bootstrap.navbar.' . $key, $value);
}
}
// set container parameters for Initializr base template
if (isset($config['initializr'])) {
// load Twig extension mapping config variables to Twig Globals
$yamlloader->load('twig_extensions.yml');
$container->setParameter('mopa_bootstrap.initializr.meta', $config['initializr']['meta']);
$container->setParameter('mopa_bootstrap.initializr.google', $config['initializr']['google']);
$container->setParameter('mopa_bootstrap.initializr.dns_prefetch', $config['initializr']['dns_prefetch']);
// TODO: think about setting this default as kernel debug,
// what about PROD env which does not need diagnostic mode and test
$container->setParameter('mopa_bootstrap.initializr.diagnostic_mode', $config['initializr']['diagnostic_mode']);
}
}
示例7: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$loader->load('slots.yml');
$loader->load('default_settings.yml');
if (isset($config['api_endpoint'])) {
$container->setParameter('ez_recommendation.api_endpoint', $config['api_endpoint']);
}
if (isset($config['recommender']['api_endpoint'])) {
$container->setParameter('ez_recommendation.recommender.api_endpoint', $config['recommender']['api_endpoint']);
}
if (isset($config['recommender']['consume_timeout'])) {
$container->setParameter('ez_recommendation.recommender.consume_timeout', $config['recommender']['consume_timeout']);
}
if (isset($config['tracking']['script_url'])) {
$container->setParameter('ez_recommendation.tracking.script_url', $config['tracking']['script_url']);
}
if (isset($config['tracking']['api_endpoint'])) {
$container->setParameter('ez_recommendation.tracking.api_endpoint', $config['tracking']['api_endpoint']);
}
$processor = new ConfigurationProcessor($container, 'ez_recommendation');
$processor->mapConfig($config, new ConfigurationMapper());
}
示例8: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('form_types.yml');
$loader->load('utility.yml');
$loader->load('filters.yml');
}
示例9: load
/**
* Loads a specific configuration.
*
* @param array $configs An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws \InvalidArgumentException When provided tag is not defined in this extension
*/
public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration(new Configuration(), $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('api.yml');
if ($container->hasParameter('kernel.environment') && $container->getParameter('kernel.environment') === 'test') {
$loader->load('test.yml');
}
$container->setParameter('bankiru_api.logger_id', $config['logger']['id']);
$container->setParameter('bankiru_api.profiler_enabled', $config['profiling']);
$configuration = $container->getDefinition('bankiru_api.configuration');
if ($config['cache']['enabled']) {
if (null === $config['cache']['service']) {
throw new \LogicException('You should specify PSR-6 cache service in order to enable caching');
}
$configuration->addMethodCall('setApiCache', [new Reference($config['cache']['service'])]);
if ($config['cache']['logger'] !== null) {
$configuration->addMethodCall('setApiCacheLogger', [new Reference($config['cache']['logger'])]);
}
}
foreach ($config['cache']['configuration'] as $class => $options) {
assert(array_key_exists('enabled', $options));
assert(array_key_exists('ttl', $options));
$configuration->addMethodCall('setCacheConfiguration', [$class, $options]);
}
}
示例10: load
/**
* load
*
* @see Extension
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services/pomm.yml');
$loader->load('services/profiler.yml');
$config = $this->configure($configs, $container);
}
示例11: load
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('readers.yml');
$loader->load('processors.yml');
$loader->load('writers.yml');
}
示例12: load
/** {@inheritdoc} */
public function load(array $config, ContainerBuilder $container)
{
// Load configuration
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('webpack.yml');
// Enable the request listener if we're running in dev.
if ($container->getParameter('kernel.environment') === 'dev') {
$loader->load('dev.yml');
}
// Retrieve all configuration entities
$builder_definition = $container->getDefinition('hostnet_webpack.bridge.config_generator');
$config_extension_ids = array_keys($container->findTaggedServiceIds('hostnet_webpack.config_extension'));
$config_definitions = [];
foreach ($config_extension_ids as $id) {
$config_definitions[$id] = $container->getDefinition($id);
}
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
$container->addResource(new FileResource((new \ReflectionClass(Configuration::class))->getFileName()));
// Select the correct node binary for the platform we're currently running on.
$config['node']['binary'] = $config['node']['binary'][$this->getPlatformKey()];
$config['node']['node_modules_path'] = !empty($config['node']['node_modules_path']) ? $config['node']['node_modules_path'] : getenv('NODE_PATH');
// Parse application config into the config generator
foreach ($config_definitions as $id => $definition) {
/* @var $definition Definition */
$builder_definition->addMethodCall('addExtension', [new Reference($id)]);
$definition->addArgument($config);
}
// Pass the configuration to a container parameter for the CompilerPass and profiler to read.
$container->setParameter('hostnet_webpack_config', $config);
}
示例13: load
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('twig_extensions.yml');
$loader->load('listeners.yml');
$loader->load('custom_letters.yml');
}
示例14: load
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('factories.yml');
$loader->load('repositories.yml');
$loader->load('updaters.yml');
}
示例15: load
public function load(array $configs, ContainerBuilder $container)
{
$locator = new FileLocator(__DIR__ . '/../Resources/config');
$loader = new YamlFileLoader($container, $locator);
$loader->load('services.yml');
$loader->load('parameters.yml');
}