コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     if ($container->hasDefinition(self::MANAGER_SERVICE_ID)) {
         $managerDef = $container->getDefinition(self::MANAGER_SERVICE_ID);
         $configs = array();
         $configLoader = new CumulativeConfigLoader('oro_query_designer', new YamlCumulativeFileLoader('Resources/config/query_designer.yml'));
         $resources = $configLoader->load($container);
         foreach ($resources as $resource) {
             $config = $resource->data[Configuration::ROOT_NODE_NAME];
             $vendor = strtolower(substr($resource->bundleClass, 0, strpos($resource->bundleClass, '\\')));
             $this->updateLabelsOfFunctions($config, 'converters', $vendor);
             $this->updateLabelsOfFunctions($config, 'aggregates', $vendor);
             $configs[] = $config;
         }
         $filterTypes = [];
         $filters = $container->findTaggedServiceIds(self::TAG_NAME);
         foreach ($filters as $serviceId => $tags) {
             $attr = reset($tags);
             $managerDef->addMethodCall('addFilter', array($attr['type'], new Reference($serviceId)));
             $filterTypes[] = $attr['type'];
         }
         $processor = new Processor();
         $config = $processor->processConfiguration(new Configuration($filterTypes), $configs);
         $managerDef->replaceArgument(0, $config);
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_app_config', new YamlCumulativeFileLoader('Resources/config/oro/app.yml'));
     // original security config
     $securityConfig = null;
     $securityModified = false;
     if ($container->hasExtension('security')) {
         $securityConfig = $container->getExtensionConfig('security');
     }
     $resources = $configLoader->load();
     $extensions = $container->getExtensions();
     foreach ($resources as $resource) {
         foreach ($resource->data as $name => $config) {
             if (!empty($extensions[$name])) {
                 if ($name === 'security') {
                     $this->mergeConfigIntoOne($container, $name, $config);
                     $securityModified = true;
                 } else {
                     $container->prependExtensionConfig($name, $config);
                 }
             }
         }
     }
     // original security config has highest priority
     if ($securityConfig && $securityModified) {
         $this->mergeConfigIntoOne($container, 'security', reset($securityConfig));
     }
     $this->preparePostgreSql($container);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_layout', [new FolderingCumulativeFileLoader('{folder}', '[a-zA-Z][a-zA-Z0-9_\\-:]*', new YamlCumulativeFileLoader('Resources/views/layouts/{folder}/theme.yml')), new YamlCumulativeFileLoader('Resources/config/oro/layout.yml')]);
     $themesResources = $configLoader->load($container);
     $existThemePaths = [];
     foreach ($themesResources as $resource) {
         $existThemePaths[$resource->path] = true;
         $configs[] = $this->getThemeConfig($resource);
     }
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('block_types.yml');
     $loader->load('config_expressions.yml');
     if ($config['view']['annotations']) {
         $loader->load('view_annotations.yml');
         $this->addClassesToCompile(['Oro\\Bundle\\LayoutBundle\\EventListener\\LayoutListener']);
     }
     $container->setParameter('oro_layout.templating.default', $config['templating']['default']);
     if ($config['templating']['php']['enabled']) {
         $loader->load('php_renderer.yml');
         $container->setParameter('oro_layout.php.resources', $config['templating']['php']['resources']);
     }
     if ($config['templating']['twig']['enabled']) {
         $loader->load('twig_renderer.yml');
         $container->setParameter('oro_layout.twig.resources', $config['templating']['twig']['resources']);
     }
     $loader->load('theme_services.yml');
     if (isset($config['active_theme'])) {
         $container->setParameter('oro_layout.default_active_theme', $config['active_theme']);
     }
     $container->setParameter('oro_layout.debug', $config['debug']);
     $themeManagerDef = $container->getDefinition(self::THEME_MANAGER_SERVICE_ID);
     $themeManagerDef->replaceArgument(1, $config['themes']);
     $foundThemeLayoutUpdates = [];
     $updateFileExtensions = [];
     $updateLoaderDef = $container->getDefinition(self::UPDATE_LOADER_SERVICE_ID);
     foreach ($updateLoaderDef->getMethodCalls() as $methodCall) {
         if ($methodCall[0] === 'addDriver') {
             $updateFileExtensions[] = $methodCall[1][0];
         }
     }
     $updatesLoader = new CumulativeConfigLoader('oro_layout_updates_list', [new FolderContentCumulativeLoader('Resources/views/layouts/', -1, false, $updateFileExtensions)]);
     $resources = $updatesLoader->load($container);
     foreach ($resources as $resource) {
         /**
          * $resource->data contains data in following format
          * [
          *    'directory-where-updates-found' => [
          *       'found update absolute filename',
          *       ...
          *    ]
          * ]
          */
         $foundThemeLayoutUpdates = array_merge_recursive($foundThemeLayoutUpdates, $this->filterThemeLayoutUpdates($existThemePaths, $resource->data));
     }
     $container->setParameter('oro_layout.theme_updates_resources', $foundThemeLayoutUpdates);
     $this->addClassesToCompile(['Oro\\Bundle\\LayoutBundle\\EventListener\\ThemeListener']);
 }
コード例 #4
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $entitiesConfig = array();
     $titlesConfig = array();
     $configLoader = new CumulativeConfigLoader('oro_navigation', new YamlCumulativeFileLoader('Resources/config/navigation.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         // Merge menu from bundle configuration
         if (isset($resource->data[self::MENU_CONFIG_KEY])) {
             $this->mergeMenuConfig($entitiesConfig, $resource->data[self::MENU_CONFIG_KEY]);
         }
         // Merge titles from bundle configuration
         if (!empty($resource->data[self::TITLES_KEY])) {
             $titlesConfig = array_merge($titlesConfig, (array) $resource->data[self::TITLES_KEY]);
         }
     }
     // Merge menu from application configuration
     if (is_array($configs)) {
         foreach ($configs as $configPart) {
             $this->mergeMenuConfig($entitiesConfig, $configPart);
         }
     }
     // process configurations to validate and merge
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $entitiesConfig);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('content_providers.yml');
     $container->getDefinition('oro_menu.configuration_builder')->addMethodCall('setConfiguration', array($config));
     $container->getDefinition('oro_menu.twig.extension')->addMethodCall('setMenuConfiguration', array($config));
     $container->getDefinition('oro_navigation.title_config_reader')->addMethodCall('setConfigData', array($titlesConfig));
     $container->getDefinition('oro_navigation.title_service')->addMethodCall('setTitles', array($titlesConfig));
     $container->prependExtensionConfig($this->getAlias(), array_intersect_key($config, array_flip(['settings'])));
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_batch_jobs', new YamlCumulativeFileLoader('Resources/config/batch_jobs.yml'));
     $configLoader->registerResources($container);
     $this->processConfiguration(new Configuration(), $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
コード例 #6
0
ファイル: OroHelpExtension.php プロジェクト: Maksold/platform
 /**
  * Get a list of configs from all bundles
  *
  * @param ContainerBuilder $container
  * @return array
  */
 protected function getBundleConfigs(ContainerBuilder $container)
 {
     $result = [];
     $configLoader = new CumulativeConfigLoader('oro_help', new YamlCumulativeFileLoader('Resources/config/oro_help.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $result[] = $resource->data;
     }
     return $result;
 }
コード例 #7
0
ファイル: LoadPass.php プロジェクト: Maksold/platform
 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $classes = [];
     $configLoader = new CumulativeConfigLoader('oro_soap', new YamlCumulativeFileLoader('Resources/config/oro/soap.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $classes = array_merge($classes, $resource->data['classes']);
     }
     $container->getDefinition('oro_soap.loader')->addArgument(array_unique($classes));
 }
コード例 #8
0
 /**
  * Gets bundles side bar configuration
  *
  * @param ContainerBuilder $container
  * @return array
  */
 protected function getBundlesSettings(ContainerBuilder $container)
 {
     $result = array();
     $configLoader = new CumulativeConfigLoader('oro_sidebar', new FolderingCumulativeFileLoader('{folder}', '\\w+', new YamlCumulativeFileLoader('Resources/public/sidebar_widgets/{folder}/widget.yml')));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $result[basename(dirname($resource->path))] = $resource->data;
     }
     return $result;
 }
コード例 #9
0
 /**
  * @param ContainerBuilder   $container
  * @param ProcessorDecorator $processor
  * @param string             $scope
  *
  * @return array
  */
 protected function loadConfig(ContainerBuilder $container, ProcessorDecorator $processor, $scope)
 {
     $config = array();
     $alias = $scope === 'app' ? 'system' : $scope;
     $configLoader = new CumulativeConfigLoader(sprintf('oro_%s_configuration', $alias), new YamlCumulativeFileLoader(sprintf('Resources/config/%s_configuration.yml', $alias)));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $config = $processor->merge($config, $resource->data);
     }
     return $config;
 }
コード例 #10
0
 /**
  * Get array with assets from config files
  *
  * @param ContainerBuilder $container
  * @param array            $config
  * @return array
  */
 public function getBundlesAssetsConfiguration(ContainerBuilder $container, array $config)
 {
     $result = array('css_debug_groups' => $config['css_debug'], 'css_debug_all' => $config['css_debug_all'], 'css' => array());
     $configLoader = new CumulativeConfigLoader('oro_assetic', new YamlCumulativeFileLoader('Resources/config/assets.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         if (isset($resource->data['css'])) {
             $result['css'] = array_merge_recursive($result['css'], $resource->data['css']);
         }
     }
     return $result;
 }
コード例 #11
0
 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_app_config', new YamlCumulativeFileLoader('Resources/config/oro/liip_imagine.yml'));
     $resources = $configLoader->load();
     $extensions = $container->getExtensions();
     foreach ($resources as $resource) {
         foreach ($resource->data as $name => $config) {
             if (!empty($extensions[$name])) {
                 $container->prependExtensionConfig($name, $config);
             }
         }
     }
 }
コード例 #12
0
ファイル: SettingsPass.php プロジェクト: Maksold/platform
 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $settingsProvider = $container->getDefinition(self::SETTINGS_PROVIDER_ID);
     $configs = [];
     $configLoader = new CumulativeConfigLoader('oro_integration_settings', new YamlCumulativeFileLoader('Resources/config/integration_settings.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $configs[] = $resource->data[IntegrationConfiguration::ROOT_NODE_NAME];
     }
     $processor = new Processor();
     $config = $processor->processConfiguration(new IntegrationConfiguration(), $configs);
     $settingsProvider->replaceArgument(0, $config);
 }
コード例 #13
0
 /**
  * @param ContainerBuilder $container
  */
 protected function loadApiConfiguration(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_api', new YamlCumulativeFileLoader('Resources/config/oro/api.yml'));
     $resources = $configLoader->load($container);
     $apiConfig = [];
     foreach ($resources as $resource) {
         $apiConfig = $this->mergeApiConfiguration($resource, $apiConfig);
     }
     $apiConfig = $this->normalizeApiConfiguration($apiConfig);
     $configBagDef = $container->getDefinition('oro_api.config_bag');
     $configBagDef->replaceArgument(0, $apiConfig['config']);
     $exclusionProviderDef = $container->getDefinition('oro_api.entity_exclusion_provider.config');
     $exclusionProviderDef->replaceArgument(1, $apiConfig['exclusions']);
 }
コード例 #14
0
 /**
  * Collect datagrid configurations files and pass them to the configuration provider
  *
  * @param ContainerBuilder $container
  */
 protected function registerConfigFiles(ContainerBuilder $container)
 {
     if ($container->hasDefinition(self::PROVIDER_SERVICE_ID)) {
         $config = [];
         $configLoader = new CumulativeConfigLoader('oro_datagrid', new YamlCumulativeFileLoader('Resources/config/datagrid.yml'));
         $resources = $configLoader->load($container);
         foreach ($resources as $resource) {
             if (isset($resource->data[self::ROOT_PARAMETER]) && is_array($resource->data[self::ROOT_PARAMETER])) {
                 $config = ArrayUtil::arrayMergeRecursiveDistinct($config, $resource->data[self::ROOT_PARAMETER]);
             }
         }
         $configProviderDef = $container->getDefinition(self::PROVIDER_SERVICE_ID);
         $configProviderDef->replaceArgument(0, $config);
     }
 }
コード例 #15
0
 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_entity_extend', new YamlCumulativeFileLoader('Resources/config/entity_extend.yml'));
     $resources = $configLoader->load($container);
     $configs = [];
     foreach ($resources as $resource) {
         $configs[] = $resource->data['oro_entity_extend'];
     }
     $processor = new Processor();
     $config = $processor->processConfiguration(new EntityExtendConfiguration(), $configs);
     if ($container->hasDefinition(self::FIELD_TYPE_HELPER_SERVICE_ID)) {
         $fieldTypeHelperDef = $container->getDefinition(self::FIELD_TYPE_HELPER_SERVICE_ID);
         $fieldTypeHelperDef->replaceArgument(0, $config['underlying_types']);
     }
 }
コード例 #16
0
 /**
  * @param ContainerBuilder $container
  */
 protected function setLazyServicesByConfig(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_lazy_services', new YamlCumulativeFileLoader('Resources/config/oro/lazy_services.yml'));
     $lazyServices = array();
     foreach ($configLoader->load($container) as $resource) {
         if (!empty($resource->data['lazy_services']) && is_array($resource->data['lazy_services'])) {
             $lazyServices = array_merge($lazyServices, $resource->data['lazy_services']);
         }
     }
     foreach ($lazyServices as $serviceId) {
         if ($container->hasDefinition($serviceId)) {
             $container->getDefinition($serviceId)->setLazy(true);
         }
     }
 }
コード例 #17
0
 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_app_config', new YamlCumulativeFileLoader('Resources/config/oro/app.yml'));
     $resources = $configLoader->load();
     $extensions = $container->getExtensions();
     foreach ($resources as $resource) {
         foreach ($resource->data as $name => $config) {
             if (!empty($extensions[$name])) {
                 if ($name === 'security') {
                     $this->mergeConfigIntoOne($container, $name, $config);
                 } else {
                     $container->prependExtensionConfig($name, $config);
                 }
             }
         }
     }
 }
コード例 #18
0
ファイル: OroUIExtension.php プロジェクト: hugeval/platform
 /**
  * Loads configuration from placeholders.yml files
  *
  * @param ContainerBuilder $container
  * @return array
  */
 protected function loadPlaceholdersConfigs(ContainerBuilder $container)
 {
     $placeholders = [];
     $items = [];
     $configLoader = new CumulativeConfigLoader('oro_placeholders', new YamlCumulativeFileLoader('Resources/config/placeholders.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         if (isset($resource->data['placeholders'])) {
             $this->ensurePlaceholdersCompleted($resource->data['placeholders']);
             $placeholders = array_replace_recursive($placeholders, $resource->data['placeholders']);
         }
         if (isset($resource->data['items'])) {
             $items = array_replace_recursive($items, $resource->data['items']);
         }
     }
     return ['placeholders' => $placeholders, 'placeholder_items' => $items];
 }
コード例 #19
0
 /**
  * @return $this
  */
 public function readConfig()
 {
     if (!empty($this->config)) {
         return $this->getConfig();
     }
     $builder = new ContainerBuilder();
     $configLoader = new CumulativeConfigLoader(static::CONFIG_ID, new YamlCumulativeFileLoader(static::FILE_PATH));
     $resources = $configLoader->load($builder);
     $config = [];
     /** @var CumulativeResourceInfo $resourceInfo */
     foreach ($resources as $resourceInfo) {
         foreach ($resourceInfo->data['reports'] as $reportId => $reportConfig) {
             $config[$reportId] = $reportConfig;
         }
     }
     $this->config = $config;
     return $this;
 }
コード例 #20
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $dashboardConfigs = array();
     $configLoader = new CumulativeConfigLoader('oro_dashboard', new YamlCumulativeFileLoader('Resources/config/dashboard.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $dashboardConfigs[] = $resource->data['oro_dashboard_config'];
     }
     foreach ($configs as $config) {
         $dashboardConfigs[] = $config;
     }
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $dashboardConfigs);
     $this->prepareWidgets($config['widgets'], $config['widgets_configuration']);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $container->getDefinition('oro_dashboard.config_provider')->replaceArgument(0, $config);
 }
コード例 #21
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $chartConfigs = array();
     $mergedConfig = array();
     $configLoader = new CumulativeConfigLoader('jov_who_charted', new YamlCumulativeFileLoader('Resources/config/jov/who_charted.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $mergedConfig = array_replace_recursive($mergedConfig, $resource->data['jov_who_charted']);
     }
     foreach ($configs as $config) {
         $mergedConfig = array_replace_recursive($mergedConfig, $config);
     }
     $chartConfigs[] = $mergedConfig;
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $chartConfigs);
     $container->getDefinition('who.charted.config_provider')->replaceArgument(0, $config);
 }
コード例 #22
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $entitiesConfig = $titlesConfig = array();
     $configLoader = new CumulativeConfigLoader('oro_navigation', new YamlCumulativeFileLoader('Resources/config/navigation.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         // Merge menu from bundle configuration
         if (isset($resource->data[self::MENU_CONFIG_KEY])) {
             $this->mergeMenuConfig($entitiesConfig, $resource->data[self::MENU_CONFIG_KEY]);
         }
         // Merge titles from bundle configuration
         if (!empty($resource->data[self::TITLES_KEY])) {
             $titlesConfig = array_merge($titlesConfig, (array) $resource->data[self::TITLES_KEY]);
         }
         // Merge navigation elements node from bundle configuration
         if (!empty($resource->data[self::NAVIGATION_ELEMENTS_KEY])) {
             $this->appendConfigPart($entitiesConfig[self::MENU_CONFIG_KEY], $resource->data[self::NAVIGATION_ELEMENTS_KEY], self::NAVIGATION_ELEMENTS_KEY);
         }
     }
     // Merge menu from application configuration
     if (is_array($configs)) {
         foreach ($configs as $configPart) {
             $this->mergeMenuConfig($entitiesConfig, $configPart);
         }
     }
     // process configurations to validate and merge
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $entitiesConfig);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('content_providers.yml');
     $container->getDefinition('oro_menu.configuration_builder')->addMethodCall('setConfiguration', array($config));
     $container->getDefinition('oro_menu.twig.extension')->addMethodCall('setMenuConfiguration', array($config));
     $container->getDefinition('oro_navigation.title_config_reader')->addMethodCall('setConfigData', array($titlesConfig));
     $container->getDefinition('oro_navigation.title_provider')->addMethodCall('setTitles', array($titlesConfig));
     $container->getDefinition('oro_navigation.content_provider.navigation_elements')->replaceArgument(0, $config[self::NAVIGATION_ELEMENTS_KEY]);
     $container->prependExtensionConfig($this->getAlias(), array_intersect_key($config, array_flip(['settings'])));
     $this->addClassesToCompile(['Oro\\Bundle\\NavigationBundle\\Event\\AddMasterRequestRouteListener', 'Oro\\Bundle\\NavigationBundle\\Event\\RequestTitleListener']);
 }
コード例 #23
0
 /**
  * @param  array            $configs
  * @param  ContainerBuilder $container
  * @throws InvalidConfigurationException
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     // load entity search configuration from search.yml files
     $configPart = array();
     $ymlLoader = new YamlCumulativeFileLoader('Resources/config/search.yml');
     $configurationLoader = new CumulativeConfigLoader('oro_search', $ymlLoader);
     $engineResources = $configurationLoader->load($container);
     foreach ($engineResources as $resource) {
         $configPart += $resource->data;
     }
     // merge entity configuration with main configuration
     if (isset($configs[0]['entities_config'])) {
         $configs[0]['entities_config'] = array_merge($configPart, $configs[0]['entities_config']);
     } else {
         $configs[0]['entities_config'] = $configPart;
     }
     // parse and validate configuration
     $config = $this->processConfiguration(new Configuration(), $configs);
     // set configuration parameters to container
     $container->setParameter('oro_search.engine', $config['engine']);
     $container->setParameter('oro_search.engine_parameters', $config['engine_parameters']);
     $container->setParameter('oro_search.log_queries', $config['log_queries']);
     $container->setParameter('oro_search.realtime_update', $config['realtime_update']);
     $container->setParameter('oro_search.entities_config', $config['entities_config']);
     $container->setParameter('oro_search.twig.item_container_template', $config['item_container_template']);
     // load engine specific and general search services
     $serviceLoader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $serviceLoader->load('services.yml');
     $ymlLoader = new YamlCumulativeFileLoader('Resources/config/oro/search_engine/' . $config['engine'] . '.yml');
     $engineLoader = new CumulativeConfigLoader('oro_search', $ymlLoader);
     $engineResources = $engineLoader->load($container);
     if (!empty($engineResources)) {
         $resource = end($engineResources);
         $serviceLoader->load($resource->path);
     }
 }
コード例 #24
0
ファイル: EntityConfigPass.php プロジェクト: Maksold/platform
 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     $configManagerDefinition = $container->getDefinition(self::CONFIG_MANAGER_SERVICE);
     $configLoader = new CumulativeConfigLoader('oro_entity_config', new YamlCumulativeFileLoader('Resources/config/entity_config.yml'));
     $resources = $configLoader->load($container);
     $scopes = [];
     foreach ($resources as $resource) {
         if (!empty($resource->data['oro_entity_config'])) {
             foreach ($resource->data['oro_entity_config'] as $scope => $config) {
                 if (!empty($scopes[$scope])) {
                     $scopes[$scope] = array_merge_recursive($scopes[$scope], $config);
                 } else {
                     $scopes[$scope] = $config;
                 }
             }
         }
     }
     foreach ($scopes as $scope => $config) {
         $provider = new Definition('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider');
         $provider->setArguments([new Reference(self::CONFIG_MANAGER_SERVICE), $scope, $config]);
         $container->setDefinition('oro_entity_config.provider.' . $scope, $provider);
         $configManagerDefinition->addMethodCall('addProvider', array($provider));
     }
 }
コード例 #25
0
 /**
  * @param ContainerBuilder $container
  * @return array
  */
 protected function parseExternalConfigFiles(ContainerBuilder $container)
 {
     $result = ['name_format' => [], 'address_format' => [], 'locale_data' => [], 'currency_data' => []];
     $configLoader = new CumulativeConfigLoader('oro_locale', [new YamlCumulativeFileLoader('Resources/config/oro/name_format.yml'), new YamlCumulativeFileLoader('Resources/config/oro/address_format.yml'), new YamlCumulativeFileLoader('Resources/config/oro/locale_data.yml'), new YamlCumulativeFileLoader('Resources/config/oro/currency_data.yml')]);
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $result[$resource->name] = array_merge($result[$resource->name], $resource->data);
     }
     return $result;
 }
コード例 #26
0
 /**
  * @param ContainerBuilder   $container
  * @param ProcessorDecorator $processor
  *
  * @return array
  */
 protected function loadConfig(ContainerBuilder $container, ProcessorDecorator $processor)
 {
     $config = [];
     $configLoader = new CumulativeConfigLoader('oro_system_configuration', new YamlCumulativeFileLoader('Resources/config/system_configuration.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $config = $processor->merge($config, $resource->data);
     }
     return $config;
 }
 public function prepend(ContainerBuilder $container)
 {
     $loader = new CumulativeConfigLoader('diamante_distribution', new YamlCumulativeFileLoader('Resources/config/whitelist.yml'));
     $resources = $loader->load();
     $this->populateWhitelist($container, $resources);
 }
コード例 #28
0
 /**
  * Loads configuration of entity hidden fields
  *
  * @todo: declaration of hidden fields is a temporary solution (https://magecore.atlassian.net/browse/BAP-4142)
  *
  * @param ContainerBuilder $container
  */
 protected function loadHiddenFieldConfigs(ContainerBuilder $container)
 {
     $hiddenFieldConfigs = [];
     $configLoader = new CumulativeConfigLoader('oro_entity_hidden_fields', new YamlCumulativeFileLoader('Resources/config/oro/entity_hidden_fields.yml'));
     $resources = $configLoader->load($container);
     foreach ($resources as $resource) {
         $hiddenFieldConfigs = array_merge($hiddenFieldConfigs, $resource->data['oro_entity_hidden_fields']);
     }
     $container->setParameter('oro_entity.hidden_fields', $hiddenFieldConfigs);
 }
コード例 #29
0
 public function testLoadWhenResourceLoaderReturnsArray()
 {
     $bundle1 = new TestBundle1();
     $bundle1Dir = dirname((new \ReflectionClass($bundle1))->getFileName());
     $bundle2 = new TestBundle2();
     $bundle2Dir = dirname((new \ReflectionClass($bundle2))->getFileName());
     $resourceLoader = $this->getMock('Oro\\Component\\Config\\Loader\\CumulativeResourceLoader');
     $resource1 = new CumulativeResourceInfo(get_class($bundle1), 'res1', 'res1', []);
     $resource2 = new CumulativeResourceInfo(get_class($bundle1), 'res2', 'res2', []);
     $resourceLoader->expects($this->at(0))->method('load')->with(get_class($bundle1), $bundle1Dir)->will($this->returnValue([$resource1, $resource2]));
     $resource3 = new CumulativeResourceInfo(get_class($bundle2), 'res3', 'res3', []);
     $resourceLoader->expects($this->at(1))->method('load')->with(get_class($bundle2), $bundle2Dir)->will($this->returnValue($resource3));
     CumulativeResourceManager::getInstance()->clear()->setBundles(['TestBundle1' => get_class($bundle1), 'TestBundle2' => get_class($bundle2)]);
     $loader = new CumulativeConfigLoader('test', $resourceLoader);
     $result = $loader->load();
     $this->assertEquals([$resource1, $resource2, $resource3], $result);
 }