Completed
Pull Request — master (#603)
by Tom
09:42
created

DBALConnection::setConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace DoctrineORMModule\Options;
4
5
use Doctrine\DBAL\Driver\PDOMySql\Driver;
6
use Laminas\Stdlib\AbstractOptions;
7
8
/**
9
 * DBAL Connection options
10
 */
11
class DBALConnection extends AbstractOptions
12
{
13
    /**
14
     * Set the configuration key for the Configuration. Configuration key
15
     * is assembled as "doctrine.configuration.{key}" and pulled from
16
     * service locator.
17
     *
18
     * @var string
19
     */
20
    protected $configuration = 'orm_default';
21
22
    /**
23
     * Set the eventmanager key for the EventManager. EventManager key
24
     * is assembled as "doctrine.eventmanager.{key}" and pulled from
25
     * service locator.
26
     *
27
     * @var string
28
     */
29
    protected $eventmanager = 'orm_default';
30
31
    /**
32
     * Set the PDO instance, if any, to use. If a string is set
33
     * then the alias is pulled from the service locator.
34
     *
35
     * @var null|string|\PDO
36
     */
37
    protected $pdo = null;
38
39
    /**
40
     * Setting the driver is deprecated. You should set the
41
     * driver class directly instead.
42
     *
43
     * @var string
44
     */
45
    protected $driverClass = Driver::class;
46
47
    /**
48
     * Set the wrapper class for the driver. In general, this should not
49
     * need to be changed.
50
     *
51
     * @var string|null
52
     */
53
    protected $wrapperClass = null;
54
55
    /**
56
     * Driver specific connection parameters.
57
     *
58
     * @var array
59
     */
60
    protected $params = [];
61
62
    /**
63
     * @var array
64
     */
65
    protected $doctrineTypeMappings = [];
66
67
    /**
68
     * @var array
69
     */
70
    protected $doctrineCommentedTypes = [];
71
72
    /**
73
     * @var bool
74
     */
75
    protected $useSavepoints = false;
76
77
    /**
78
     * @param string $configuration
79 72
     */
80
    public function setConfiguration($configuration)
81 72
    {
82 72
        $this->configuration = $configuration;
83
    }
84
85
    /**
86
     * @return string
87 72
     */
88
    public function getConfiguration()
89 72
    {
90
        return "doctrine.configuration.{$this->configuration}";
91
    }
92
93
    /**
94
     * @param string $eventmanager
95 72
     */
96
    public function setEventmanager($eventmanager)
97 72
    {
98 72
        $this->eventmanager = $eventmanager;
99
    }
100
101
    /**
102
     * @return string
103 72
     */
104
    public function getEventmanager()
105 72
    {
106
        return "doctrine.eventmanager.{$this->eventmanager}";
107
    }
108
109
    /**
110
     * @param array $params
111 72
     */
112
    public function setParams($params)
113 72
    {
114 72
        $this->params = $params;
115
    }
116
117
    /**
118
     * @return array
119 72
     */
120
    public function getParams()
121 72
    {
122
        return $this->params;
123
    }
124
125
    /**
126
     * @param  array                                     $doctrineTypeMappings
127
     * @return \DoctrineORMModule\Options\DBALConnection
128
     */
129
    public function setDoctrineTypeMappings($doctrineTypeMappings)
130
    {
131
        $this->doctrineTypeMappings = (array) $doctrineTypeMappings;
132
133
        return $this;
134
    }
135
136
    /**
137
     *
138
     * @return array
139 72
     */
140
    public function getDoctrineTypeMappings()
141 72
    {
142
        return $this->doctrineTypeMappings;
143
    }
144
145
    /**
146
     * @param  array                                     $doctrineCommentedTypes
147 2
     */
148
    public function setDoctrineCommentedTypes(array $doctrineCommentedTypes)
149 2
    {
150 2
        $this->doctrineCommentedTypes = $doctrineCommentedTypes;
151
    }
152
153
    /**
154
     * @return array
155 74
     */
156
    public function getDoctrineCommentedTypes()
157 74
    {
158
        return $this->doctrineCommentedTypes;
159
    }
160
161
    /**
162
     * @param null|string $driverClass
163 72
     */
164
    public function setDriverClass($driverClass)
165 72
    {
166 72
        $this->driverClass = $driverClass;
167
    }
168
169
    /**
170
     * @return null|string
171 72
     */
172
    public function getDriverClass()
173 72
    {
174
        return $this->driverClass;
175
    }
176
177
    /**
178
     * @param null|\PDO|string $pdo
179
     */
180
    public function setPdo($pdo)
181
    {
182
        $this->pdo = $pdo;
183
    }
184
185
    /**
186
     * @return null|\PDO|string
187 72
     */
188
    public function getPdo()
189 72
    {
190
        return $this->pdo;
191
    }
192
193
    /**
194
     * @param string $wrapperClass
195
     */
196
    public function setWrapperClass($wrapperClass)
197
    {
198
        $this->wrapperClass = $wrapperClass;
199
    }
200
201
    /**
202
     * @return string
203 72
     */
204
    public function getWrapperClass()
205 72
    {
206
        return $this->wrapperClass;
207
    }
208
209
    /**
210
     * @return bool
211
     */
212
    public function useSavepoints()
213
    {
214
        return $this->useSavepoints;
215
    }
216
217
    /**
218
     * @param bool $useSavepoints
219
     */
220
    public function setUseSavepoints($useSavepoints)
221
    {
222
        $this->useSavepoints = $useSavepoints;
223
    }
224
}
225