protected function _getConnection() { if (!isset(self::$_conn)) { self::$_conn = DriverManager::getConnection($this->_getDbParams(), new Configuration()); self::$_conn->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber()); Configurator::configure(self::$_conn->getConfiguration()); if (!Type::hasType('tsvector')) { Type::addType('tsvector', 'Doctrine\\DBAL\\Types\\TextType'); } $platform = self::$_conn->getDatabasePlatform(); $platform->registerDoctrineTypeMapping('tsvector', 'tsvector'); } return self::$_conn; }
protected function _getConnection() { if (!isset(self::$_conn)) { $dbParams = array('driver' => $GLOBALS['db_type'], 'user' => $GLOBALS['db_username'], 'password' => $GLOBALS['db_password'], 'host' => $GLOBALS['db_host'], 'dbname' => $GLOBALS['db_name'], 'port' => $GLOBALS['db_port']); self::$_conn = DriverManager::getConnection($dbParams, new Configuration()); self::$_conn->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber()); Configurator::configure(self::$_conn->getConfiguration()); if (!Type::hasType('tsvector')) { Type::addType('tsvector', 'Doctrine\\DBAL\\Types\\TextType'); } $platform = self::$_conn->getDatabasePlatform(); $platform->registerDoctrineTypeMapping('tsvector', 'tsvector'); } return self::$_conn; }