/** * @return Doctrine\DBAL\Configuration */ public function createServiceDoctrine__default__dbalConfiguration() { $service = new Doctrine\DBAL\Configuration(); $service->setResultCacheImpl($this->getService('doctrine.cache.default.dbalResult')); $service->setSQLLogger(new Doctrine\DBAL\Logging\LoggerChain()); return $service; }
return $eventManager; }); $container['doctrine.connection.default'] = $container->share(function ($container) { // Register types foreach ($GLOBALS['DOCTRINE_TYPES'] as $name => $className) { \Doctrine\DBAL\Types\Type::addType($name, $className); } // reuse existing connection if the driver adapter is used if (strtolower($GLOBALS['TL_CONFIG']['dbDriver']) == 'doctrinemysql') { return \Database::getInstance()->getConnection(); } $config = new \Doctrine\DBAL\Configuration(); // set cache $cache = $container['doctrine.cache.default']; if ($cache) { $config->setResultCacheImpl($cache); } // build connection parameters $connectionParameters = array('dbname' => $GLOBALS['TL_CONFIG']['dbDatabase'], 'user' => $GLOBALS['TL_CONFIG']['dbUser'], 'password' => $GLOBALS['TL_CONFIG']['dbPass'], 'host' => $GLOBALS['TL_CONFIG']['dbHost'], 'port' => $GLOBALS['TL_CONFIG']['dbPort']); switch (strtolower($GLOBALS['TL_CONFIG']['dbDriver'])) { case 'mysql': case 'mysqli': $connectionParameters['driver'] = 'pdo_mysql'; $connectionParameters['charset'] = $GLOBALS['TL_CONFIG']['dbCharset']; if (!empty($GLOBALS['TL_CONFIG']['dbSocket'])) { $connectionParameters['unix_socket'] = $GLOBALS['TL_CONFIG']['dbSocket']; } break; default: throw new RuntimeException('Database driver ' . $GLOBALS['TL_CONFIG']['dbDriver'] . ' not known by doctrine.'); }