I have following in the configuration of a Zend project
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=food;host=localhost',
'username' => 'root',
'password' => '',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
)
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
I am trying to get DB adapter
($adapter = $adapter = $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter');( $adapter = $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter');
in a controller but is always stuck with.
class: "Zend\ServiceManager\Exception\ServiceNotCreatedException" file: " /path/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php" line: 909 message: "An exception was raised while creating "Zend\Db\Adapter\Adapter"; no instance returned"
$adapter
assignment. Are there no other errors above the one you posted? – Tim Fountain