@@ 47-59 (lines=13) @@ | ||
44 | /** |
|
45 | * {@inheritdoc} |
|
46 | */ |
|
47 | public static function validate(array $options, $adapterName) |
|
48 | { |
|
49 | parent::validate($options, $adapterName); |
|
50 | ||
51 | if (empty($options['dsn'])) { |
|
52 | return; |
|
53 | } |
|
54 | ||
55 | $dsn = new DSN($options['dsn']); |
|
56 | if (!$dsn->isValid()) { |
|
57 | throw new \InvalidArgumentException('Invalid DSN: '.$options['dsn']); |
|
58 | } |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * {@inheritdoc} |
|
@@ 64-76 (lines=13) @@ | ||
61 | /** |
|
62 | * {@inheritdoc} |
|
63 | */ |
|
64 | public function createAdapter(array $options = []) |
|
65 | { |
|
66 | if (!empty($options['dsn'])) { |
|
67 | $dsn = new DSN($options['dsn']); |
|
68 | if (!$dsn->isValid()) { |
|
69 | throw new \InvalidArgumentException('Invalid DSN: '.$options['dsn']); |
|
70 | } |
|
71 | ||
72 | $this->DSN = $dsn; |
|
73 | } |
|
74 | ||
75 | return parent::createAdapter($options); |
|
76 | } |
|
77 | } |
|
78 |