Error the database

Home Forums Learn ZF2 Error the database

This topic contains 6 replies, has 4 voices, and was last updated by  matt 4 years, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #229

    This is the error after:

    git checkout ‘ch-database-tablegateway’

    Notice: Undefined index: db in /var/www/learnzf2/module/User/src/User/Service/Factory/Database.php on line 13 Fatal error: Uncaught exception ‘Zend\Db\Adapter\Exception\InvalidArgumentException’ with message ‘The supplied or instantiated driver object does not implement Zend\Db\Adapter\Driver\DriverInterface’ in /var/www/learnzf2/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Adapter.php:82 Stack trace: #0 /var/www/learnzf2/module/User/src/User/Service/Factory/Database.php(13): Zend\Db\Adapter\Adapter->__construct(NULL) #1 [internal function]: User\Service\Factory\Database->createService(Object(Zend\ServiceManager\ServiceManager), ‘database’, ‘database’) #2 /var/www/learnzf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(897): call_user_func(Array, Object(Zend\ServiceManager\ServiceManager), ‘database’, ‘database’) #3 /var/www/learnzf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(1027): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, ‘database’, ‘database’) #4 /var/www/learnzf2/vendor/zendframework/zendframework/library/Zend/Se in /var/www/learnzf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 904

    What is the problem??




    Hi Juanito,
    You have to copy the database dist file (module/User/config/database.local.php.dist) to the application configuration config/autoload BUT with the name database.local.php (just remove the .dist extension). After that take care to edit the settings in the config/autoload/database.local.php to match your database connection settings.



    thank you.
    I understand the solution.


    I moved database.local.php dist to /config/autoload and renamed it properly, but it still seems like it’s not even loading the file. Even if I put die() in it, nothing happens (just the same error). Why is it not loading it?


    To answer to myself – the config was cached, after removing the cache files it’s working now.



    ro.osswald – thanks for following up. I was going crazy with the same problem.



    To get the exams list to display without error, I had to set

    'actioncache' => false,

    in Exam/config/module.config.php

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.