Doctrine2 - 如何添加自定义DBAL驱动程序?

时间:2017-10-14 12:23:56

标签: symfony doctrine-orm odbc dbal

在我的symfony 3.3.2项目中,我想使用odbc sage连接到sage数据库。 我创建了一个名为GestCom_Sage100的新dsn。

我尝试使用symfony连接到此dataSource,但我收到此错误:

The given 'driver' SAGE Gestion commeriale 100 is unknown, Doctrine currently 
supports only the following drivers: pdo_mysql, pdo_sqlite, pdo_pgsql, 
pdo_oci, oci8, ibm_db2, pdo_sqlsrv, mysqli, drizzle_pdo_mysql, sqlanywhere, 
sqlsrv

这是我的config.yml:

# Doctrine Configuration
doctrine:
dbal:
    default_connection: default
    connections:
        default:
            driver: pdo_pgsql
            host: '%database_host%'
            port: '%database_port%'
            dbname: '%database_name%'
            user: '%database_user%'
            password: '%database_password%'
            charset: UTF8                
        sage:
            driver: SAGE Gestion commeriale 100
            host: 'localhost'
            dbname: 'GestCom_Sage100'
            user: '****'
            password: '*****'

甚至Doctrine2文档enter image description here

1 个答案:

答案 0 :(得分:-1)

# Doctrine Configuration
doctrine:
    dbal:
        driver:         YOUR_DRIVER
        driver_class:  YOUR_DRIVER_CLASS_NAMESPACE