简体   繁体   中英

Zend Framework 2 Doctrine 2 BJ Younglbood Profiler Reports Undefined index db

I'm setting up a new Zend Framework 2 Doctrine 2 app and have included BJ Youngblood's profiler. However, after including it, I now receive the error Undefined index: db in ProfilingAdapterFactory.php . My doctrine.local.php in /config/autoload contains all my database parameters. The contents of ProfilingAdapterFactory that have not been edited are as follows:

public function createService(ServiceLocatorInterface $serviceLocator)
{
    $config = $serviceLocator->get('Configuration');
    $dbParams = $config['db'];
    $adapter = new ProfilingAdapter($dbParams);

    $adapter->setProfiler(new Profiler);
    if (isset($dbParams['options']) && is_array($dbParams['options'])) {
        $options = $dbParams['options'];
    } else {
        $options = array();
    }
    $adapter->injectProfilingStatementPrototype($options);
    return $adapter;
}

How do I adjust the ProfiliingAdapterFactory.php to see the doctrine database parameters?

Youngblood's profiler is for Zend\\Db profiling. If you need a profiler for Doctrine ORM, it's already included in Doctrine ORM module for ZF2, so all you need to do, is install this module via composer as well as zend-developer-tools

"doctrine/doctrine-orm-module" : "0.*",
"zendframework/zend-developer-tools" : "dev-master",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM