Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow DIC direct access to doctrine.oxm.xml_marshaller #1

Merged
merged 1 commit into from

2 participants

@richardfullmer
Collaborator

Allow DIC direct access to doctrine.oxm.xml_marshaller and set up default marshallers.

This was the only thing worth porting from OpensoftDoctrineOXMBundle you hadn't already
addressed.

@richardfullmer richardfullmer Allow DIC direct access to doctrine.oxm.xml_marshaller and set up def…
…ault marshallers.

This was the only thing worth porting from OpensoftDoctrineOXMBundle you hadn't already
addressed.
713af63
@richardfullmer
Collaborator

@golovanov - I can drop the OpensoftDoctrineOXMBundle after this pull request

@golovanov golovanov merged commit 1f6d116 into golovanov:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 24, 2011
  1. @richardfullmer

    Allow DIC direct access to doctrine.oxm.xml_marshaller and set up def…

    richardfullmer authored
    …ault marshallers.
    
    This was the only thing worth porting from OpensoftDoctrineOXMBundle you hadn't already
    addressed.
This page is out of date. Refresh to see the latest.
View
1  DependencyInjection/Configuration.php
@@ -42,6 +42,7 @@ public function getConfigTreeBuilder()
->scalarNode('proxy_dir')->defaultValue('%kernel.cache_dir%/doctrine/oxm/Proxies')->end()
->scalarNode('auto_generate_proxy_classes')->defaultFalse()->end()
->scalarNode('default_xml_entity_manager')->end()
+ ->scalarNode('default_xml_marshaller')->end()
->scalarNode('default_storage')->defaultValue('default')->end()
->end()
;
View
16 DependencyInjection/DoctrineOXMExtension.php
@@ -41,6 +41,11 @@ public function load(array $configs, ContainerBuilder $container)
$config['default_storage'] = reset($keys);
}
+ if (empty ($config['default_xml_marshaller'])) {
+ $keys = array_keys($config['xml_entity_managers']);
+ $config['default_xml_marshaller'] = reset($keys);
+ }
+
if (empty ($config['default_xml_entity_manager'])) {
$keys = array_keys($config['xml_entity_managers']);
$config['default_xml_entity_manager'] = reset($keys);
@@ -84,6 +89,7 @@ protected function loadXmlEntityManagers(array $xemConfigs, $defaultXEM, $defaul
);
}
$container->setParameter('doctrine.oxm.xml_entity_managers', array_keys($xemConfigs));
+ $container->setParameter('doctrine.oxm.xml_marshallers', array_keys($xemConfigs));
}
/**
@@ -151,12 +157,22 @@ protected function loadXmlEntityManager(array $xmlEntityManager, $defaultXEM, $d
$oxmXemDef->addTag('doctrine.oxm.xml_entity_manager');
$container->setDefinition(sprintf('doctrine.oxm.%s_xml_entity_manager', $xmlEntityManager['name']), $oxmXemDef);
+ // oxm marshaller
+ $oxmMarshallerDef = new Definition('%doctrine.oxm.xml_marshaller.class%');
+ $oxmMarshallerDef->setFactoryService(sprintf('doctrine.oxm.%s_xml_entity_manager', $xmlEntityManager['name']));
+ $oxmMarshallerDef->setFactoryMethod('getMarshaller');
+ $container->setDefinition(sprintf('doctrine.oxm.%s_xml_marshaller', $xmlEntityManager['name']), $oxmMarshallerDef);
+
if ($xmlEntityManager['name'] == $defaultXEM) {
$container->setAlias(
'doctrine.oxm.xml_entity_manager',
new Alias(sprintf('doctrine.oxm.%s_xml_entity_manager', $xmlEntityManager['name']))
);
$container->setAlias(
+ 'doctrine.oxm.xml_marshaller',
+ new Alias(sprintf('doctrine.oxm.%s_xml_marshaller', $xmlEntityManager['name']))
+ );
+ $container->setAlias(
'doctrine.oxm.event_manager',
new Alias(sprintf('doctrine.oxm.%s_event_manager', $xmlEntityManager['name']))
);
Something went wrong with that request. Please try again.