Skip to content

Commit

Permalink
[DependencyInjection] made some more tweak to the Doctrine extension
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 1, 2010
1 parent b58c685 commit b0614ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Expand Up @@ -49,14 +49,19 @@ public function dbalLoad($config)
$loader = new XmlFileLoader(__DIR__.'/xml/doctrine');
$configuration->merge($loader->load('dbal-1.0.xml'));

foreach (array('dbname', 'host', 'username', 'password') as $key)
foreach (array('dbname', 'host', 'username', 'password', 'path', 'port') as $key)
{
if (isset($config[$key]))
{
$configuration->setParameter('doctrine.dbal.'.$key, $config[$key]);
}
}

if (isset($config['options']))
{
$configuration->setParameter('doctrine.dbal.driver.options', $config['options']);
}

if (isset($config['driver']))
{
$class = $config['driver'];
Expand Down
Expand Up @@ -5,10 +5,14 @@
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="doctrine.dbal.dbname">null</parameter>
<parameter key="doctrine.dbal.user">root</parameter>
<parameter key="doctrine.dbal.password"></parameter>
<parameter key="doctrine.dbal.host">localhost</parameter>
<parameter key="doctrine.dbal.port">null</parameter>
<parameter key="doctrine.dbal.path">null</parameter>
<parameter key="doctrine.dbal.driver.class">Doctrine\DBAL\Driver\PDOMySql\Driver</parameter>
<parameter key="doctrine.dbal.driver.options" type="collection" />
<parameter key="doctrine.dbal.wrapper.class">Doctrine\DBAL\Connection</parameter>
<parameter key="doctrine.dbal.configuration.class">Doctrine\DBAL\Configuration</parameter>
<parameter key="doctrine.dbal.event_manager.class">Doctrine\Common\EventManager</parameter>
Expand All @@ -21,7 +25,10 @@
<argument key="user">%doctrine.dbal.user%</argument>
<argument key="password">%doctrine.dbal.password%</argument>
<argument key="host">%doctrine.dbal.host%</argument>
<argument key="port">%doctrine.dbal.port%</argument>
<argument key="path">%doctrine.dbal.path%</argument>
<argument key="driverClass">%doctrine.dbal.driver.class%</argument>
<argument key="driverOptions">%doctrine.dbal.driver.options%</argument>
<!--
<argument key="wrapperClass">%doctrine.dbal.wrapper.class%</argument>
//-->
Expand Down
Expand Up @@ -10,8 +10,11 @@
<xsd:complexType name="dbal">
<xsd:attribute name="dbname" type="xsd:string" />
<xsd:attribute name="host" type="xsd:string" />
<xsd:attribute name="port" type="xsd:integer" />
<xsd:attribute name="username" type="xsd:string" />
<xsd:attribute name="password" type="xsd:string" />
<xsd:attribute name="driver" type="xsd:string" />
<xsd:attribute name="options" type="xsd:string" />
<xsd:attribute name="path" type="xsd:string" />
</xsd:complexType>
</xsd:schema>

0 comments on commit b0614ef

Please sign in to comment.