Magento 2 Db Connection

[Solved] Magento 2 Db Connection | Php - Code Explorer | yomemimo.com
Question : magento 2 db connection

Answered by : xanthous-xenomorph-xm6kds86sla1

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection('\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION');
$results = $connection->fetchone($query);

Source : | Last Update : Thu, 27 Aug 20

Answers related to magento 2 db connection

Code Explorer Popular Question For Php