Magento – PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\\Framework\\Data\\Collection\\AbstractDb::setConnection() must implement interface

magento2

PHP Fatal error: Uncaught TypeError: Argument 1 passed to
Magento\Framework\Data\Collection\AbstractDb::setConnection() must
implement interface Magento\Framework\DB\Adapter\AdapterInterface,
boolean given, called in
/var/www/stg.bulk.ls1/public_html/vendor/magento/framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
on line 124 and defined in
/var/www/stg.bulk.ls1/public_html/vendor/magento/framework/Data/Collection/AbstractDb.php:183\nStack
trace:\n#0
/var/www/stg.bulk.ls1/public_html/vendor/magento/framework/Model/ResourceModel/Db/Collection/AbstractCollection.php(124):
Magento\Framework\Data\Collection\AbstractDb->setConnection(false)\n#1
/var/www/stg.bulk.ls1/public_html/app/code/FishPig/WordPress/Model/ResourceModel/Collection/AbstractCollection.php(24):
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection->__construct(Object(Magento\Framework\Data\Collection\EntityFactory),
Object(Magento\Framework\Logger\Monolog),
Object(Magento\Framework\Data\Collection\Db\FetchStrategy\Query),
Object(Mag in
/var/www/stg.bulk.ls1/public_html/vendor/magento/framework/Data/Collection/AbstractDb.php
on line 183

Best Answer

This problem is caused by the FishPig_WordPress integration module being enabled, but the associated WordPress database is not available. If you've downloaded a copy of a website with this enabled without the attached WordPress site database - your site front-end can likely crash if it's using widgets associated with FishPig_WordPress.

You have two options:

  1. If you're just using the site locally for development, you can disable the module using php bin/magento module:disable FishPig_WordPress. Re-compile and clear the cache afterward.
  2. Find the missing WordPress database and set it up - if you're not sure where the Wordpress site is installed, you can find it's relative path by using the following SQL query SELECT * FROM db.core_config_data WHEREpath= 'wordpress/setup/path';. From there - you can find the necessary details in the wp-config.php to help locate your missing database.
Related Topic