在获取ORM服务Zend Framework期间,学说连接失败



我似乎无法使用我的配置连接学说实体管理器。用户名和密码正确。

这是我的学说configuratuion config/autoload/global.php

'doctrine' => [
    'connection' => [
        'orm_default' => [
            'driverClass' => PDOMySqlDriver::class,
            'params' => [
                'host'     => 'localhost',
                'user'     => 'root',
                'password' => '',
                'dbname'   => 'callisto',
            ]
        ],
    ],
],

我从Zend Framework集成了DoctrineORMDoctrine模块。

我的问题是,当我在the onBootstrap method of Application/src/Module.php:

中编写此命令时
public function onBootstrap(MvcEvent $e)
{   
    $doctrineOrm = $e->getApplication()->getServiceManager()->get('doctrine.entitymanager.orm_default');
}

我有以下错误:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) in /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=loca...', 'username', 'password', Array) #1 /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(41): DoctrineDBALDriverPDOConnection->__construct('mysql:host=loca...', 'username', 'password', Array) #2 /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): DoctrineDBALDriverPDOMySqlDriver->connect(Array, 'username', 'password', Array) #3 /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): DoctrineDBALConnection->connect() #4 /var/www/html/pp/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): DoctrineDBALConnection->getDatabasePlatformVersion() #5 /var/www/html/pp/vendor/doctrine/dbal/lib in /var/www/html/pp/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 754

不确定问题是什么,也许我缺少配置?这是我的Application module config (module.config.php)

    'doctrine' => [
            'driver' => [
                    __NAMESPACE__ . '_driver' => [
                            'class' => AnnotationDriver::class,
                            'cache' => 'array',
                            'paths' => [__DIR__ . '/../src/Entity']
                    ],
                    'orm_default' => [
                            'drivers' => [
                                    __NAMESPACE__ . 'Entity' => __NAMESPACE__ . '_driver'
                            ]
                    ]
            ]
    ],

用户'用户名'@'localhost'(使用密码:yes)表示您没有数据库的正确用户和密码。

相关内容

  • 没有找到相关文章

最新更新