-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSqlSrvConfig.php
More file actions
47 lines (38 loc) · 1.13 KB
/
SqlSrvConfig.php
File metadata and controls
47 lines (38 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Csanquer\Silex\PdoServiceProvider\Config;
/**
* SqlSrvConfig
*
* @author Charles Sanquer <charles.sanquer@gmail.com>
*/
class SqlSrvConfig extends PdoConfig
{
protected $driver = 'sqlsrv';
protected $defaults = array(
'host' => 'localhost',
'port' => 1433,
'MultipleActiveResultSets' => null,
'password' => null,
);
protected $allowedTypes = array(
'host' => array('string'),
'port' => array('integer', 'null'),
'dbname' => array('string'),
'user' => array('string'),
'password' => array('string', 'null'),
'MultipleActiveResultSets' => array('boolean', 'null'),
);
protected function resolve(array $params)
{
$params = parent::resolve($params);
$params['server'] = $params['host'];
unset($params['host']);
//Windows pdo_sqlsrv compatibility
$params['database'] = $params['dbname'];
unset($params['dbname']);
if (is_null($params['MultipleActiveResultSets'])) {
unset($params['MultipleActiveResultSets']);
}
return $params;
}
}