Browse files

Extend configuration fo storages

  • Loading branch information...
1 parent 4df2055 commit 88b47e8369fe92eafe83f28d49e8f06fddbe12a2 @golovanov committed Jul 19, 2011
View
4 DependencyInjection/Configuration.php
@@ -62,9 +62,7 @@ private function addXmlEntityManagersSection(ArrayNodeDefinition $rootNode)
->prototype('array')
->treatNullLike(array())
->children()
- ->scalarNode('connection')->end()
->scalarNode('storage')->end()
- ->booleanNode('logging')->defaultValue($this->debug)->end()
->scalarNode('auto_mapping')->defaultFalse()->end()
->arrayNode('metadata_cache_driver')
->beforeNormalization()
@@ -122,7 +120,9 @@ private function addStoragesSection(ArrayNodeDefinition $rootNode)
->prototype('array')
->performNoDeepMerging()
->children()
+ ->scalarNode('type')->defaultValue('filesystem')->end()
->scalarNode('path')->defaultValue('%kernel.root_dir%/doctrine-oxm-storage')->end()
+ ->scalarNode('extension')->defaultValue('xml')->end()
->end()
->end()
->end()
View
14 DependencyInjection/DoctrineOXMExtension.php
@@ -202,12 +202,14 @@ protected function loadXmlEntityManagerMetadataCacheDriver(array $xmlEntityManag
protected function loadStorages(array $storages, ContainerBuilder $container)
{
foreach ($storages as $name => $storage) {
- $oxmStorageArgs = array(
- isset($connection['server']) ? $connection['server'] : null,
- isset($connection['options']) ? $connection['options'] : array(),
- new Reference(sprintf('doctrine.oxm.%s_configuration', $name))
- );
- $oxmStorageDef = new Definition('%doctrine.oxm.storage.class%', $oxmStorageArgs);
+ $oxmStorageType = $storage['type'];
+ $oxmStorageDef = new Definition(sprintf('%%doctrine.oxm.%s_storage.class%%', $oxmStorageType));
+
+
+ if ('filesystem' == $oxmStorageType) {
+ $oxmStorageDef->addArgument($storage['path']);
+ $oxmStorageDef->addArgument($storage['extension']);
+ }
$container->setDefinition(sprintf('doctrine.oxm.%s_storage', $name), $oxmStorageDef);
}
}
View
8 Resources/config/oxm.xml
@@ -5,11 +5,17 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
- <parameter key="doctrine.oxm.storage.class">Doctrine\OXM\Storage\FileSystemStorage</parameter>
+ <!-- base -->
+ <parameter key="doctrine.oxm.filesystem_storage.class">Doctrine\OXM\Storage\FileSystemStorage</parameter>
<parameter key="doctrine.oxm.configuration.class">Doctrine\OXM\Configuration</parameter>
<parameter key="doctrine.oxm.xml_entity_manager.class">Doctrine\OXM\XmlEntityManager</parameter>
+ <parameter key="doctrine.oxm.xml_marshaller.class">Doctrine\OXM\Marshaller\XmlMarshaller</parameter>
+ <parameter key="doctrine.oxm.annotations.namespace">Doctrine\OXM\Mapping\</parameter>
<parameter key="doctrine.oxm.event_manager.class">Doctrine\Common\EventManager</parameter>
+ <!-- storage -->
+ <parameter key="doctrine.oxm.storage.filesystem.class">Doctrine\OXM\Storage\FileSystemStorage</parameter>
+
<!-- proxies -->
<parameter key="doctrine.oxm.proxy_namespace">Proxies</parameter>
<parameter key="doctrine.oxm.proxy_dir">%kernel.cache_dir%/doctrine/oxm/Proxies</parameter>

0 comments on commit 88b47e8

Please sign in to comment.