Skip to content

Commit

Permalink
[DoctrineMongoDBBundle] BC-break: This removes the excess "connection…
Browse files Browse the repository at this point in the history
…s" and "document_managers" wrapper in XML. This was inconsistent and made normalization unnecesarily difficult.

Previously:

    <connections>
        <connection ...>
            <!-- .. -->
        </connection>
        <connection ...>
            <!-- .. -->
        </connection>
    </connections>

Now:

    <connection ...>
        <!-- .. -->
    </connection>
    <connection ...>
        <!-- .. -->
    </connection>

I believe this is more semantically correct, and it removes code that had to worry about this extra format and normalize it.
  • Loading branch information
weaverryan committed Mar 9, 2011
1 parent a135004 commit 42a0b22
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 45 deletions.
Expand Up @@ -208,14 +208,6 @@ protected function getDocumentManagers(array $config, ContainerBuilder $containe
if (count($config['document_managers'])) {
$configDocumentManagers = $config['document_managers'];

if (isset($config['document_managers']['document-manager'])) {
$config['document_managers']['document_manager'] = $config['document_managers']['document-manager'];
}

if (isset($config['document_managers']['document_manager']) && isset($config['document_managers']['document_manager'][0])) {
// Multiple document managers
$configDocumentManagers = $config['document_managers']['document_manager'];
}
foreach ($configDocumentManagers as $name => $documentManager) {
$documentManagers[isset($documentManager['id']) ? $documentManager['id'] : $name] = $documentManager;
}
Expand Down Expand Up @@ -287,10 +279,6 @@ protected function getConnections(array $config, ContainerBuilder $container)
$connections = array();
if (count($config['connections'])) {
$configConnections = $config['connections'];
if (isset($config['connections']['connection']) && isset($config['connections']['connection'][0])) {
// Multiple connections
$configConnections = $config['connections']['connection'];
}
foreach ($configConnections as $name => $connection) {
$connections[isset($connection['id']) ? $connection['id'] : $name] = $connection;
}
Expand Down
Expand Up @@ -13,21 +13,18 @@
proxy-namespace="Proxies"
auto-generate-proxy-classes="true"
>
<doctrine:connections>
<doctrine:connection id="conn1" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>
<doctrine:connection id="conn2" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>
</doctrine:connections>
<doctrine:document-managers>
<doctrine:document-manager id="dm1" metadata-cache-driver="xcache" connection="conn1" />
<doctrine:document-manager id="dm2" connection="conn2" />
</doctrine:document-managers>
<doctrine:connection id="conn1" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>
<doctrine:connection id="conn2" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>

<doctrine:document-manager id="dm1" metadata-cache-driver="xcache" connection="conn1" />
<doctrine:document-manager id="dm2" connection="conn2" />
</doctrine:mongodb>
</container>
Expand Up @@ -7,22 +7,21 @@
http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">

<doctrine:mongodb>
<doctrine:connections>
<doctrine:connection id="default" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>
</doctrine:connections>
<doctrine:document-managers>
<doctrine:document-manager id="default" connection="default">
<metadata-cache-driver type="memcache">
<class>Doctrine\Common\Cache\MemcacheCache</class>
<host>localhost</host>
<port>11211</port>
<instance-class>Memcache</instance-class>
</metadata-cache-driver>
</doctrine:document-manager>
</doctrine:document-managers>

<doctrine:connection id="default" server="mongodb://localhost:27017">
<options>
<connect>true</connect>
</options>
</doctrine:connection>

<doctrine:document-manager id="default" connection="default">
<metadata-cache-driver type="memcache">
<class>Doctrine\Common\Cache\MemcacheCache</class>
<host>localhost</host>
<port>11211</port>
<instance-class>Memcache</instance-class>
</metadata-cache-driver>
</doctrine:document-manager>

</doctrine:mongodb>
</container>

0 comments on commit 42a0b22

Please sign in to comment.