作者:devcodixi
项目:SonataFormatterBundl
/**
* @param ContainerBuilder $container
* @param string $code
* @param Definition $formatter
* @param array $extensions
*
* @return string
*/
public function createEnvironment(ContainerBuilder $container, $code, Definition $formatter, array $extensions)
{
$loader = new Definition('Twig_Loader_String');
$loader->setPublic(false);
$container->setDefinition(sprintf('sonata.formatter.twig.loader.%s', $code), $loader);
$loaderSelector = new Definition('Sonata\\FormatterBundle\\Twig\\Loader\\LoaderSelector', array(new Reference(sprintf('sonata.formatter.twig.loader.%s', $code)), new Reference('twig.loader')));
$loaderSelector->setPublic(false);
$env = new Definition('Twig_Environment', array($loaderSelector, array('debug' => false, 'strict_variables' => false, 'charset' => 'UTF-8')));
$env->setPublic(false);
$container->setDefinition(sprintf('sonata.formatter.twig.env.%s', $code), $env);
$sandboxPolicy = new Definition('Sonata\\FormatterBundle\\Twig\\SecurityPolicyContainerAware', array(new Reference('service_container'), $extensions));
$sandboxPolicy->setPublic(false);
$container->setDefinition(sprintf('sonata.formatter.twig.sandbox.%s.policy', $code), $sandboxPolicy);
$sandbox = new Definition('Twig_Extension_Sandbox', array($sandboxPolicy, true));
$sandbox->setPublic(false);
$container->setDefinition(sprintf('sonata.formatter.twig.sandbox.%s', $code), $sandbox);
$env->addMethodCall('addExtension', array(new Reference(sprintf('sonata.formatter.twig.sandbox.%s', $code))));
foreach ($extensions as $extension) {
$env->addMethodCall('addExtension', array(new Reference($extension)));
}
$lexer = new Definition('Twig_Lexer', array(new Reference(sprintf('sonata.formatter.twig.env.%s', $code)), array('tag_comment' => array('<#', '#>'), 'tag_block' => array('<%', '%>'), 'tag_variable' => array('<%=', '%>'))));
$lexer->setPublic(false);
$container->setDefinition(new Reference(sprintf('sonata.formatter.twig.lexer.%s', $code)), $lexer);
$env->addMethodCall('setLexer', array(new Reference(sprintf('sonata.formatter.twig.lexer.%s', $code))));
return sprintf('sonata.formatter.twig.env.%s', $code);
}
作者:larriereguiche
项目:DoctrineRepositoryBundl
public function testProcess()
{
// TEST 1
// must work with no tagged services
$containerBuilder = new ContainerBuilder();
$compilerPass = new RepositoryCompilerPass();
$compilerPass->process($containerBuilder);
// TEST 2
// must add repository tagged service into the repository pool
$containerBuilder = new ContainerBuilder();
$containerBuilder->setDefinition('lag.repository.repository_pool', new Definition());
$repository = new Definition();
$repository->addTag('doctrine.repository');
$containerBuilder->setDefinition('repository1', $repository);
$repository = new Definition();
$repository->addTag('doctrine.repository');
$containerBuilder->setDefinition('repository2', $repository);
$compilerPass = new RepositoryCompilerPass();
$compilerPass->process($containerBuilder);
$methodCalls = $containerBuilder->getDefinition('lag.repository.repository_pool')->getMethodCalls();
$this->assertCount(2, $methodCalls);
foreach ($methodCalls as $call) {
/** @var Reference $reference */
$reference = $call[1][0];
// test reference assignment
$this->assertEquals('add', $call[0]);
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $reference);
$this->assertTrue(in_array($reference->__toString(), ['repository1', 'repository2']));
}
}
作者:emgieze
项目:ElasticsearchBundl
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$analysis = $container->getParameter('es.analysis');
$connections = $container->getParameter('es.connections');
$managers = $container->getParameter('es.managers');
$collector = $container->get('es.metadata_collector');
foreach ($managers as $managerName => $manager) {
if (!isset($connections[$manager['connection']])) {
throw new InvalidConfigurationException('There is no ES connection with the name: ' . $manager['connection']);
}
$managerName = strtolower($managerName);
$connection = $connections[$manager['connection']];
$managerDefinition = new Definition($container->getParameter('es.manager.class'), [$managerName, $connection, $analysis, $manager]);
$managerDefinition->setFactory([new Reference('es.manager_factory'), 'createManager']);
$container->setDefinition(sprintf('es.manager.%s', $managerName), $managerDefinition);
// Make es.manager.default as es.manager service.
if ($managerName === 'default') {
$container->setAlias('es.manager', 'es.manager.default');
}
$mappings = $collector->getMappings($manager['mappings']);
// Building repository services.
foreach ($mappings as $repositoryType => $repositoryDetails) {
$repositoryDefinition = new Definition($container->getParameter('es.repository.class'), [$repositoryDetails['bundle'] . ':' . $repositoryDetails['class']]);
$repositoryDefinition->setFactory([new Reference(sprintf('es.manager.%s', $managerName)), 'getRepository']);
$repositoryId = sprintf('es.manager.%s.%s', $managerName, $repositoryType);
if (strtolower(substr($repositoryType, -8)) === 'document') {
$container->setAlias(sprintf('es.manager.%s.%s', $managerName, substr($repositoryType, 0, strlen($repositoryType) - 8)), $repositoryId);
}
$container->setDefinition($repositoryId, $repositoryDefinition);
}
}
}
作者:spomky-lab
项目:jose-bundl
/**
* {@inheritdoc}
*/
public function createDefinition(ContainerBuilder $container, array $config)
{
$definition = new Definition('Jose\\Object\\JWK');
$definition->setFactory([new Reference('jose.factory.jwk'), 'createFromKeyFile']);
$definition->setArguments([$config['path'], $config['password'], $config['additional_values']]);
return $definition;
}
作者:kinkinwe
项目:lhv
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$pool = $container->getDefinition('sonata.product.pool');
$calls = $pool->getMethodCalls();
$pool->setMethodCalls(array());
$map = array();
foreach ($calls as $method => $arguments) {
if ($arguments[0] !== '__hack') {
$pool->addMethodCall($arguments[0], $arguments[1]);
continue;
}
foreach ($arguments[1] as $code => $options) {
// define a new ProductDefinition
$definition = new Definition('Sonata\\Component\\Product\\ProductDefinition', array(new Reference($options['provider']), new Reference($options['manager'])));
$definition->setPublic(false);
$container->setDefinition($code, $definition);
$container->getDefinition($options['provider'])->addMethodCall('setCode', array($code));
$pool->addMethodCall('addProduct', array($code, new Reference($code)));
$map[$code] = $container->getDefinition($options['manager'])->getArgument(0);
$container->getDefinition($options['provider'])->addMethodCall('setBasketElementManager', array(new Reference('sonata.basket_element.manager')));
$container->getDefinition($options['provider'])->addMethodCall('setCurrencyPriceCalculator', array(new Reference('sonata.price.currency.calculator')));
$container->getDefinition($options['provider'])->addMethodCall('setProductCategoryManager', array(new Reference('sonata.product_category.product')));
$container->getDefinition($options['provider'])->addMethodCall('setProductCollectionManager', array(new Reference('sonata.product_collection.product')));
$container->getDefinition($options['provider'])->addMethodCall('setOrderElementClassName', array($container->getParameter('sonata.order.order_element.class')));
$container->getDefinition($options['provider'])->addMethodCall('setEventDispatcher', array(new Reference('event_dispatcher')));
if (array_key_exists('variations', $options)) {
$container->getDefinition($options['provider'])->addMethodCall('setVariationFields', array($options['variations']['fields']));
}
}
}
$container->getDefinition('sonata.product.subscriber.orm')->replaceArgument(0, $map);
}
作者:ingress
项目:behat-api-extensio
/**
* {@inheritdoc}
*/
public function load(ContainerBuilder $container, array $config)
{
$container->setDefinition(self::CLIENT_ID, new Definition('GuzzleHttp\\Client', [$config]));
$definition = new Definition('Ingresse\\Behat\\ApiExtension\\Context\\Initializer\\ApiClientInitializer', [new Reference(self::CLIENT_ID), $config]);
$definition->addTag(ContextExtension::INITIALIZER_TAG);
$container->setDefinition('ingresse_api.context_initializer', $definition);
}
作者:symedi
项目:symedi
/**
* @param type $modelName
* @return Definition
*/
private function createDefinition($modelName)
{
$definition = new Definition(SyliusTrackerListener::class);
$definition->addArgument(new Reference('symedit_analytics.tracker'));
$definition->addTag('kernel.event_listener', ['event' => sprintf('symedit.%s.%s', $modelName, ResourceActions::SHOW), 'method' => 'track']);
return $definition;
}
作者:webfactor
项目:symfony-application-test
/**
* Ensures that the creator returns null if a synthetic service is requested.
*/
public function testCreatorReturnsNullIfSyntheticServiceIsRequested()
{
$definition = new Definition();
$definition->setSynthetic(true);
$this->container->setDefinition('my.service', $definition);
$this->assertNull($this->creator->create('my.service'));
}
作者:kherg
项目:uuid-bundl
/**
* {@inheritdoc}
*/
protected function addDefinitions(ContainerBuilder $container, array $config)
{
$container->setParameter('kherge_uuid.serializer.uuid_handler.class', 'KHerGe\\Bundle\\UuidBundle\\Serializer\\UuidHandler');
$definition = new Definition('%kherge_uuid.serializer.uuid_handler.class%');
$definition->addTag('jms_serializer.subscribing_handler');
$container->setDefinition('kherge_uuid.serializer.uuid_handler', $definition);
}
作者:jackbrav
项目:symfony-sandbo
protected function isInlinableDefinition(ContainerBuilder $container, $id, Definition $definition)
{
if (!$definition->isShared()) {
return true;
}
if ($definition->isPublic()) {
return false;
}
$references = count(array_keys($container->getAliases(), $id, true));
foreach ($container->getDefinitions() as $cDefinition) {
if ($references > 1) {
break;
}
if ($this->isReferencedByArgument($id, $cDefinition->getArguments())) {
$references += 1;
continue;
}
foreach ($cDefinition->getMethodCalls() as $call) {
if ($this->isReferencedByArgument($id, $call[1])) {
$references += 1;
continue 2;
}
}
}
return $references <= 1;
}
作者:spomky-lab
项目:jose-bundl
/**
* {@inheritdoc}
*/
public function createDefinition(ContainerBuilder $container, array $config)
{
$definition = new Definition('Jose\\Object\\X5UJWKSet');
$definition->setFactory([new Reference('jose.factory.jwk'), 'createFromX5U']);
$definition->setArguments([$config['url'], $config['is_secured'], $config['cache'], $config['cache_ttl'], $config['is_https']]);
return $definition;
}
作者:kgilde
项目:pager-bundl
/**
* @param array $configs
* @param ContainerBuilder $container
*/
private function registerPagers(array $configs, ContainerBuilder $container)
{
$shouldDisableRedirector = true;
foreach ($configs as $name => $config) {
$serviceId = sprintf("%s.%s", self::PREFIX_PAGER, $name);
$definition = $container->register($serviceId, $container->getParameter('kg_pager.class'));
// Sets the default items per page for the given pager.
if (isset($config['per_page'])) {
$definition->addArgument($config['per_page']);
}
// Changes the strategy, if this pager should merge last two pages
// given the following threshold.
if (isset($config['merge']) && $config['merge'] > 0) {
$strategyDefinition = new Definition($container->getParameter('kg_pager.strategy.last_page_merged.class'));
$strategyDefinition->addArgument($config['merge']);
$definition->addArgument($strategyDefinition);
}
// Wraps the pager inside a request decorator to have it automatically
// infer the current page from the request.
if ($config['key']) {
$definition = $container->register($serviceId, $container->getParameter('kg_pager.request_decorator.class'))->setArguments(array($definition, new Reference('request_stack'), $config['key']));
}
if ($config['redirect']) {
$shouldDisableRedirector = false;
$definition = $container->register($serviceId, $container->getParameter('kg_pager.bounds_check_decorator.class'))->setArguments(array($definition));
if ($config['key']) {
$definition->addArgument($config['key']);
}
}
}
if ($shouldDisableRedirector) {
$container->removeDefinition('kg_pager.out_of_bounds_redirector');
}
}
作者:yahoojapa
项目:ConfigCacheBundl
/**
* @dataProvider processProvider
*/
public function testProcess($hasWarmer, $configIds)
{
$warmerId = 'yahoo_japan_config_cache.cache_warmer';
$container = new ContainerBuilder();
foreach ($configIds as $configId) {
$definition = new Definition($configId);
$definition->addTag(ConfigCache::TAG_CACHE_WARMER);
$container->setDefinition($configId, $definition);
}
if ($hasWarmer) {
$definition = new Definition($warmerId);
$container->setDefinition($warmerId, $definition);
}
$pass = new CacheWarmerPass();
$pass->process($container);
foreach ($configIds as $index => $configId) {
if ($hasWarmer) {
$calls = $container->getDefinition($warmerId)->getMethodCalls();
$this->assertTrue(isset($calls[$index][0]));
// method name
$this->assertSame('addConfig', $calls[$index][0]);
$this->assertTrue(isset($calls[$index][1][0]));
// argument
$this->assertEquals(new Reference($configId), $calls[$index][1][0]);
} else {
$this->assertFalse($container->hasDefinition($warmerId));
}
}
}
作者:HRc
项目:Behat-Laravel-Extensio
/**
* Load the initializer.
*
* @param ContainerBuilder $container
* @param HttpKernelInterface $app
*/
private function loadInitializer(ContainerBuilder $container, $app)
{
$definition = new Definition('Laracasts\\Behat\\Context\\KernelAwareInitializer', [$app]);
$definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, ['priority' => 0]);
$definition->addTag(ContextExtension::INITIALIZER_TAG, ['priority' => 0]);
$container->setDefinition('laravel.initializer', $definition);
}
作者:javiereguilu
项目:DoctrineCacheBundl
/**
* @param string $name
* @param array $config
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*
* @return \Symfony\Component\DependencyInjection\Reference
*/
private function getConnectionReference($name, array $config, ContainerBuilder $container)
{
if (isset($config['client_id'])) {
return new Reference($config['client_id']);
}
$parameters = array('scheme' => $config['scheme'], 'host' => $config['host'], 'port' => $config['port']);
if ($config['password']) {
$parameters['password'] = $config['password'];
}
if ($config['timeout']) {
$parameters['timeout'] = $config['timeout'];
}
if ($config['database']) {
$parameters['database'] = $config['database'];
}
$options = null;
if (isset($config['options'])) {
$options = $config['options'];
}
$clientClass = '%doctrine_cache.predis.client.class%';
$clientId = sprintf('doctrine_cache.services.%s_predis.client', $name);
$clientDef = new Definition($clientClass);
$clientDef->addArgument($parameters);
$clientDef->addArgument($options);
$clientDef->setPublic(false);
$container->setDefinition($clientId, $clientDef);
return new Reference($clientId);
}
作者:rageph
项目:notification-bundl
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$config = array();
foreach ($configs as $subConfig) {
$config = array_merge($config, $subConfig);
}
foreach ($config['email'] as $alias => $options) {
$optionId = sprintf('rage_notification.email.%s.message', $alias);
$optionDef = new Definition($container->getParameter('rage_notification.email_message.class'));
$optionDef->setShared(false);
$optionDef->addArgument(new Reference('mailer'));
$optionDef->addArgument(new Reference('templating'));
if (!empty($options['from'])) {
$optionDef->addMethodCall('setFrom', [$options['from']]);
}
if (!empty($options['reply_to'])) {
$optionDef->addMethodCall('setReplyTo', [$options['reply_to']]);
}
if (!empty($options['embed_images'])) {
$optionDef->addMethodCall('setEmbedImages', [$options['embed_images']['url'], $options['embed_images']['path']]);
}
if (!empty($options['template_path'])) {
$optionDef->addMethodCall('setTemplatePath', [$options['template_path']]);
}
if (!empty($options['css_file'])) {
$optionDef->addMethodCall('setCssFile', [$options['css_file']]);
}
$container->setDefinition($optionId, $optionDef);
if ($alias === 'default') {
$container->setAlias('rage_notification.email.message', $optionId);
}
}
}
作者:Avazanga
项目:Syliu
function it_processes_the_configuration_and_registers_services_per_variable(ContainerBuilder $container)
{
$variantFormType = new Definition('Some\\App\\Product\\Form\\ProductVariantType');
$variantFormType->setArguments(array('Some\\App\\Product\\Entity\\ProductVariant', '%sylius.validation_group.product_variant%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_variant'));
$container->setDefinition('sylius.form.type.product_variant', $variantFormType)->shouldBeCalled();
$variantChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\VariantChoiceType');
$variantChoiceFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_variant_choice'));
$container->setDefinition('sylius.form.type.product_variant_choice', $variantChoiceFormType)->shouldBeCalled();
$variantMatchFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\VariantMatchType');
$variantMatchFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_variant_match'));
$container->setDefinition('sylius.form.type.product_variant_match', $variantMatchFormType)->shouldBeCalled();
$optionFormType = new Definition('Some\\App\\Product\\Form\\OptionType');
$optionFormType->setArguments(array('Some\\App\\Product\\Entity\\Option', '%sylius.validation_group.product_option%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_option'));
$container->setDefinition('sylius.form.type.product_option', $optionFormType)->shouldBeCalled();
$optionChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionEntityChoiceType');
$optionChoiceFormType->setArguments(array('product', 'Some\\App\\Product\\Entity\\Option'))->addTag('form.type', array('alias' => 'sylius_product_option_choice'));
$container->setDefinition('sylius.form.type.product_option_choice', $optionChoiceFormType)->shouldBeCalled();
$optionValueFormType = new Definition('Some\\App\\Product\\Form\\OptionValueType');
$optionValueFormType->setArguments(array('Some\\App\\Product\\Entity\\OptionValue', '%sylius.validation_group.product_option_value%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_option_value'));
$container->setDefinition('sylius.form.type.product_option_value', $optionValueFormType)->shouldBeCalled();
$optionValueChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionValueChoiceType');
$optionValueChoiceFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_option_value_choice'));
$container->setDefinition('sylius.form.type.product_option_value_choice', $optionValueChoiceFormType)->shouldBeCalled();
$optionValueCollectionFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionValueCollectionType');
$optionValueCollectionFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_option_value_collection'));
$container->setDefinition('sylius.form.type.product_option_value_collection', $optionValueCollectionFormType)->shouldBeCalled();
$variables = array('product' => array('variable' => 'Some\\App\\Product\\Entity\\Product', 'option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType')));
$container->setParameter('sylius.variation.variables', $variables)->shouldBeCalled();
$userConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product' => array('variable' => 'Some\\App\\Product\\Entity\\Product', 'option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType'))));
$processedConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product_option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'product_option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'product_variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType')), 'validation_groups' => array('product_variant' => array('sylius'), 'product_option' => array('sylius'), 'product_option_value' => array('sylius')));
$this->process($userConfig, $container)->shouldReturn($processedConfig);
}
作者:syliu
项目:syliu
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$translatableEntityLocaleAssignerDefinition = new Definition(TranslatableEntityLocaleAssigner::class);
$translatableEntityLocaleAssignerDefinition->addArgument(new Reference('sylius.context.locale'));
$translatableEntityLocaleAssignerDefinition->addArgument(new Reference('sylius.translation_locale_provider'));
$container->setDefinition('sylius.translatable_entity_locale_assigner', $translatableEntityLocaleAssignerDefinition);
}
作者:hyrmedi
项目:KunstmaanBundlesCM
/**
* {@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('services.yml');
foreach ($config['actions'] as $key => $value) {
if ($value['max_number_by_ip']) {
$definition = new Definition('Kunstmaan\\VotingBundle\\EventListener\\Security\\MaxNumberByIpEventListener');
$definition->addArgument(new Reference('kunstmaan_voting.services.repository_resolver'));
$definition->addArgument($value['max_number_by_ip']);
$definition->addTag('kernel.event_listener', array('event' => 'kunstmaan_voting.' . lcfirst(ContainerBuilder::camelize($key)), 'method' => 'onVote', 'priority' => 100));
$container->setDefinition('kunstmaan_voting.security.' . $key . '.max_number_by_ip_event_listener', $definition);
}
}
$possibleActions = array('up_vote', 'down_vote', 'facebook_like', 'facebook_send', 'linkedin_share');
$votingDefaultValue = $config['voting_default_value'];
// If the user overwrites the voting_default_value in paramters file, we use this one
if ($container->hasParameter('voting_default_value')) {
$votingDefaultValue = $container->getParameter('voting_default_value');
}
// When no values are defined, initialize with defaults
foreach ($possibleActions as $action) {
if (!isset($config['actions'][$action]) || !is_array($config['actions'][$action])) {
$config['actions'][$action]['default_value'] = $action == 'down_vote' ? -1 * $votingDefaultValue : $votingDefaultValue;
}
}
$container->setParameter('kuma_voting.actions', $config['actions']);
}
作者:hostingnugget
项目:WhiteOctoberAdminBundl
/**
* Responds to the "white_october_admin" configuration parameter.
*
* @param array $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('admin.xml');
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->process($configuration->getConfigTree(), $configs);
// data managers
if (!empty($config['data_managers']['mandango'])) {
$loader->load('data_manager_mandango.xml');
}
if (!empty($config['data_managers']['doctrine']['orm'])) {
$loader->load('data_manager_doctrine_orm.xml');
}
if (!empty($config['data_managers']['doctrine']['odm'])) {
$loader->load('data_manager_doctrine_odm.xml');
}
// admins
$adminIds = array();
foreach ($config['admins'] as $admin) {
$definition = new Definition($admin['class']);
$definition->addMethodCall('setContainer', array(new Reference('service_container')));
$classId = str_replace('\\', '_', $admin['class']);
$adminId = 'white_october_admin.admin.' . $classId;
$container->setDefinition($adminId, $definition);
$adminIds[] = $adminId;
}
$container->getDefinition('white_october_admin.admin_factory')->replaceArgument(0, $adminIds);
}