public function createDoctrineConnection(array $params)
	{
// 		$managed = isset($params['managed']);
		$options = !empty($params['options']) ? (array)$params['options'] : [];
		
		if(array_key_exists('encoding', $params))
		{
			$params['charset'] = $params['encoding'];
			unset($params['encoding']);
		}
		
		unset($params['managed']);
		unset($params['options']);
		
		$params = array_merge([
			'charset' => 'utf8'
		], $params);
		
		if(array_key_exists('username', $params))
		{
			if(!array_key_exists('user', $params))
			{
				$params['user'] = $params['username'];
				unset($params['username']);
			}
		}
		
		if(isset($params['dsn']))
		{
			list($type, $tmp) = explode(':', $params['dsn'], 2);
			unset($params['dsn']);
			
			$cfg = [
				'driver' => 'pdo_' . $type
			];
			
			if($cfg['driver'] == 'pdo_sqlite')
			{
				if($tmp == ':memory:')
				{
					$cfg['memory'] = true;
				}
				else
				{
					$cfg['path'] = $tmp[1];
				}
			}
			else
			{
				foreach(explode(';', $tmp) as $conf)
				{
					$parts = array_map('trim', explode('=', $conf, 2));
					$cfg[$parts[0]] = $parts[1];
				}
			}
			
			$params = array_merge($cfg, $params);
		}
		
		$conn = new Doctrine\Connection(DriverManager::getConnection($params), $options);
		$conn->setEventDispatcher($this->eventDispatcher);
		
		return $conn;
	}