[DependencyInjection] made some more tweak to the Doctrine extension
This commit is contained in:
parent
b58c685508
commit
b0614ef0e1
@ -49,7 +49,7 @@ class DoctrineExtension extends LoaderExtension
|
||||
$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]))
|
||||
{
|
||||
@ -57,6 +57,11 @@ class DoctrineExtension extends LoaderExtension
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['options']))
|
||||
{
|
||||
$configuration->setParameter('doctrine.dbal.driver.options', $config['options']);
|
||||
}
|
||||
|
||||
if (isset($config['driver']))
|
||||
{
|
||||
$class = $config['driver'];
|
||||
|
@ -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>
|
||||
@ -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>
|
||||
//-->
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user