public function getServiceConfig() { return array('factories' => array('Zend\\Db\\Adapter\\Adapter' => function ($serviceManager) { $adapterFactory = new \Zend\Db\Adapter\AdapterServiceFactory(); $adapter = $adapterFactory->createService($serviceManager); \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::setStaticAdapter($adapter); return $adapter; })); }
/** * @param ServiceLocatorInterface $serviceLocator * @return \Home\Service\Store */ public function createService(ServiceLocatorInterface $serviceLocator) { $adapterFactory = new \Zend\Db\Adapter\AdapterServiceFactory(); $adapter = $adapterFactory->createService($serviceLocator); $config = $serviceLocator->get('Config'); if (isset($config['db']['profilerEnabled']) && $config['db']['profilerEnabled']) { $adapter->setProfiler(new \Zend\Db\Adapter\Profiler\Profiler()); } \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::setStaticAdapter($adapter); return $adapter; }
<?php /** * Global Configuration Override * * You can use this file for overriding configuration values from modules, etc. * You would place values in here that are agnostic to the environment and not * sensitive to security. * * @NOTE: In practice, this file will typically be INCLUDED in your source * control, so do not include passwords or other sensitive information in this * file. */ return array('db' => array('driver' => 'Pdo', 'dsn' => 'mysql:dbname=u100254857_llco;host=mysql.hostinger.es', 'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''), 'user' => 'u100254857_admin', 'password' => 'conejito'), 'service_manager' => array('factories' => array('Zend\\Db\\Adapter\\Adapter' => function ($serviceManager) { $adapterFactory = new Zend\Db\Adapter\AdapterServiceFactory(); $adapter = $adapterFactory->createService($serviceManager); \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::setStaticAdapter($adapter); return $adapter; })));