2

应用程序.config.php :

'doctrine' => array(
     'connection' => array(
        // default connection name
        'orm_default' => array(
            'driverClass' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
            'params' => array(

                'driver'   => 'pdo_pgsql',
                'host'     => 'localhost',
                'port'     => '5432',
                'user'     => 'postgres',
                'password' => 'root',
                'dbname'   => 'thebasee',
            )
        )
    ),
   'driver' => array(
        __NAMESPACE__ . '_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
        ),
        'orm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
            )
        )
    )
),

模块.config.php:

 // Controllers in this module
'controller' => array(
    'classes' => array(
        'Account/Account' => 'Account\Controller\AccountController'
    ),
),

'doctrine' => array(
    'driver' => array(
        'orm_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
        ),
        'orm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Entity' => 'orm_driver'
            )
        ),
        'odm_driver' => array(
            'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',          
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Document')
        ),
        'odm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Document' => 'odm_driver'
            )
        )                   
    )
),

// Routes for this module
'router' => array(
    'routes' => array(
        'Account' => array(
            'type'    => 'segment',
            'options' => array(
                'route'    => '/account[/:action][/:id]',
                'constraints' => array(
                    'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    'id'     => '[0-9]+',
                ),
                'defaults' => array(
                    'controller' => 'Account/Account',
                    'action'     => 'index',
                ),
            ),
        ),
    ),
),    

// View setup for this module
'view_manager' => array(
    'template_path_stack' => array(
        'Account' => __DIR__ . '/../view',
    ),
),

现在,错误是:

/var/www/applicationDir/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:36 中的“找不到驱动程序”

安装了 postgresql 的驱动程序(另一个项目的工作正常)但是对于 MySql inst,并且在跟踪中我播种了这个:

/var/www/applicationDir/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(36): PDO->__construct('mysql:host=loca...', 'postgres', 'root ', 大批)

它似乎使用了 Mysql 驱动程序,但是为什么,如果我选择 Pg?!请帮忙。

4

0 回答 0