Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeveloperTools fatal error when using named Adapters #46

Open
AdeMS opened this issue Mar 11, 2022 · 1 comment
Open

DeveloperTools fatal error when using named Adapters #46

AdeMS opened this issue Mar 11, 2022 · 1 comment
Labels
Bug Something isn't working

Comments

@AdeMS
Copy link

AdeMS commented Mar 11, 2022

Bug Report

Summary

I was using named Adapter in my database configuration as shown in https://docs.laminas.dev/tutorials/db-adapter/#configuring-named-adapters:

    'db' => [
        'adapters' => [
            'Application\Db\ApplicationAdapter' => [
                'driver' => 'Pdo',
                'dsn'    => 'mysql:dbname=database;host=localhost;charset=utf8',
                'username' => 'username',
                'password' => 'password',
            ],
        ],
    ],

But the Laminas\DeveloperTools module send a Fatal error that tells no 'driver' key present

Current behavior

`Fatal error: Uncaught Laminas\Db\Adapter\Exception\InvalidArgumentException: createDriver expects a "driver" key to be present inside the parameters in /domain/domain.name/vendor/laminas/laminas-db/src/Adapter/Adapter.php:276 
Stack trace: 
#0 /domain/domain.name/vendor/laminas/laminas-db/src/Adapter/Adapter.php(73): Laminas\Db\Adapter\Adapter->createDriver(Array) 
#1 /domain/domain.name/vendor/laminas/laminas-db/src/Adapter/AdapterServiceFactory.php(21): Laminas\Db\Adapter\Adapter->__construct(Array) 
#2 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(645): Laminas\Db\Adapter\AdapterServiceFactory->__invoke(Object(Laminas\ServiceManager\ServiceManager), 'Laminas\\Db\\Adap...', NULL) 
#3 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(218): Laminas\ServiceManager\ServiceManager->doCreate('Laminas\\Db\\Adap...') 
#4 /domain/domain.name/vendor/laminas/laminas-developer-tools/src/Module.php(221): Laminas\ServiceManager\ServiceManager->get('Laminas\\Db\\Adap...') 
#5 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(645): Laminas\DeveloperTools\Module->Laminas\DeveloperTools\{closure}(Object(Laminas\ServiceManager\ServiceManager), 'Laminas\\Develop...', NULL) 
#6 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(218): Laminas\ServiceManager\ServiceManager->doCreate('Laminas\\Develop...') 
#7 /domain/domain.name/vendor/laminas/laminas-developer-tools/src/Listener/ProfilerListener.php(75): Laminas\ServiceManager\ServiceManager->get('Laminas\\Develop...') 
#8 /domain/domain.name/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\DeveloperTools\Listener\ProfilerListener->onFinish(Object(Laminas\Mvc\MvcEvent)) 
#9 /domain/domain.name/vendor/laminas/laminas-eventmanager/src/EventManager.php(171): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent)) 
#10 /domain/domain.name/vendor/laminas/laminas-mvc/src/Application.php(364): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent)) 
#11 /domain/domain.name/vendor/laminas/laminas-mvc/src/Application.php(341): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent)) 
#12 /domain/domain.name/public/index.php(61): Laminas\Mvc\Application->run() 
#13 {main} 

Next Laminas\ServiceManager\Exception\ServiceNotCreatedException: Service with name "Laminas\Db\Adapter\AdapterInterface" could not be created. Reason: createDriver expects a "driver" key to be present inside the parameters in /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:652 
Stack trace: 
#0 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(218): Laminas\ServiceManager\ServiceManager->doCreate('Laminas\\Db\\Adap...') 
#1/domain/domain.name/vendor/laminas/laminas-developer-tools/src/Module.php(221): Laminas\ServiceManager\ServiceManager->get('Laminas\\Db\\Adap...') 
#2 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(645): Laminas\DeveloperTools\Module->Laminas\DeveloperTools\{closure}(Object(Laminas\ServiceManager\ServiceManager), 'Laminas\\Develop...', NULL) 
#3 /domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(218): Laminas\ServiceManager\ServiceManager->doCreate('Laminas\\Develop...') 
#4 /domain/domain.name/vendor/laminas/laminas-developer-tools/src/Listener/ProfilerListener.php(75): Laminas\ServiceManager\ServiceManager->get('Laminas\\Develop...') 
#5 /domain/domain.name/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\DeveloperTools\Listener\ProfilerListener->onFinish(Object(Laminas\Mvc\MvcEvent)) 
#6 /domain/domain.name/vendor/laminas/laminas-eventmanager/src/EventManager.php(171): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent)) 
#7 /domain/domain.name/vendor/laminas/laminas-mvc/src/Application.php(364): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent)) 
#8 /domain/domain.name/vendor/laminas/laminas-mvc/src/Application.php(341): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent)) 
#9/domain/domain.name/public/index.php(61): Laminas\Mvc\Application->run() 
#10 {main} thrown in/domain/domain.name/vendor/laminas/laminas-servicemanager/src/ServiceManager.php on line 652`

How to reproduce

Expected behavior

@AdeMS AdeMS added the Bug Something isn't working label Mar 11, 2022
@tokstar
Copy link

tokstar commented Nov 25, 2022

in development.config.php file.
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'],
replace '-' with '.' solved the problem for me.
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}.development.php'],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants